Send message only when there is a change

Hi all,

I'm trying to send a telegram messsage only once when there is a change in the scale(peso)

This is the switch node:

I try to use a trigger node as trigger&block but only works once, I have no idea how to reset this node.

Thanks in advance

Look at the rbe (report by exception) node

I try with this node but I need to put a low limit

Use an RBE to prevent duplicates then a switch node to test the value of > low limit.


I try it, but it doesn't work

It send the same weight always, without changes

What is the data coming in?

Its a number

Sorry let me be more specific. Can you provide a series of data coming in that shows the issue you are experiencing

ok, I Take some pictures:



Two more

Are they enough?

Can you provide your flow and I’ll take a look at it

[{"id":"a84d78b5.f57b18","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"530dd4ce.68279c","type":"rpi-dht22","z":"a84d78b5.f57b18","name":"T&H","topic":"DHT11","dht":"11","pintype":"0","pin":"22","x":450,"y":400,"wires":[["76e753c3.f98f8c","23c8dd5b.654292","cf8f3835.8c0f28","de7a0048.8957"]]},{"id":"b02d7ad7.4ab8c8","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"date"}],"repeat":"60","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":400,"wires":[["530dd4ce.68279c"]]},{"id":"76e753c3.f98f8c","type":"ui_gauge","z":"a84d78b5.f57b18","name":"Humedad","group":"26b4d45a.11263c","order":1,"width":0,"height":0,"gtype":"gage","title":"Humedad","label":"%","format":"{{humidity}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1040,"y":480,"wires":[]},{"id":"23c8dd5b.654292","type":"ui_chart","z":"a84d78b5.f57b18","name":"T-Chart","group":"93dbf1b4.cb687","order":2,"width":0,"height":0,"label":"Temperatura","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"50","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":1040,"y":320,"wires":[[]]},{"id":"cf8f3835.8c0f28","type":"ui_text","z":"a84d78b5.f57b18","group":"26b4d45a.11263c","order":3,"width":0,"height":0,"name":"","label":"Temperatura","format":"{{payload}}","layout":"col-center","x":1050,"y":400,"wires":[]},{"id":"c3c0fd5e.2d86a","type":"debug","z":"a84d78b5.f57b18","name":"Función","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":760,"y":700,"wires":[]},{"id":"9817bba9.429f98","type":"hx711","z":"a84d78b5.f57b18","name":"Peso","hx_data":"21","hx_sck":"16","hx_scale":"-322.113","hx_offset":"-452.80","hx_avrg":"5","x":310,"y":640,"wires":[["cafbe597.acf538"]],"info":"tare = -322.113"},{"id":"89fa0dd4.00e5c","type":"ui_gauge","z":"a84d78b5.f57b18","name":"Silo","group":"194e5962.c20f47","order":4,"width":0,"height":0,"gtype":"wave","title":"Silo","label":"Kg","format":"{{value}}","min":0,"max":"2000","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1030,"y":640,"wires":[]},{"id":"f6f93e7f.b19d2","type":"ui_chart","z":"a84d78b5.f57b18","name":"Silo","group":"93dbf1b4.cb687","order":1,"width":0,"height":0,"label":"Peso","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":true,"ymin":"0","ymax":"2000","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#207bbc","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":1030,"y":560,"wires":[[]]},{"id":"b06b1d79.c93e9","type":"switch","z":"a84d78b5.f57b18","name":"Aviso","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"300","vt":"num"},{"t":"gte","v":"300","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":250,"y":920,"wires":[["439f8aa5.ac73e4","1f5c2be.13129d4"],["e1ba5f86.92a3e"]]},{"id":"e09263.0f5beda","type":"ui_toast","z":"a84d78b5.f57b18","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"Falata pienso","name":"Falta pienso","x":1050,"y":800,"wires":[]},{"id":"c984b92.a1f2548","type":"telegrambot-notify","z":"a84d78b5.f57b18","name":"Falta pienso","bot":"1ab5d7f7.18ae78","chatId":"-596988045","message":"","parseMode":"","x":1050,"y":880,"wires":[]},{"id":"9fad2e2f.07009","type":"telegrambot-notify","z":"a84d78b5.f57b18","name":"Hay pienso","bot":"1ab5d7f7.18ae78","chatId":"-596988045","message":"","parseMode":"","x":1050,"y":1020,"wires":[]},{"id":"adc13126.43e31","type":"trigger","z":"a84d78b5.f57b18","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":560,"y":760,"wires":[[]]},{"id":"6e91362e.765e58","type":"trigger","z":"a84d78b5.f57b18","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"-5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":550,"y":1080,"wires":[[]]},{"id":"6c724b40.1c7e64","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"date"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":640,"wires":[["9817bba9.429f98"]]},{"id":"797c64a5.51921c","type":"rpi-gpio out","z":"a84d78b5.f57b18","name":"Servo","pin":"22","set":"","level":"0","freq":"50","out":"pwm","x":1030,"y":1400,"wires":[]},{"id":"3ba7ce96.d7e122","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"3","payloadType":"num","x":370,"y":1260,"wires":[["f5c1c3ee.84428"]]},{"id":"d661ed4.7bc1c1","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":370,"y":1340,"wires":[["f5c1c3ee.84428"]]},{"id":"2a3ab225.437f7e","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":370,"y":1420,"wires":[["f5c1c3ee.84428"]]},{"id":"2dcabe23.eace52","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":370,"y":1540,"wires":[["f5c1c3ee.84428"]]},{"id":"7b0f6935.512468","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":370,"y":1220,"wires":[["f5c1c3ee.84428"]]},{"id":"e32267f3.26d278","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":370,"y":1300,"wires":[["f5c1c3ee.84428"]]},{"id":"4323bb5c.136004","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":370,"y":1380,"wires":[["f5c1c3ee.84428"]]},{"id":"c599b8d1.516b98","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":370,"y":1460,"wires":[["f5c1c3ee.84428"]]},{"id":"603c1cd7.57f084","type":"inject","z":"a84d78b5.f57b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"9","payloadType":"num","x":370,"y":1500,"wires":[["f5c1c3ee.84428"]]},{"id":"15836723.2fef49","type":"ui_button","z":"a84d78b5.f57b18","name":"","group":"239ec0db.fb1e","order":2,"width":0,"height":0,"passthru":false,"label":"Min 0%","tooltip":"","color":"White","bgcolor":"Black","icon":"","payload":"2","payloadType":"str","topic":"topic","topicType":"msg","x":360,"y":1600,"wires":[["f5c1c3ee.84428"]]},{"id":"8d15d60f.a07508","type":"ui_button","z":"a84d78b5.f57b18","name":"","group":"239ec0db.fb1e","order":3,"width":0,"height":0,"passthru":false,"label":"Med 50%","tooltip":"","color":"White","bgcolor":"Black","icon":"","payload":"5","payloadType":"str","topic":"topic","topicType":"msg","x":360,"y":1660,"wires":[["f5c1c3ee.84428"]]},{"id":"9234f300.b0054","type":"ui_button","z":"a84d78b5.f57b18","name":"","group":"239ec0db.fb1e","order":4,"width":0,"height":0,"passthru":false,"label":"Max 100%","tooltip":"","color":"White","bgcolor":"Black","icon":"","payload":"10","payloadType":"str","topic":"topic","topicType":"msg","x":350,"y":1720,"wires":[["f5c1c3ee.84428"]]},{"id":"f5c1c3ee.84428","type":"function","z":"a84d78b5.f57b18","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":1400,"wires":[["797c64a5.51921c","f4ac87d.d536778","df46e851.25b958"]]},{"id":"df46e851.25b958","type":"ui_gauge","z":"a84d78b5.f57b18","name":"","group":"239ec0db.fb1e","order":0,"width":0,"height":0,"gtype":"donut","title":"Posicion","label":"Grados","format":"{{value}}","min":"2","max":"10","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1040,"y":1320,"wires":[]},{"id":"f07610bf.e1006","type":"ui_slider","z":"a84d78b5.f57b18","name":"","label":"Servo","tooltip":"","group":"239ec0db.fb1e","order":5,"width":0,"height":0,"passthru":true,"outs":"all","topic":"topic","topicType":"msg","min":"2","max":10,"step":1,"x":370,"y":1780,"wires":[["f5c1c3ee.84428"]]},{"id":"9501b5a3.543728","type":"link in","z":"a84d78b5.f57b18","name":"","links":["f4ac87d.d536778"],"x":255,"y":1780,"wires":[["f07610bf.e1006"]]},{"id":"f4ac87d.d536778","type":"link out","z":"a84d78b5.f57b18","name":"","links":["9501b5a3.543728"],"x":995,"y":1480,"wires":[]},{"id":"cafbe597.acf538","type":"function","z":"a84d78b5.f57b18","name":"","func":"msg.payload = Math.round(Number(msg.payload))\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":640,"wires":[["f6f93e7f.b19d2","89fa0dd4.00e5c","8afd4674.ba82c8","c3c0fd5e.2d86a"]]},{"id":"3d2267cb.a86b98","type":"telegrambot-notify","z":"a84d78b5.f57b18","name":"","bot":"1ab5d7f7.18ae78","chatId":"-596988045","message":"","parseMode":"","x":1060,"y":180,"wires":[]},{"id":"d0c918ed.f28f78","type":"function","z":"a84d78b5.f57b18","name":"","func":"msg.payload =  \" La temperatura es de \" + msg.payload + \" ºC\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":180,"wires":[["3d2267cb.a86b98"]]},{"id":"de7a0048.8957","type":"trigger","z":"a84d78b5.f57b18","name":"Envío Tº","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":620,"y":280,"wires":[["d0c918ed.f28f78"]]},{"id":"548de9f.b29e218","type":"function","z":"a84d78b5.f57b18","name":"","func":"msg.payload =  \" Ya se ha recargado el silo de Caude.\\nAhora hay \" + msg.payload + \" Kg\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":1020,"wires":[["9fad2e2f.07009"]]},{"id":"6ba6e21e.8a6c8c","type":"function","z":"a84d78b5.f57b18","name":"","func":"msg.payload =  \" Se requiere más pienso en Caude.\\nSolo hay: \" + msg.payload + \" Kg\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":820,"wires":[["e09263.0f5beda","c984b92.a1f2548"]]},{"id":"6559e697.9718b8","type":"ui_switch","z":"a84d78b5.f57b18","name":"","label":"Luz","tooltip":"","group":"239ec0db.fb1e","order":5,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":370,"y":1900,"wires":[["f9e687d.18b3a78"]]},{"id":"f9e687d.18b3a78","type":"rpi-gpio out","z":"a84d78b5.f57b18","name":"LED","pin":"24","set":"","level":"0","freq":"","out":"out","x":1030,"y":1900,"wires":[]},{"id":"439f8aa5.ac73e4","type":"rbe","z":"a84d78b5.f57b18","name":"","func":"deadband","gap":"90","start":"","inout":"out","septopics":true,"property":"payload","x":540,"y":820,"wires":[["6ba6e21e.8a6c8c","35c8b965.2b62a6"]]},{"id":"e1ba5f86.92a3e","type":"rbe","z":"a84d78b5.f57b18","name":"","func":"deadband","gap":"20","start":"","inout":"in","septopics":true,"property":"payload","x":540,"y":1000,"wires":[["548de9f.b29e218"]]},{"id":"8afd4674.ba82c8","type":"rbe","z":"a84d78b5.f57b18","name":"","func":"deadbandEq","gap":"10%","start":"","inout":"out","septopics":true,"property":"payload","x":270,"y":860,"wires":[["b06b1d79.c93e9","d972c483.f1ac18"]]},{"id":"d972c483.f1ac18","type":"debug","z":"a84d78b5.f57b18","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":310,"y":800,"wires":[]},{"id":"1f5c2be.13129d4","type":"debug","z":"a84d78b5.f57b18","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":940,"wires":[]},{"id":"35c8b965.2b62a6","type":"debug","z":"a84d78b5.f57b18","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":900,"wires":[]},{"id":"26b4d45a.11263c","type":"ui_group","name":"Temperatura","tab":"dcd3205.69cfee","order":1,"disp":true,"width":"6","collapse":false},{"id":"93dbf1b4.cb687","type":"ui_group","name":"Charts","tab":"dcd3205.69cfee","order":3,"disp":true,"width":"6","collapse":false},{"id":"194e5962.c20f47","type":"ui_group","name":"Silo","tab":"dcd3205.69cfee","order":2,"disp":true,"width":"6","collapse":false},{"id":"1ab5d7f7.18ae78","type":"telegrambot-config","botname":"GranjaDeCerdosIoT","usernames":"","chatIds":"","pollInterval":"300"},{"id":"239ec0db.fb1e","type":"ui_group","name":"Ventanas","tab":"dcd3205.69cfee","order":4,"disp":true,"width":"6","collapse":false},{"id":"dcd3205.69cfee","type":"ui_tab","name":"Granja Caude","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Please put a debug node on the output of the HX711 node so I can see what the data is coming in.


Or you prefer the code

So the first value that comes thru is (trimming decimals for brevity) 898.8577 and the second is 898.9508

The RBE node says "don't pass anything thru that is not greater than 10% of the last valid value. So the first value is 898.8577 and 10% of that is 89.8857.

So for a value to pass thru it has to be
greater than 898.8577 + 89.8857 = 988.7434
or less than
898.8577 - 89.8857 = 808.9726
but the value is 898.9508 so it isn't passed thru.

I don't understand you. :sleepy:

with what you have defined in the rbe node, a value would have to be greater than 998.7434 or less than 808.89726 to be passed thru the rbe node.

What is not to understand?

ah ok. But my problem its that without a change of 10% the rbe allow the data

So explain what you want to happen.