danielkaldheim / ha_airstage

Connects your Fujitsu Airstage air conditioner to Home Assistant.
MIT License
53 stars 9 forks source link

One climate is not being reconized correctly anymore as an climate device #39

Open HSken opened 6 days ago

HSken commented 6 days ago

I got the update of HA today: 2024.10.3 (I'm guessing this is what broke it, didn't change much more today)

Sinse then one of the 3 A/C isn't reconized correcly anymore, only some of the entities are added, they do work, so its not like it got new ip or forgot it... I tried removing it and adding it again, but that didn't help: Note its missing A/C icon with on/off status and temps also not the model name, that used to be there, its an other model then the other two image

This is one of the others that sill work: The is an A/C bureau-airco icon with status off and temps image

Also when I try to add it again on the dashboard and type climate. I only get the two other A\C's don't know what to do.

HSken commented 6 days ago

I enabled debugging when reloading and noticed this error:

2024-10-20 00:05:20.164 ERROR (MainThread) [homeassistant.components.climate] Error adding entity None for domain climate with platform fujitsu_airstage
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 813, in _async_add_entity
    capabilities=entity.capability_attributes,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 324, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 489, in capability_attributes
    supported_features = self.supported_features
                         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 328, in __getattribute__
    _supported_features: ClimateEntityFeature = super().__getattribute__(
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fujitsu_airstage/climate.py", line 270, in supported_features
    if self.swing_mode:
       ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 324, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/fujitsu_airstage/climate.py", line 189, in swing_mode
    if self._ac.get_vertical_direction() != None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyairstage/airstageAC.py", line 173, in get_vertical_direction
    return VALUE_TO_VERTICAL_POSITION[int(value)]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 6
HSken commented 6 days ago

Ok looking at the error and my programming experience, I expected it recieved some unknow value (6?) for the VALUE_TO_VERTICAL_POSITION key, so I changed the position of the AC Vent and reloaded and its fixed 👍 .

I have zero experience with Python, but can't you do something like this: return VALUE_TO_VERTICAL_POSITION.get(int(value), "unknown") to gracefully handle the unknow values?