Sonoff Door sensor status change not received

Hello all,

I really hope someone can help me with this. The thing is this. I have a sceptic tank in the garden, and want to monitor when it needs emptying. I bought a simple float switch that activates when submerged and hung it inside. Outside in a plastic housing I have a modified Sonoff door sensor, with two wires soldered across the reed switch. When I test it inside the house, everything works like a charm. I connect it outside, and I see the sensor is 'present', and every so often I see the 'last activity' to be recent. So the hub 'sees' it. And it's alive. Yet when the level reaches the switch, the status does not change. I've seen this now multiple times.

My question: When a door sensor changes status, it sends only one signal, and that's it ? So when that signal does not get received, the status on the hub never changes ? Or does the hub interrogate the state of the sensors ? In which case why does my setup not work ?

I'm going crazy here. Help :slight_smile:

Thanks,

Hans

Correct. The way around this is to build a robust zigbee mesh with multiple repeaters. Doing so dramatically increases the probability that signals are received.

Ah. That explains a lot. Is there any way to interrogate a sensor like once every hour for it's state ? That would solve my problem.... It's difficult to mount repeaters in the garden so the network is iffy at best....

Most of the Zigbee battery-powered contact sensors (SONOFF included) can not be polled, because they operate in a 'deep sleep' mode to preserve the battery... These end devices wake up only when the contact changes its's state, send the event and go to sleep again. They also wake up periodically to send routing information and battery reports, but the time when the sleepy sensor will be awake for a very short period can not be predicted.

There may be Zigbee contact sensors that listen more frequently and potentially can be polled by the hub, but Sonoff and Aqara contact sensors are not in this group.

1 Like

Weird though. It does send it's battery report every couple of hours, but not it's state. It's a disgrace. I want to speak to the manager of this place :joy:

1 Like

I mean, one extra single bit, either 1 or 0, is that too much to ask ? ....

1 Like

You just gave me an idea to experiment with...
Give me some days.

(I tried the same thing with a Ring Z-Wave sensor, which apparently had the same issue. Which is why I switched to sonoff. To no avail it now seems)

I am effing around with this for a month, I can do a couple of days. :pray:

The Sonoff SNZB-04 contact sensor is one of the few problematic devices that may not report the battery status reliably .. : ( Mine stays in the drawer of shame ..

What other models/makes of contact sensors you have?

Z-Wave Ring contact sensor. A modified one and a new one in the box. The modified has the wires soldered over the reed switch.

(when it's in deep sleep it's not waking up to anything externally ?)

So you may look at the Neo Coolcam/Tuya sensors. They come with their own 6' external probe. @kkossev 's driver works well with them. They report battery well and they're reliable. You would still need some repeaters for a stronger mesh, but it's far better than the sonoff/aqara/xiomi crap..

Do they allow polling ? I want to be sure this is going to work before spending more money again...

Wait a bit, I have the time to experiment with the Sonoff sensor this weekend.

The idea is to poll the contact status (open/close) immediately after anything is received from the sensor (this means it is awake and listening), and there were more than X minutes/hours past since the last polling (this is to avoid looping).

‘Anything received’ means battery report, or “device rejoined the Zigbee network’ in the case the connection was lost because of the bad Zigbee coverage.

This is of course a workaround/patch that may be OK for your specific use case, where several hours delay of receiving the ‘Contact Closed’ event will not be a problem…..

It is better to invest in improving your Zigbee network:

  • buy the cheapest low-consumption Zigbee repeater- this is the Tuya USB repeater.
  • buy the cheapest 5 A/h battery bank brick
  • put the battery power bank and the Tuya USB Zigbee repeater in a waterproof plastic box somewhere between the SONOFF sensor and the closest mains-powered Zigbee device (or the HE hub)

If the power bank lasts several months without recharging… it will be better solution!

We think alike. I was going to see if I could make a rule that checks for any update from the sensor and then quickly do a refresh or something. To get it to talk to me. But I have little experience if there is even an event that could trigger that. Anyway I'll leave it to you for the time being, thanks a lot.
The battery bank and the repeater would be a solution, but I would feel better if I could poll something. Because if the event 'septic tank is full' is sent only once and missed, even with a solid network not impossible I think, then my next event will be evading my wife's wrath as the toilet overflows.....

Good news - the first tests are successful!

The Sonoff contact sensor is configured to report the battery status every 2 hours.
While closed, I put the contact into a kind of double Faraday cage ( a metal pot inside a metal fridge :slight_smile: ). Opened the contact at around 7 am when there was no Zigbee connection.
The contact state didn't change, as expected.
15 minutes later, I removed the sensor from the fridge. The Zigbee connection was restored at some time later, but there were no any messages sent by the device.

When the battery reporting time came at 7:17 am, the contact status was polled by the driver, and the device reported correctly that the contact was open! :+1:


Note how the battery voltage dropped rapidly after staying 15 minutes in the fridge ..

2 Likes

That looks very promising ! No idea how you do it, but it does look exactly what I need :slight_smile:

If the fridge has such a big influence on the battery, how is that going to work in winter time in my garden I wonder....

How did the contact update arrive at 7:17 before the battery message ? Or did you make it it will send that before every battery update ?

So many questions...

Looking at the debug logs, I see now that the true contact state was actually requested and received 36 minutes earlier before the periodic battery report - exactly at the time, when the sensor announced that it is rejoining the Zigbee network (it fell off the mesh when was in the fridge) :

The logs show that all happened exactly as expected, tonight I will try to publish the dev. branch version of the driver for your tests.