jesserizzo / envoy_reader

MIT License
37 stars 26 forks source link

Add a single entry point for Home Assistant #22

Closed gtdiehl closed 4 years ago

gtdiehl commented 4 years ago

Add in a single method that Home Assistant will use to grab data once every time it polls.

This is not a complete fix, but a beginning to reduce the number of calls being made to Envoys. Using this method and an updated HA sensor code the Envoy running firmware >= 3.9 is not overwhelmed which previously caused the Envoy to not respond sometimes when requesting inverter data.

jesserizzo commented 4 years ago

@gtdiehl Are you able to make the needed changes in Home Assistant to support this? I'll probably hold off on merging this until that is ready to go (since I'm lazy and merging everything straight into master)

gtdiehl commented 4 years ago

@jesserizzo I know the feeling, I've been a bit lazy these past few weeks! Hold off for a week as I haven't opened a PR on the HA side yet. Let's see if they want changes on the HA sensor side of the code, as that may take some time to make their requested changes.

gtdiehl commented 4 years ago

@jesserizzo Can you go ahead and merge the code and create a new release in PyPi? I'll then open a PR in HA. I think my code on the HA sensor side is okay. Thx

jesserizzo commented 4 years ago

@gtdiehl It's version 0.15.0

gtdiehl commented 4 years ago

@jesserizzo I downloaded 0.15.0 from PyPi but it appears the update() does not exist. Can you try and recreate the package?

Below is the output of dir() showing the functions in the v0.15.0 of envoy_reader:

(envoyreader) greg@GregsLaptop:~$ pip install envoy_reader
Collecting envoy_reader
  Using cached https://files.pythonhosted.org/packages/f4/93/83ef120990c4263b5363aab1ca0af7fa56e6cebbe94055512e3b5268873c/envoy_reader-0.15.0-py3-none-any.whl
...
Successfully installed certifi-2019.11.28 chardet-3.0.4 envoy-reader-0.15.0 h11-0.8.1 h2-3.2.0 hpack-3.0.0 http3-0.6.7 hyperframe-5.2.0 idna-2.9 requests-2.23.0 requests-async-0.6.2 rfc3986-1.3.2 urllib3-1.25.8
(envoyreader) greg@GregsLaptop:~$ python
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from envoy_reader.envoy_reader import EnvoyReader
>>> dir(EnvoyReader)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'call_api', 'consumption', 'create_connect_errormessage', 'create_json_errormessage', 'daily_consumption', 'daily_production', 'detect_model', 'get_serial_number', 'hasProductionAndConsumption', 'inverters_production', 'lifetime_consumption', 'lifetime_production', 'message_consumption_not_available', 'production', 'run_in_console', 'seven_days_consumption', 'seven_days_production']
>>>