Hi all,
I am publishing a JSON data from an MQTT broker which I can turn into a JavaScript Object using the JSON node, then I can find the number value in the object array using the debug node and clicking on the "copy path" button.
I need to use that number value in a switch node which will evaluate if it's less than "50" and then publish another message to another MQTT topic. How do I go about that?
My flow is like this now;
[{"id":"97527151.57977","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"c8c0178d.388638","type":"mqtt in","z":"97527151.57977","name":"","topic":"iotgateway","qos":"1","datatype":"auto","broker":"42bbbb0d.1b4ff4","nl":false,"rap":true,"rh":0,"x":220,"y":560,"wires":[["db222afc.fc86f8"]]},{"id":"bcdd863a.a8cb18","type":"mqtt out","z":"97527151.57977","name":"","topic":"iotgateway/write","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"42bbbb0d.1b4ff4","x":740,"y":320,"wires":[]},{"id":"b7ac1935.42ee18","type":"inject","z":"97527151.57977","name":"Start_Value=False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Message","payload":"[{\"id\":\"Visu+ UA Server.Visu+ SCADA.Tags.Start_Button\",\"v\":false}]","payloadType":"str","x":430,"y":320,"wires":[["bcdd863a.a8cb18"]]},{"id":"f8e957eb.eede38","type":"debug","z":"97527151.57977","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":560,"wires":[]},{"id":"db222afc.fc86f8","type":"json","z":"97527151.57977","name":"","property":"payload.values[0].v","action":"obj","pretty":false,"x":390,"y":560,"wires":[["6089bf6c.2faf1"]]},{"id":"6089bf6c.2faf1","type":"switch","z":"97527151.57977","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"50","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":560,"wires":[["f8e957eb.eede38"]]},{"id":"42bbbb0d.1b4ff4","type":"mqtt-broker","name":"","broker":"tcp://localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]