Home Assistant sensor devices are losing their entities from deconz/phoscon/conbee

Hello,

I use Home Assistant (latest version as of today) together with the Conbee II Stick and official deconz-addon for Zigbee integration. Everything is running on raspberry pi4.

Every once in a while some sensors lose connection and have to be recoupled, like aqara motion sensors. This has never been a problem so far.

For about 1-2 months I have been experiencing some strange behavior with at least 3 different devices:

  • one motion sensor by aqara, called “Küche” (Kitchen)

  • one motion sensor by Tradfri (Ikea) called Tradfri Motion Sensor

  • one water leak sensor called “'Waschbecken großes Bad” (master bathroom)

The error/bug is always the same:

  1. The sensor loses connection and is greyed out within home assistant.

  2. I enter the phoscon web interface via deconz-plugin and recouple the device.

  3. Within phoscon everything looks fine and the sensors are working perfectly, e.g. motion is detected.

  4. When I go back to Home Assistant UI the device shows up again but has lost some of it’s entities. Let me illustrate that:

image

You can see, the motion sensor’s entity is still unavailable, but illuminance is working fine (and it gets updated within Home Assistant).

Another example:
image

The water leak sonsor entity is unavailable, but temperature and battery are being updated fine.

Last one:

image

Keep in mind that when I enter phoscon web interface, everything is working fine, so I figured this has to be some kind of “error of the deconz add-on communicating with home assistant or home assistant not picking up the devices/entities correctly”.

I searched some logs but actually didn’t find anything particularly helpful:

'xy': [0, 0]},
'devicemembership': ['156'],
'etag': 'be3a6ddacd82988d2a86be42f7fcfe22',
'id': '17',
'lights': [],
'name': 'TRADFRI motion sensor',
'scenes': [],
'state': {'all_on': False, 'any_on': False},
'type': 'LightGroup',
'uniqueid': '68:0a:e2:ff:fe:15:7d:85'},
'1712': {'action': {'alert': 'none',
'bri': 127,
'colormode': 'hs',
'ct': 0,
'effect': 'none',
'hue': 0,
'on': False,
'sat': 127,
'scene': None,
'ep': 1,
'etag': 'cbbe04cf3a4b91eb7245f5e179c01947',
'lastannounced': '2023-09-04T06:31:24Z',
'lastseen': '2023-09-08T05:29Z',
'manufacturername': 'IKEA of Sweden',
'modelid': 'TRADFRI motion sensor',
'name': 'TRADFRI Bewegungsmelder',
'state': {'dark': True,
'lastupdated': '2023-09-08T03:57:52.285',
'presence': False},
'swversion': '2.0.022',
'type': 'ZHAPresence',
'uniqueid': '68:0a:e2:ff:fe:15:7d:85-01-0006'},
'157': {'config': {'battery': 100,
'enrolled': 0,
'on': True,
'pending': [],
'reachable': True,
'temperature': 2900},
'ep': 1,
'etag': 'd462b38fd859e866bf2557c35fca08b4',
'lastannounced': None,
'lastseen': '2023-09-08T04:42Z',
'manufacturername': 'LUMI',
'modelid': 'lumi.sensor_wleak.aq1',
'name': 'Waschbecken großes Bad',
'state': {'lastupdated': '2023-09-08T04:42:46.419',
'lowbattery': False,
'tampered': False,
'water': False},
'swversion': '0.0.0_0004',
'type': 'ZHAWater',
'uniqueid': '00:15:8d:00:04:9f:b8:4f-01-0500'},
'16': {'config': {'battery': 100,
'duration': 90,
'on': True,
'reachable': True,
'temperature': 3000},
2023-09-08 07:33:07.565 DEBUG (MainThread) [pydeconz.websocket] {"attr":{"id":"157","lastannounced":null,"lastseen":"2023-09-08T05:33Z","manufacturername":"LUMI","modelid":"lumi.sensor_wleak.aq1","name":"Waschbecken großes Bad","swversion":"0.0.0_0004","type":"ZHAWater","uniqueid":"00:15:8d:00:04:9f:b8:4f-01-0500"},"e":"changed","id":"157","r":"sensors","t":"event","uniqueid":"00:15:8d:00:04:9f:b8:4f-01-0500"}

This one - I figure - has something to do with my custom built rain sensor but I post it because it is the actual only error I could find regarding deconz:

Logger: homeassistant.components.binary_sensor
Source: components/deconz/binary_sensor.py:129
Integration: Binary sensor (documentation, issues)
First occurred: 7:30:17 AM (1 occurrences)
Last logged: 7:30:17 AM
Error while setting up deconz platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/deconz/binary_sensor.py", line 221, in async_setup_entry
    gateway.register_platform_add_device_callback(
  File "/usr/src/homeassistant/homeassistant/components/deconz/gateway.py", line 182, in register_platform_add_device_callback
    async_add_device(EventType.ADDED, device_id)
  File "/usr/src/homeassistant/homeassistant/components/deconz/gateway.py", line 172, in async_add_device
    add_device_callback(EventType.ADDED, device_id)
  File "/usr/src/homeassistant/homeassistant/components/deconz/binary_sensor.py", line 216, in async_add_sensor
    ) or description.value_fn(sensor) is None:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/deconz/binary_sensor.py", line 129, in <lambda>
    value_fn=lambda device: device.open,
                            ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pydeconz/models/sensor/open_close.py", line 28, in open
    return self.raw["state"]["open"]
           ~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'open'

Any ideas?

link to the full deconz log:

Ok I have the same issue like here: Missing entities in deconz intergration for open/close sensors · Issue #94921 · home-assistant/core · GitHub

and I was able to solve it by deleting the relevant device.

@EdwardEnglish How did you find out which device was causing the issue mentioned in the log. I get the same error log entry, but I’m not able yet to find out which binary_sensor is causing this.

By “deleting the relevant device” I meant deleting the water valve by LIDL mentioned at the linked GitHub post.

Apparently this LIDL water valve caused that the binary sensors couldn’t be set up correctly. I wrongly interpreted this as an unrelated issue caused by my rainsensor but I was wrong. After deleting the Lidl water valve everything worked fine again.

By the logs itself I wasn’t able to identify the device but giving you a hint, the Lidl device is a zigbee tuya open close valve at its core. Maybe you have a similar device? Then I would try to delete this first, maybe it helps. Good luck

I have the same issue. On my side it goes for namron led dimmers and Philips hue motion sensors (both zigbee). Really frustrating.