Hello, I am needing to display the difference between two number of sensors. The two sensors are coming in on different topics but share the same payload. Lets say if I wanted to have a sensor outside and one inside, I want to have a function that would take the topic.outside and - from topic.inside.
I dont know I to write the function with it being two different topics. Any ideas?
[{"id":"a6318325.434c","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"77b51b25.caef14","type":"function","z":"a6318325.434c","name":"Outside Temp","func":"msg.topic=\"Outside Temp\";\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":120,"wires":[["66662f4c.5054c"]]},{"id":"a41b88eb.9ad4d8","type":"function","z":"a6318325.434c","name":"Inside Temp","func":"msg.topic=\"Inside Temp\";\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":180,"wires":[["e1d1f82f.975308"]]},{"id":"66662f4c.5054c","type":"change","z":"a6318325.434c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":540,"wires":[["55a345a4.d3fefc"]]},{"id":"e1d1f82f.975308","type":"change","z":"a6318325.434c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":600,"wires":[["55a345a4.d3fefc"]]},{"id":"55a345a4.d3fefc","type":"function","z":"a6318325.434c","name":"Subtraction","func":"msg.payload = msg.payload[\"Out\"] - msg.payload[\"In\"]\nreturn msg;\n","outputs":1,"noerr":0,"x":590,"y":560,"wires":[["71e6567.d1e71a8"]]},{"id":"71e6567.d1e71a8","type":"debug","z":"a6318325.434c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":730,"y":500,"wires":[]},{"id":"6ae66d33.3236a4","type":"inject","z":"a6318325.434c","name":"Inside Temp","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":80,"wires":[["a41b88eb.9ad4d8"]]},{"id":"1e8e8cf.4ca3373","type":"inject","z":"a6318325.434c","name":"Outside Temp","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":40,"wires":[["77b51b25.caef14"]]}]