There is a problem with the example code for RelayActuator.ino It is not checking for ACK messages. See the other example called SecureActuator.ino that does this. Without checking for ACK messages my relay gets an ON signal and turns on then immediately thereafter gets an ACK signal for V_STATUS command which is assumed in this example to be a control and the value is "0" so it turns off the relay.
Best posts made by slt1
-
RE: 💬 Relay
-
MYSController with MQTT Gateway (via Node Red)
It appears this project is not really active anymore, but if anyone is interested here is a node red flow you can use to allow MYSController to use MQTT - with OTA updates (MYSBootloader)
In MYSController setup to use TCP on port 8164 (or choose another in Node red).
Then click "Discover" and everything should then start streaming in.
[{"id":"05daaa30f133dea6","type":"tab","label":"MYSController Bridge","disabled":false,"info":"","env":[]},{"id":"0c03db96217a8d15","type":"tcp in","z":"05daaa30f133dea6","name":"","server":"server","host":"","port":"8164","datamode":"stream","datatype":"utf8","newline":"","topic":"","trim":false,"base64":false,"tls":"","x":120,"y":160,"wires":[["207a2bef4ba58466"]]},{"id":"b216b0fc146f38d6","type":"mqtt out","z":"05daaa30f133dea6","name":"To mygateway1-in","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"6da0af37c3ba3336","x":670,"y":160,"wires":[]},{"id":"207a2bef4ba58466","type":"function","z":"05daaa30f133dea6","name":"function 1","func":"flow.set("tcp_session",msg._session);\nflow.set("tcp_ip",msg._session);\nflow.set("tcp_port",msg._session);\nvar parts = msg.payload.split(";");\nmsg.topic = "mygateway1-in" + '/' + parts[0] + '/' + parts[1] + '/' + parts[2] + '/' + parts[3] + '/' + parts[4];\nmsg.payload = parts[5];\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":160,"wires":[["b216b0fc146f38d6"]]},{"id":"e97f3f15b6b5c04f","type":"mqtt in","z":"05daaa30f133dea6","name":"From myqateway1-out","topic":"mygateway1-out/#","qos":"2","datatype":"utf8","broker":"6da0af37c3ba3336","nl":false,"rap":true,"rh":0,"inputs":0,"x":160,"y":240,"wires":[["aa75b302916ca68b"]]},{"id":"7f06f63ff068402c","type":"tcp out","z":"05daaa30f133dea6","name":"","host":"","port":"8164","beserver":"reply","base64":false,"end":false,"tls":"","x":640,"y":240,"wires":[]},{"id":"aa75b302916ca68b","type":"function","z":"05daaa30f133dea6","name":"function 2","func":"msg._session = flow.get("tcp_session");\nmsg.ip = flow.get("tcp_ip");\nmsg.port = flow.get("tcp_port");\nif (msg._session == undefined)\n return null;\nvar parts = msg.topic.split("/");\nmsg.payload = parts[1] + ';' + parts[2] + ';' + parts[3] + ';' + parts[4] + ';' + parts[5] + ';' + msg.payload + "\n";\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":240,"wires":[["7f06f63ff068402c"]]},{"id":"6da0af37c3ba3336","type":"mqtt-broker","name":"OLD MYC PI","broker":"192.168.1.6","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
-
RE: 💬 Relay
For some reason I am now unable to reproduce the issue on the standard RelayActuator.ino example. It was definitely sending ACK requests when I was testing a few days ago. I have subsequently updated MySensors library and also MyController to their latest Snapshot - so perhaps the issue comes up under one of those scenarios.
The issue around this though is that the example does not report the current status of the relay in the loop. My own sketch was doing so. I guess many people take an example and modify it like I do. Therefore copying the example and adding in the code to send the current relay status periodically means the receive function will not work properly due to the Ack messages received,
I would then suggest adding a note to the receive function of the relay example sketch to say that "if your node sends messages then you need to check for Ack and discard those messages" - or something along those lines. This will help !