Fast door sensor or how to speed up automation when door is opened

Hi
I have Sonoff’s SNZB-04 sensor (eWeLink DS01). It’s set on main door so I could turn on lights in the hall when door is opened. But there’s a delay between opening the door and switching the light and I wonder how could I speed up this process (it takes a little bit over 1s to switch lights on). I’m guessing main culprit here is the door sensor that acts a little bit to slow (my guess comes from the fact I’m using this sensor also in different place, with different setup and the delay is very similar). But I’m not sure about it. Maybe it’s simply because of how Zigbee network works where each device adds it’s own delay and that makes for this 1s? The automation itself consists of Sonoff SNZB-04, Sonoff SNZB-03 and Zigbee Tuya mini switch module (something like this but with N).

So the main question here is: If there’s a reason to change the door sensor to some different one? And if yes, which one will be noticeably faster? Or maybe I should look at something else in this equation? Or maybe I should simply learn to live with that? :wink:

alias: Przedpokoj Light Top On
id: b3326622-6d4c-430f-b113-472e25a647c9
mode: restart
trigger:
  - platform: state
    entity_id: binary_sensor.windoorsensor_ias_zone
    to: 'on'
condition:
  condition: and
  conditions:
    - condition: state
      entity_id: light.sw02_on_off
      state: 'off'
    - condition: state
      entity_id: binary_sensor.motionsensor02_ias_zone
      state: 'on'
action:
  - service: light.turn_on
    target:
      entity_id: light.sw02_on_off
  - delay: 420
  - condition: state
    entity_id: light.sw02_on_off
    state: 'on'
  - service: light.turn_off
    target:
      entity_id: light.sw02_on_off
1 Like

I would look at the automations debug and trace where the delay is before making an decisions!

Hm…If the issue lays in sensor then it won’t be visible in any log because the state would delay the process. Anyway random execution was at 2022-07-30T11:17:00.866185+00:00 and the light was turned on at 2022-07-30T11:17:00.875417+00:00, which gives as .9232 ms that was needed for light to turn on after the trigger happened. Can I check anything else regarding that? I mean, I can’t check when the door was open at this level of accuracy :wink:

Rather than guess, I recommended that looking at the debug may give you some answers before deciding on what the best course of action would be.

That’s correct but if there was almost no delay in the rest of the debug trace, you could correctly assume based on the data that its the actual sensor reporting that has the delay and not for example the turning on of the lights.

No point in changing the sensor without confirming that’s the issue :wink:

The difference between trigger and commant to switch teh light on is 9.232ms. This is way too short to be noticed by human. So there are 2 options; delay between physical door opening and sensor triggering action (as you suspect, sensor reaction time) or time required for light to turn on (can you check this by manual triggering the buld from physical switch?). If the former, not much you can do, beside replacing sensor with something faster. For the latter you can try with different, faster reacting bulb. Or this could be sum of both :slight_smile:
For most of my setup I use Neo CoolCam Z-Wave sensor (by Shenzhen Neo Electronics) and Ikea bulbs. Light go on almost instantly, the only visible delay is due to bulb having soft start build in, yet is ~0.5 second before it reaches full brightness. I have however one Ikea bulb that is not 1000 lumen, but 860 lumen model and its startup time is significantly longer, it might take ~1 second before it even starts to ligh up.

If the devices support it, there is a way to configure ZigBee devices to talk directly to each other, however that could have unforseen repercussions. Like you can’t ensure the light doesn’t turn on during the day and only at night. However, like as already mentioned it’s best to determine exactly where the delay is being caused so that you can determine which part of the setup really needs to be fixed.

Can’t hurt to try. Even if it doesn’t help, chances are you will find use for another sensor.

My guess is you know instinctually by what you’ve already noticed in the UI.

Do you see the same delay when montoring sensor status in the UI? If so, then you have your answer.

Same goes for the other end of the automation, is there a delay when turning the light on/off via the UI?

I’ve had good experience with the Aqara Door Sensors. Get the newer MCCGQ14LM model if available to you.

Here in the US, the older older MCCGQ11LM is more commonly found(Amazon).

Response of both models is the same, but the older “sticks” to whatever router it initially pairs with and generally doesn’t re-route. Make sure you pair via a device that is always available and makes geographic sense.

Ok, thanks all of you for your help and suggestions. I did additional tests, based on your recommendations, that consisted of checking how much time is needed from opening the door to HA UI showing that and how much switch needs to turn on the light. These gave me enough insight to try another door sensor (probably the one suggested by jerrm, unless someone shows me a better one ;)) because I found that, even though both sensor and switch added to the overall delay, the sensor was much slower in its domain then switch. The values, measured by my eye and sense of passing time ;), were about 0.1-0.2s for the switch and about 1s for sensor.

Anything approaching 1s would be bad even for a cloud service.

Just to confirm, the zigbee is all local via ZHA or Z2M?

Local zigbee UI response delay be almost imperceptible.

How many devices on your zigbee network?
How was the network set up? All at once or a device added every once in a while?
I was having similar delays and I wound up rebuilding my network pairing routers first then end point devices.
Even though zigbee is supposed to find the best path, I think since I built the network over time it just didnt function at its best. Rebuilding it did the trick.

It’s local through ZHA. But when you’ve mentioned it, I think when I first bought the first door sensor, it could work faster. That was long time ago and on different stick (some cheap one). Now it’s on zzh! with the latest firmware. But if it’s a sensor issue (it is the cheapest one on the market after all) then getting a new and different one should solve it.

Currently I have 15 devices hooked up on ZHA, with two of them being routers. I did rebuild network quite recently after screwing firmware update a little bit - I had to add again all the devices…except for one - I forgot about it. But it shouldn’t affect the network anyway because it’s on the other side from the door sensor. Anyway, I can’t say for sure I did like you did, which is introducing routers first. Looking at network visualization though, it looks like it manages to take routers into account, so not everything is connected directly to the coordinator.

What coordinator do you have?

zzh! (CC2652R) - it has more than enough power :wink:

Just for the record: I bought two Aqara MCCGQ14LM sensors (it was hard to get those, found finally some relatively cheap on Aliexpress), like everyone suggested and can confirm that they are fast. After replacing Sonoff, the light goes almost instantly after trigger happens.

1 Like