mool / home-assistant-bgh-smart

BGH Smart integration for Home Assistant
15 stars 8 forks source link

Not work anymore Homeassistant 2022.3.8 #11

Open egbaci opened 2 years ago

egbaci commented 2 years ago

Error while setting up bgh_smart platform for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/bgh_smart/climate.py", line 77, in setup_platform add_entities(BghHVAC(device, client) for device in devices) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 321, in _schedule_add_entities list(new_entities), File "/config/custom_components/bgh_smart/climate.py", line 77, in add_entities(BghHVAC(device, client) for device in devices) File "/config/custom_components/bgh_smart/climate.py", line 97, in init self._parse_data() File "/config/custom_components/bgh_smart/climate.py", line 113, in _parse_data self._mode = MAP_MODE_ID[self._device['data']['mode_id']] KeyError: 255

r-antonio commented 2 years ago

Just testing this, I need AA batteries to confirm but changing MAP_MODE_ID and MAP_FAN_MODE_ID last key which is 254 to 255, the value returned now by BGH's API, the script doesn't crash and HA detects the devices

Edit: I checked pybgh library, the value 255 is mapped there as 'no_change' but not mapped here, I don't know much of HA if adding that could be a problem or not https://github.com/mool/pybgh/blob/a7ce9735b3a47ffb520132386ac1e36eedb61378/pybgh/__init__.py