Giter Site home page Giter Site logo

pyecoforest's Introduction

pyecoforest's People

Contributors

pjanuario avatar

Watchers

 avatar Connor McLeod avatar

Forkers

highlandr jvinel

pyecoforest's Issues

Handle connection errors more gracefully.

Describe the bug

Frequently the integration logs connectivity with the device, not clear if this the device getting offline or if it's a transient error.

2023-10-26 13:40:53.951 ERROR (MainThread) [homeassistant.components.ecoforest.coordinator] Unexpected error fetching ecoforest data: 'ConnectError' object has no attribute 'response'
Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/anyio/streams/tls.py", line 133, in _call_sslobject_method
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/ssl.py", line 979, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLSyscallError: Some I/O error occurred (_ssl.c:1002)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 78, in start_tls
    raise exc
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 69, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/anyio/streams/tls.py", line 125, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "/home/vscode/.local/lib/python3.11/site-packages/anyio/streams/tls.py", line 154, in _call_sslobject_method
    raise BrokenResourceError from exc
anyio.BrokenResourceError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
    yield
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
    raise exc
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
    raise exc
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 156, in _connect
    stream = await stream.start_tls(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 66, in start_tls
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/vscode/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.11/site-packages/pyecoforest/api.py", line 79, in _request
    response = await self._client.post(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/vscode/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/workspaces/ha-core/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/ha-core/homeassistant/components/ecoforest/coordinator.py", line 35, in _async_update_data
    data = await self.api.get()
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/pyecoforest/api.py", line 48, in get
    "status": await self._status(),
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/pyecoforest/api.py", line 111, in _status
    return await self._request(data={"idOperacion": API_STATUS_OP})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.11/site-packages/pyecoforest/api.py", line 91, in _request
    if error.response.status_code in (
       ^^^^^^^^^^^^^^
AttributeError: 'ConnectError' object has no attribute 'response' 

Support for ASHP/GSHP units, such as EcoGeo series

Is your feature request related to a problem? Please describe.
I noticed there are some issues on here and the Home Assistant repo (home-assistant/home-assistant.io#30031) related to supporting other EcoForest units. I have an EcoGeo unit, with an Easynet card and would like to at least get measurement information from the unit into HA as well, however I've found some differences in the API with the unit I have that I suspect are shared with other units.

Describe the solution you'd like
I used your existing code as a basis for a bare-bones / proof-of-concept API client for the EcoGeo unit I'm running here: https://github.com/ostracon/ecoforest-ecogeo-api/blob/main/ecoforest/api.py

I would ideally like to get this code up to a level where I could open a PR, but as well as improving my own code quality/documentation, I think due to the marked differences in the API, a refactor of pyecoforest might be needed that provided separate classes specific to different units or classes of unit (e.g. GSHP, ASHP, Pellet stove), depending on how Ecoforest have separated things out, as well as the underlying common API. I'm open to ideas and happy to contribute though!

Client error '404 Not Found' using HOST: http://ecoforesthome.com/it/user for ecoforest ECOAIR boiler

Describe the bug
I have a Ecoforest ECOAIR boiler at home and I tried using the integration unfortunately with some issues.

To Reproduce
HA version 2023.10.0
In the integration parameters I used as HOST: http://ecoforesthome.com/it/user , user and pwd.
but i got in the log:
httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://ecoforesthome.com/it/user/recepcion_datos_4.cgi'
For more information check: https://httpstatuses.com/404
I tried also with http://ecoforesthome.com/ or http://ecoforesthome.com/es

I tried also with mine local url:
https://192.168.1.198:8000/
because I checked the url: https://192.168.1.198:8000/recepcion_datos_4.cgi and it seems working correctly.
but I got a different error see in logs attached.
File "/usr/local/lib/python3.11/site-packages/pyecoforest/models/device.py", line 123, in build
model=stats["Me"],

I look forward to hearing from you and thanks for the great job you did.
Matteo

Add more documentation

It would be great if you could add some documentation about what devices are supported (/have been tested) and what features (what kinds of things can be done with this API).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.