ksheumaker / homeassistant-apsystems_ecur

Home Assistant custom component for local querying of APSystems ECU-R Solar System
Apache License 2.0
177 stars 43 forks source link

HA Release 2022.4 causes sensors to fail #62

Closed HAEdwin closed 2 years ago

HAEdwin commented 2 years ago

sensor.py needs to be modified (no time to create pull request at this moment, this is my reminder here) Add the following line: from homeassistant.helpers.entity import EntityCategory Replace: entity_category="diagnostic" for entity_category=EntityCategory.DIAGNOSTIC

switch.py and binairy_sensor.py also fixed in my repository. If no comments are made on this fix I'll close this issue.

otello86 commented 2 years ago

Hello i do the update on sensor.py, it solved some problems but ECU_querying is still unavailable. I saw 2 lines inswitch.py and binary_sensor.py which could be the reason :

switch.py: @property def entity_category(self): return "config" binary_sensor.py @property def entity_category(self): return "diagnostic">

and I already have this error in logs :

Logger: homeassistant.components.switch Source: helpers/entity_registry.py:529 Integration: Commutateur (documentation, issues) First occurred: 08:43:44 (2 occurrences) Last logged: 08:43:45

Error adding entities for domain switch with platform apsystems_ecur Error while setting up apsystems_ecur platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity entry = entity_registry.async_get_or_create( File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 345, in async_get_or_create return self.async_update_entity( File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 529, in async_update_entity raise ValueError("entity_category must be a valid EntityCategory instance") ValueError: entity_category must be a valid EntityCategory instance

Scholtz-i commented 2 years ago

I have made all the changes from HAEdwin (Pull requests => File changed) and it works perfectly again. Big thanks to HAEdwin.

otello86 commented 2 years ago

Yes i saw, thanks

HAEdwin commented 2 years ago

For a quick reference I'll post the changes:

sensor.py ---------------------------------------------

image

binary_sensor.py ---------------------------------------------

image

switch.py ---------------------------------------------

image

TexTown commented 2 years ago

In theory, shouldn't this be closed AFTER the PR that solves this was merged? (even better, have the PR do that automatically...) I hope @ksheumaker can do that soon, I'm not updating HA until this fix is in the integration.

HAEdwin commented 2 years ago

You are soo right. Better for reference also (if one might encounter the same issue).

ksheumaker commented 2 years ago

Compatibility with 2022.4 fixed in release v1.2.12