vincentwolsink / home_assistant_enphase_envoy_installer

This is a HACS custom integration for Enphase Envoys with firmware version 7 and up.
Apache License 2.0
54 stars 10 forks source link

Refactoring how data is fetched and collected by datacoordinator.update #63

Closed mnederlof closed 11 months ago

mnederlof commented 11 months ago

Added methods for backward compatibility (which fetches the data from the EnvoyData class)

Also renamed some properties to match the EntityDescription.key as defined in const.py

This also removes the __getattr__ method from the EnvoyReader class, making it a more straight forward class to read.

mnederlof commented 11 months ago

Please test if it works for you too before merging 😄

vincentwolsink commented 11 months ago
Traceback (most recent call last):
  File "/Users/vincent/devel/home_assistant_enphase_envoy_installer/custom_components/enphase_envoy/envoy_reader.py", line 560, in <module>
    class EnvoyReader:
  File "/Users/vincent/devel/home_assistant_enphase_envoy_installer/custom_components/enphase_envoy/envoy_reader.py", line 1238, in EnvoyReader
    battery_storage = _async_get_property("battery_storage")
TypeError: 'staticmethod' object is not callable
mnederlof commented 11 months ago
Traceback (most recent call last):
  File "/Users/vincent/devel/home_assistant_enphase_envoy_installer/custom_components/enphase_envoy/envoy_reader.py", line 560, in <module>
    class EnvoyReader:
  File "/Users/vincent/devel/home_assistant_enphase_envoy_installer/custom_components/enphase_envoy/envoy_reader.py", line 1238, in EnvoyReader
    battery_storage = _async_get_property("battery_storage")
TypeError: 'staticmethod' object is not callable

That is weird, i did not encounter this issue, will test again, or do it differently...

mnederlof commented 11 months ago

I've moved the _async_get_property method out of the class. it should work better now :)