bm1549 / home-assistant-frigidaire

Custom component for the Frigidaire integration
30 stars 10 forks source link

Dehumidifier error #17

Closed ZachPL closed 2 years ago

ZachPL commented 2 years ago

I started getting this error a few months ago, I don't think I changed anything, been busy and havent reported it, home assistant shows it as undefined

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 613, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 540, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/humidifier/init.py", line 170, in state_attributes data[ATTR_MODE] = self.mode File "/config/custom_components/frigidaire/humidifier.py", line 158, in mode return FRIGIDAIRE_TO_HA_MODE[frigidaire_mode] KeyError: 6

I can still connect to the dehumidifer fine through the fridgidair app, so I think it is a problem with the code @gazpachoking is this happening yours?

ZachPL commented 2 years ago

Well I fixed it, my humidifier was set to auto in the app, I changed it to Dry and it started working in HA

So I think auto needs to be added here

FRIGIDAIRE_TO_HA_MODE = { frigidaire.Mode.DRY: MODE_NORMAL, frigidaire.Mode.CONTINUOUS: MODE_BOOST, }

EDIT: I added MODE_AUTO to the three spots where the others are mentioned, didn't seem to work, might have the fridigiare code wrong I just tried AUTO

bm1549 commented 2 years ago

I have no way of testing this without a humidifier. If you find something that fixes your issue, open up a PR and I'm happy to merge it in

ZachPL commented 2 years ago

Thanks, i'll work on it, I just saw that gazpachoking added those new return codes for auto and quiet in november to the frigidaire library which were the same codes I was getting

ZachPL commented 2 years ago

Sorry forgot to link it, but this at least allows these modes to show without an error

https://github.com/bm1549/home-assistant-frigidaire/pull/18

bm1549 commented 2 years ago

Thanks for fixing this. Just merged in the changes