I’m building a simple Home Assistant panel for the family, with the status of three doors on the main screen. I want it to be clear when a door is open, closed, or when the sensor status cannot be trusted.
For those using Aqara contact sensors, how do you handle a lost connection or an empty battery? Does your integration change the entity to unavailable, or can it keep showing the last closed state?
I’m considering a separate grey “status unknown” indicator. A door may stay closed for a long time, so time since the last state change alone would not be a useful warning. What availability or last-seen information do you actually get, and which sensor model and connection method are you using?
This is a design question for my panel, not a fault I have confirmed. I’d appreciate examples of what has worked in daily use.
3 Likes
@mikael_t_aman Great design question! Building a family-friendly panel that clearly distinguishes closed from unavailable is definitely the right mindset—nothing erodes trust in a smart home like a door showing “closed” when the sensor’s actually been dead for days.
From the Aqara side, here’s what typically drives those scenarios you’re planning for:
Connection drops & battery failures
For the standard Aqara Door and Window Sensor (Zigbee models like lumi.sensor_magnet.aq2 or T1), going offline usually stems from a few familiar culprits: distance from the Hub, low battery, or metal surface interference killing the signal. When that happens, the sensor stops reporting entirely—so what your Home Assistant integration displays depends heavily on how the integration handles missed check-ins. Some integrations mark entities unavailable after a timeout; others (frustratingly) freeze on the last known state.
What state info you actually get
Aqara’s own automations expose conditions like Is open, Is closed, Opened for over, and Closed for over—but notably, there’s no native “last seen” or “heartbeat” condition in Aqara Home. That gap is exactly why your grey “status unknown” indicator is smart. In Home Assistant, you’d typically supplement the binary sensor with something like:
- The entity’s
unavailable state (if your integration supports it)
- A separate
last_updated or last_changed attribute with a reasonable timeout threshold
- For Zigbee2MQTT or ZHA, the
linkquality or battery entities as secondary health checks
Practical approaches that tend to work
Users often combine:
- Short-term: A ~2-4 hour “stale data” threshold for any state change (since even a closed door should report occasional link check-ins)
- Long-term: Explicit
unavailable detection, plus low-battery warnings before total failure
The P2 (Matter over Thread) behaves differently—it routes through a border router and may expose different availability semantics in HA’s Matter integration.
What integration path are you leaning toward—ZHA, Zigbee2MQTT, Aqara’s own cloud bridge, or something else? That’ll determine exactly which attributes you can reliably surface for your grey state.