jnimmo / pyIntesisHome

Python interface for IntesisHome devices
MIT License
35 stars 21 forks source link

KeyError in update_device_state #18

Closed jnimmo closed 4 years ago

jnimmo commented 4 years ago

Multiple users have reported the error below

020-01-16 18:26:38 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform intesishome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 158, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/intesishome/climate.py", line 95, in async_setup_platform
    await controller.poll_status()
  File "/usr/local/lib/python3.7/site-packages/pyintesishome/pyintesishome.py", line 474, in poll_status
    self._update_device_state(deviceId, status["uid"], status["value"])
  File "/usr/local/lib/python3.7/site-packages/pyintesishome/pyintesishome.py", line 537, in _update_device_state
    ][value]
KeyError: 2
vannetta commented 4 years ago

Hi, I have the same error:

020-01-20 16:45:43 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform intesishome

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 158, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/intesishome/climate.py", line 95, in async_setup_platform
    await controller.poll_status()
  File "/usr/local/lib/python3.7/site-packages/pyintesishome/pyintesishome.py", line 474, in poll_status
    self._update_device_state(deviceId, status["uid"], status["value"])
  File "/usr/local/lib/python3.7/site-packages/pyintesishome/pyintesishome.py", line 537, in _update_device_state
    ][value]
KeyError: 32768

but I have only one device. The configuration of the device into Intesishome is: Facility: PANASONIC_FOIS Zone: Casa Fois Device: FOIS HOME NEW MAC: xxxxxxxx Device type Panasonic Aquarea AW Subfamily: with external temperature sensor Model: climate + power consumption

docker | true hassio | true os_name | Linux python_version | 3.7.6 timezone | Europe/Rome version | 0.104.2

flynnguy commented 4 years ago

yeah, I had some time so I dug into this a bit, seems like it wasn't adding the 2nd device, I had also gone in and set the external LED to blinking only on change which it seems to not like. I opened a PR which seems to resolve this locally for me.