benleb / surepy

🐾 Library & CLI to monitor and control the Pet Door & Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare
https://pypi.org/project/surepy/
MIT License
76 stars 36 forks source link

Log error: "error while setting up sureha platform for sensor" #204

Open ChristophCaina opened 7 months ago

ChristophCaina commented 7 months ago

As mentioned in https://github.com/benleb/sureha/issues/44 I am getting the following error in my logs, which is also showing a reference to SurePy:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:360
Integration: Sensor (documentation, issues)
First occurred: 5:01:34 PM (1 occurrences)
Last logged: 5:01:34 PM

Error while setting up sureha platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/sureha/sensor.py", line 64, in async_setup_entry
    entities.append(Flap(spc.coordinator, surepy_entity.id, spc))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/sureha/sensor.py", line 184, in __init__
    self._attr_entity_picture = self._surepy_entity.icon
                                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/surepy/entities/devices.py", line 247, in icon
    if self.state == LockState.LOCKED_ALL:
       ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/surepy/entities/devices.py", line 235, in state
    return LockState(self._data["status"]["locking"]["mode"])
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'mode'