-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
relay continuously switching when mqtt not connected #91
Comments
My guess is that when it reconnects to the MQTT broker it receives retained messages with payload 2 that somehow has not been overwritten... It would be useful to see the debug log to confirm this point (connect it to you programmer and open a terminal session at 115200 bauds). |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): I can confirm the buggy behaviour .. take a working POW - mqtt etc all good - happens to be on 1.6.7. It is configured to switch mode always off. Switch the light on - domoticz or web interface. Now change the mqtt server IP address .. in a few seconds the light switches off. Switch it on while leaving mqqt pointing to the wrong IP and it will switch off and stay off. Do the same with switch mode always on .. and you get the looping. Let me see what happens to the basic on the bench. Later Ferdie |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Nothing on the basic with the DS18b50 - but it is dev and running of USB. Lets try the dual that is on AC. Dual also does not show this behaviour so something is up with the POW's. Later Ferdie |
Will try tomorrow with the pow. It's a shame I only have one and it's on duty... |
Original comment by P.B. (Bitbucket: PieBru, GitHub: PieBru): During these tests I kept the MQTT server down.
|
Two things:
|
Original comment by P.B. (Bitbucket: PieBru, GitHub: PieBru): I use OpenHAB, so I didn't touch the DomoticZ config section. As you can observe in the json config, DomoticZ IN and OUT topics kept the default value, which is the same value of the placeholder. By emptying these two fields the on/off relay loop problem persists when the MQTT server is down, so it should be related to the MQTT connection failure, not the DomoticZ stuff. |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Hmm from observation - it is not he mqtt disconnection, but rather the failed to connect that is causing the issue. Yeah my POW is also on duty so that buggering ... ag it is only a screw .. let me get a trace quickly. |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Here you go ... You do not get the relay clicking but the blue - think it is blue - light blinking on every failed connect. To reproduce on the pow, have a working mqtt, switch relay on, change the mqtt IP address,.
Could it be the websocket broadcast ? Later Ferdie PS if you need more debugging let me know how. The POW is on the bench now ;-) Later Ferdie |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Ah wait the behaviour is clear when you plug it onto power.
Now - I would assume the same thing on AC ( no the usb is not plugged in) See https://www.youtube.com/watch?v=-gbBTl6SMXE&feature=youtu.be The behaviour on dc vs AC is different. Wonder if this is true for a basic on AC ... hmm Later Ferdie |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Both on AC I assume? |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Hmm looking at the trace of a basic with the same always on and MIA MQTT.
No websocket update on every failed connection, that said in the video you can clearly see the POW getting confused in a different way nothing to do with the timing of the websocket I would think. Later Ferdie |
The HLW8012 library uses interrupts to monitor the pulses from the chip. Interrupts and blocking connections with PubSubClient might be the cause. Finally I had no time to test this on my POW but maybe using the AsyncMQTTClient library would help. Just changing the MQTT_USE_ASYNC setting to 1 in |
Original comment by f-fish (Bitbucket: f-fish, GitHub: Unknown): Seems like you are 100% correct. On POW with AC power .. with load
1.6.7 Master via OTA Working as expected no looping issues for me on always on, MIA MQTT and reset device. Going to leave the device with AsyncMQTT see what happens. Later Ferdie |
Originally reported by: P.B. (Bitbucket: PieBru, GitHub: PieBru)
Hi, I'm using a Sonoff-POW to know when a refrigerator pump is running and, rarely, to remotely power it off.
When returning from a power shortage the relay should start ON, so the "Switch boot mode" is configured "Always on".
When the POW loses the MQTT connection, the relay continuously loops on/off until the MQTT connection is established again, but the pump doesn't like this ;)
I used Espurna 1.6.7 updated to yesterday's github repo.
Any hint or patch to solve this?
Thanks,
PB
The text was updated successfully, but these errors were encountered: