Well, almost good news (now I have no more hair!
)
I finally managed to get the two-way functionality working (IPX800V5 relay <=> Gladys) by using « switches » (adding the relay would be good because for me switch=switch
)
And the same on the IPX800V5 side
MQTT subscriptions on the IPX800V5 side
MQTT publications on the IPX800V5 side
The graphical flow
And the debug in order:
Relay 1 « On » from IPX800V5
Relay 1 « Off » from IPX800V5
Relay 1 « On » from Gladys
Relay 1 « Off » from Gladys
And the flow in JSON format
[{"id":"cf6dc2aae7c8ab92","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"91ee9c360eac6d43","type":"mqtt out","z":"cf6dc2aae7c8ab92","name":"IPX800_V5-1","topic":"IPX800_V5-1","qos":"1","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"291914c5c9c68f02","x":1230,"y":100,"wires":[]},{"id":"c2659b7b2ff21d6e","type":"function","z":"cf6dc2aae7c8ab92","name":"according to payload \"[IPX]Relay state x\" true/false => 0/1","func":"var msg1,msg2;\n\nswitch (msg.payload) {\n \n case \"{\\\"[IPX]Relay state 1\\\":true}\":\n msg1 = {payload:\"1\" }; \n break; \n case \"{\\\"[IPX]Relay state 1\\\":false}\":\n msg1 = {payload:\"0\" }; \n break; \n \n case \"{\\\"[IPX]Relay state 2\\\":true}\":\n msg2 = {payload:\"1\" }; \n break; \n case \"{\\\"[IPX]Relay state 2\\\":false}\":\n msg2 = {payload:\"0\" }; \n break; \n \n default:\n break;\n}\n\nreturn[msg1,msg2];\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":220,"wires":[[ "d7e02d71312aa03e" ],[ "6ea07d03df94f62e" ]]},{"id":"d9a7d3602448c88a","type":"mqtt in","z":"cf6dc2aae7c8ab92","name":"IPX800_V5-1","topic":"IPX800_V5-1","qos":"1","datatype":"auto","broker":"291914c5c9c68f02","nl":false,"rap":true,"rh":0,"inputs":0,"x":150,"y":220,"wires":[[ "c2659b7b2ff21d6e" ]]},{"id":"d7e02d71312aa03e","type":"mqtt out","z":"cf6dc2aae7c8ab92","name":"gladys/master/device/mqtt:IPX800_5-1_Relais1/feature/mqtt:IPX800_5-1_Relais1/state","topic":"gladys/master/device/mqtt:IPX800_5-1_Relais1/feature/mqtt:IPX800_5-1_Relais1/state","qos":"1","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"291914c5c9c68f02","x":1000,"y":180,"wires":[]},{"id":"6ea07d03df94f62e","type":"mqtt out","z":"cf6dc2aae7c8ab92","name":"gladys/master/device/mqtt:IPX800_5-1_Relais2/feature/mqtt:IPX800_5-1_Relais2/state","topic":"gladys/master/device/mqtt:IPX800_5-1_Relais2/feature/mqtt:IPX800_5-1_Relais2/state","qos":"1","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"291914c5c9c68f02","x":1000,"y":260,"wires":[]},{"id":"4dc3520e0af08d51","type":"mqtt in","z":"cf6dc2aae7c8ab92","name":"gladys/device/mqtt:IPX800_5-1_Relais1/feature/mqtt:IPX800_5-1_Relais1/state .","topic":"gladys/device/mqtt:IPX800_5-1_Relais1/feature/mqtt:IPX800_5-1_Relais1/state","qos":"1","datatype":"auto","broker":"291914c5c9c68f02","nl":false,"rap":true,"rh":0,"inputs":0,"x":350,"y":80,"wires":[[ "1bedbf53cbd0b7c2" ]]},{"id":"e51228ced7b818c2","type":"mqtt in","z":"cf6dc2aae7c8ab92","name":"gladys/device/mqtt:IPX800_5-1_Relais2/feature/mqtt:IPX800_5-1_Relais2/state","topic":"gladys/device/mqtt:IPX800_5-1_Relais2/feature/mqtt:IPX800_5-1_Relais2/state","qos":"1","datatype":"auto","broker":"291914c5c9c68f02","nl":false,"rap":true,"rh":0,"inputs":0,"x":360,"y":140,"wires":[[ "1bedbf53cbd0b7c2" ]]},{"id":"658e6d08a9bfa70c","type":"mqtt in","z":"cf6dc2aae7c8ab92","name":"#","topic":"#","qos":"2","datatype":"auto","broker":"291914c5c9c68f02","nl":false,"rap":true,"rh":0,"inputs":0,"x":130,"y":300,"wires":[[ "0b066345aae7ddb9" ]]},{"id":"0b066345aae7ddb9","type":"debug","z":"cf6dc2aae7c8ab92","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":340,"y":300,"wires":[]},{"id":"1bedbf53cbd0b7c2","type":"function","z":"cf6dc2aae7c8ab92","name":"according to topic => [IPX]Relay cmd x: true/false","func":"var msg1,msg2;\n\nswitch (msg.topic) {\n case \"gladys/device/mqtt:IPX800_5-1_Relais1/feature/mqtt:IPX800_5-1_Relais1/state\":\n \n switch (msg.payload) {\n case \"0\":\n msg1 = {payload:\"{\\\"[IPX]Relay cmd 1\\\":false}\" }; \n break; \n case \"1\":\n msg1 = {payload:\"{\\\"[IPX]Relay cmd 1\\\":true}\" }; \n break; \n default:\n break; \n }\n break; \n \n case \"gladys/device/mqtt:IPX800_5-1_Relais2/feature/mqtt:IPX800_5-1_Relais2/state\":\n\n switch (msg.payload) {\n case \"0\":\n msg1 = {payload:\"{\\\"[IPX]Relay cmd 2\\\":false}\" }; \n break; \n case \"1\":\n msg1 = {payload:\"{\\\"[IPX]Relay cmd 2\\\":true}\" }; \n break; \n default:\n break; \n }\n break; \n \n default:\n break; \n}\n\nreturn[msg1,msg2];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":100,"wires":[[ "91ee9c360eac6d43" ]]},{"id":"291914c5c9c68f02","type":"mqtt-broker","name":"mqtt://localhost","broker":"mqtt://localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
I have latencies or even non-acknowledgment if the orders are made too quickly but if you wait, it works very well. However, from a node red in Home Assistant, so Home Assistant <=> IPX800V5 no latency!
On the other hand, from Gladys, it generates 4 messages on the debug instead of 2 when it’s from the IPX800V5.