Aqara door sensors entities not available in HA

If I could have a full debug log from ha upstart (enable debug logging for deconz as detailed in deconz integration documentation) as well as the entity_registry and device_registry files I could see what might have changed. Since you anonymised the serials in the previous logs feel free to share the files through a PM on this forum.

There has been no real change to the integration over the last year but deconz has continued to evolve, it could very well be some change in behaviour in the device support in the new device which differs from the old.

The logs could at least shed some light on any differences from when the entities was created in home assistant.

Hi @Robban May thanks, I’ve PM you the files required.

@Mimiix I am not sure I what event.

The event when it opens or closes.

It does not generate any events. I have subscribed to state_changed
I open/closed one of the old sensors and I can see the events.

In phoscon? You can’t subscribe there

When having issues you should first look in your log for any errors :slight_smile:

This error says the binary sensor platform is not setup.

2023-09-17 18:36:52.844 ERROR (MainThread) [homeassistant.components.binary_sensor] 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'

It is due to this sensor not having the state property “open”

             '168': {'config': {'battery': 20,
                                'duration': 1,
                                'locked': False,
                                'on': True,
                                'reachable': True},
                     'etag': '2e18cb0955b460bdca033eea2573a4fa',
                     'lastannounced': None,
                     'lastseen': '2023-09-17T17:36Z',
                     'manufacturername': '_TZE200_htnnfasr',
                     'modelid': 'TS0601',
                     'name': 'OpenClose 168',
                     'state': {'lastupdated': '2023-09-14T23:00:24.280',
                               'seconds_remaining': 0},
                     'type': 'ZHAOpenClose',
                     'uniqueid': 'xxxx:62-01-0500'},

If you remove that device or fix its DDF it will work

So in this case, a broken DDF from another device breaks this one?

Yes. It has happened to a couple of users of a new zigbee water controller from tuya.

Haaaa, nice to know, thx.
So it’s the same issue than here Fix LIDL smart watering timer missing ZHAOpenClose state/open item (_TZE200_htnnfasr) by Smanar · Pull Request #7207 · dresden-elektronik/deconz-rest-plugin · GitHub

Yes, that’s the one

1 Like

Thanks a lot @Robban I have removed that device, restarted the add on , reloaded the integration and the and it worked!
That solved as well my Aqara water leak sensors that had the exact same problem.

Thanks again so much guys!