WDoorSensor
WDoorSensor copied to clipboard
No MQTT info on wakeup from deep sleep
Whenever the device wakes up from a deep sleep (by opening/closing it), it doesn't broadcast its status to the MQTT broker. Is this something that's an issue on my end? Once the device had successfully awoken from its deep sleep, all MQTT messages come through perfectly.
The reason for reporting this issue is because I need to open --> close --> open my sensors before the MQTT message is properly sent. Which can be a huge flaw in the system when using the sensor in an alarm setup. Please note that an MQTT message is already sent when the device is closed again, but as I'd want to know the open status straight away, this isn't useful at all.
Changing this https://github.com/klausahrenberg/WAdapter/blob/master/WAdapter/WNetwork.h#L698 from notify(false);
to notify(true)
seems to have resolved this issue. Maybe make this a configuration option, where you can choose to notify on startup?
I seem to have spoken too soon. It still managed to not always send the state on startup. I'm currently trying out a couple of hacky solutions. Would be great if a proper fix could be made. It seems to sometimes fail to retrieve the correct state on startup/wakeup causing it to simply not send out the state message. I am always retrieving the initial launch message. (listing the url, ip, statetopic, etc). But nothing is actually sent to the state topic itself.
Hi, I have 2 sensors in daily usage and never recognized such kind of timeout. Maybe 2 things could be the reason:
- The position of your door sensor is maybe critical (to far from Wifi-Router) and wake-up time is not enough to connect and send status info. But I think this is not really a cause
- You changed
notify(false)
tonotify(true)
at line 698. This means that the device state will be send the device state directly after mqtt connection. Normally the state will sent only after state change - after wakeup this is the cause when the device received the state from internal MCU. And I think, this is a possible cause: for any reason, the firmware don't receive the state from MCU. To check this, please specify: - Do you use the exact same model like in my description. If not, please provide more details
- After your modification, do you receive the correct state for 'open'? Or is it always the same value (false)?
- Do you receive any error and 'unknown MCU command' to the device topic? If yes, please provide
Hi, thanks for your response.
The position of your door sensor is maybe critical (to far from Wifi-Router)
Pretty sure this is not the case, I could reproduce this in my house no matter my location.
and wake-up time is not enough to connect and send status info
This could be one of the issues, although I did as much as I could do to reduce this. (I.E predefining an IP address in my router for these devices).
You changed notify(false) to notify(true) at line 698
Keep in mind I only did this after trying the initial software. With the initial software I could still reproduce this.
Do you use the exact same model like in my description
This is the device I use https://templates.blakadder.com/TYMC-1.html (The same as yours)
After your modification, do you receive the correct state for 'open'
Once the connection is achieved, I always received the correct state for open. But because it is possible for the device to turn itself off before a connection is achieved it could end up in an incorrect state. But that's pretty obvious in my opinion, as there is no more power to update to the correct state hehe.
Do you receive any error and 'unknown MCU command' to the device topic
I don't believe I ever saw this. I either received nothing, or the correct state.
Hi, please try new version 1.18. Maybe it solves your issue. However, I still can not reproduce your issue.
Hi, thanks for trying to resolve the issue. Although this version does seem more stable, it seems the issue still remains. I'm currently testing this on a device that is fresh out of the box. (Still the same model/brand).
My repro case:
- trigger the device for by moving the magnet nearby or by removing it. Either one works.
- Wait 1,5 minutes.
- Quickly remove/add the magnet. Ensure it only fires once.
- Notice no MQTT message being sent out.
- Try a couple of times, as sometimes the message does sent out.
I'm using MQTT Explorer to view any MQTT message going over my network. I would like to point out, that I'm having the same issues with the sensor when running Tasmota firmware.