Hello, i was not able to define my problem to google, so I am asking here.
I have a sensor which is sending values continuosly (2-5 values every second). Lets say its a temperature sensor and the temperature in the room is still raising.
I need to take only the value of the temperature which is stable, so lets say, the temperature sensor will be sending the same value of temperature for 5 seconds. Then, if the value will be still the same, I need to pass it to another node.
How to achieve it? What node to use? Thanks.
A filter and trigger should get you close.
[{"id":"30ac4c0932da1033","type":"trigger","z":"1b95bb0cab495f48","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":400,"y":1520,"wires":[["e5a59d80a3e15006"]]},{"id":"2d73dccd61bda825","type":"inject","z":"1b95bb0cab495f48","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":210,"y":1440,"wires":[["937a421de26ae88e"]]},{"id":"d2f2a5c65951648f","type":"inject","z":"1b95bb0cab495f48","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"17","payloadType":"num","x":210,"y":1480,"wires":[["937a421de26ae88e"]]},{"id":"7d3d382a225a03f7","type":"inject","z":"1b95bb0cab495f48","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21","payloadType":"num","x":210,"y":1520,"wires":[["937a421de26ae88e"]]},{"id":"937a421de26ae88e","type":"rbe","z":"1b95bb0cab495f48","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":370,"y":1460,"wires":[["30ac4c0932da1033"]]},{"id":"e5a59d80a3e15006","type":"debug","z":"1b95bb0cab495f48","name":"stable","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":530,"y":1520,"wires":[]}]
Yes, it really works! I think, if i set the trigger to bigger value, like 30 seconds, it should do the job i wanted to make.
I wanted to write code in function node first, to accomplish this task, but this seems to me much easier.
Thanks for help @Steve-Mcl !
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.