logo elektroda
logo elektroda
X
logo elektroda

How to create an IF condition in Node-RED for MQTT: test/variable1, 2, 3

marcin_555 1539 0
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17463372
    marcin_555
    Level 9  
    Hello

    I have a local MQTT mosquitto broker and a Node-RED server.
    Simplified diagram below:

    topics:
    test/variable1
    test/variable2
    test/variable3

    payloads:
    1 or 0

    I would like to achieve the following effect in Node-RED:

    IF payload for test/variable1 = 1
    THEN
    set the payload for test/variable2 with the read value of payload test/variable3
    .

    How to create an IF condition in Node-RED for MQTT: test/variable1, 2, 3
    .

    My guess is to use a function and as INPUT to use 2 MQTT IN components - one for each topic.
    Please help me with the construction of the IF conditional statement inside the function for the above example.

    Greetings,
    Marcin
  • ADVERTISEMENT
ADVERTISEMENT