MQTT Gateway and Relay Status
xefil last edited by
Hello to all,
Following your guide I was able to setup a Controller (OpenHab), a MQTT Gateway and some nodes.
Until here all works. If I send a command from OpenHab to turn on a relay, it works.
Sometimes it happens that the relay message is lost. I'll try to gain range, but menawhie the result is that:
- OpenHab thinks the relay is on
- the remote node doesn't receive the message and leaves the relay off
How could I manage this situation to maintain OpenHab updated with the right status?
Actually I'm sending out (from the node to the GW) the relay status every 10 minutes.
Could this be enough or is there a better way to do that?
I've seen there is the ACK option, but this would only confirm that a message is sent succesfully from the node to the GW. This would not confirm that the relay is actually ON or OFF on the controller side.
I.e. if I don't receive an ACK from the GW I only be sure that the GW is not updated.
gadu last edited by
I have exactly the same question after playing around with a relay and MQTT today.
Following this thread...
Gambituk last edited by
+1 for me too, it just seems to naturally occur that this should be a feature in this workflow, i guess there could be long ways of going about this with led's and light sensors to actually check and report back the actual situation via mqtt and even a retry rule in openhab, but i would hope there would be a software only way of doing this.
gadu last edited by gadu
I'm thinking outside the box (shouldn't do that) so here goes...
This would require another type of relay with dual connections.
If you combine the doorsensor with the relay sketch the arduino if "forced" to send activity (V_TRIPPED) from the relay.
Here's a poor painted sketch...
Or something similar...
In the vera plugin it works like this:
- User clicks on GUI button on controller to turn off relay (but no status is changed right now).
- Plugin sends a message to turn off relay (with ack enabled)
- Message reaches node and relay is turned off. The library automaticially sends ack-message back to gw/controller.. Message is identical to the original message (exceptp for some bits in header).
- Vera receives message to turn off relay button.
- Button in GUI is switched off.
So if the MQTT gateway would ask for an ack from actuators and send this back to the OpenHAB MQTT subscriber something similar should be archivable.
xefil last edited by
It works to have a feedback from the sensor, but this doesn't give a status if someone acts on the relay manually.
BTW I've tested a similar approach. I send from the sensor a custom variable with the status of the relay.
This is the best approach. This could handle the status of the relay even if manual activated. The return of the signal always give us the relay position. But it needs a different dual stepper relay. I'll try this as well soon.
Thanks a lot to all!