bm1549 / home-assistant-frigidaire

Custom component for the Frigidaire integration
MIT License
34 stars 11 forks source link

New Frigidaire Portable A/C Models "Break" the Integration #61

Open indomitableMan opened 3 months ago

indomitableMan commented 3 months ago

Frigidaire portable air conditioner model FHPW142AC1 breaks frigidaire integration due to new "mode" settings. This model supports the following "modes":

The A/C modes for this model generate errors in the Home Assistant log due to the unexpected combination of responses from the Frigidaire API as follows:

`2024-06-27 02:46:45.884 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1050, in _async_update_entity_states await entity.async_update_ha_state(True) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1061, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ 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 464, in state hvac_mode = self.hvac_mode ^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 324, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/frigidaire/climate.py", line 184, in hvac_mode return FRIGIDAIRE_TO_HA_MODE[frigidaire_mode]


KeyError: 'AUTO'`

The result is that although there is an Entity created that represents this A/C unit, the Entity has no information about the unit's status nor can Home Assistant issue any commands to this unit.
rothn commented 1 month ago

The change might just be as simple as adding frigidaire.Mode.AUTO to FRIGIDAIRE_TO_HA_MODE and double-mapping that to HVAC_MODE_AUTO (currently used by frigidaire.Mode.ECO). But then what do we use to represent ECO mode? Any HomeAssistant experts that can weigh in here?

The quick fix would be to only modify FRIGIDAIRE_TO_HA_MODE and just have a non-bijective mapping to preserve the current behavior.

rothn commented 1 month ago

@bm1549 Looks like a dupe of https://github.com/bm1549/home-assistant-frigidaire/issues/39