Throttle reset or alternative way of limiting to first message

Hi All,

I am looking to setup a flow as follows.
Every minute, get two values from a database, if value target is lower then last_reading, then turn on the hot water,
When it gets to a preset value (60 in my case) then turn off.
send a telegraph message when changing states from off to on, and on to off.

That process works, but I then get lots of duplicate notifications via telegraph.

I've tried to setup throttle, but am having problems with setting up msg.reset for the throttle, and not carrying out onward processing.

flow for ref is attached:

[{"id":"16b40f2c9d6a8226","type":"function","z":"b32e0571792d7b62","name":"","func":"var sensor = '28-7ee0c31d64ff';\nvar temprature= msg.payload;\n\nmsg.topic = \"select last_reading,target from current where sensor = '\"+sensor+\"';\"\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":300,"wires":[["0884cea35ae60ff2"]]},{"id":"1e16d02a449bfe1b","type":"inject","z":"b32e0571792d7b62","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"","payloadType":"date","x":130,"y":300,"wires":[["16b40f2c9d6a8226"]]},{"id":"0884cea35ae60ff2","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":420,"y":300,"wires":[["66b648ca6ff8741e"]]},{"id":"b4782609be35343f","type":"throttle","z":"b32e0571792d7b62","name":"","throttleType":"block","timeLimit":"5","timeLimitType":"seconds","countLimit":"1","blockSize":"1","locked":false,"x":810,"y":400,"wires":[["035c7d8be5655196","138220852667d178"]]},{"id":"66b648ca6ff8741e","type":"change","z":"b32e0571792d7b62","name":"","rules":[{"t":"set","p":"hot_water_temp","pt":"msg","to":"msg.payload[0].last_reading","tot":"msg"},{"t":"set","p":"hot_water_target","pt":"msg","to":"msg.payload[0].target","tot":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":300,"wires":[["f3aa1a630417f661","4570f679ad3737c2"]]},{"id":"f3aa1a630417f661","type":"switch","z":"b32e0571792d7b62","name":"","property":"hot_water_temp","propertyType":"msg","rules":[{"t":"gte","v":"60","vt":"num"},{"t":"lt","v":"hot_water_target","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":300,"wires":[["56fe8de4ca0accc2","f2ecdcadaf2dc5f9"],["b4782609be35343f","1767d305b38e1869"]]},{"id":"035c7d8be5655196","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is Low.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":300,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"55a8f641702a115f","type":"telegram sender","z":"b32e0571792d7b62","name":"Send (HotWater)","bot":"f9ed343b.599e58","haserroroutput":false,"outputs":1,"x":1410,"y":300,"wires":[[]]},{"id":"138220852667d178","type":"function","z":"b32e0571792d7b62","name":"","func":"var sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 21;\nvar target_max = 21.5;\nvar target_min = 20.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":460,"wires":[["1dca25dfb1522534"]]},{"id":"1dca25dfb1522534","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":1020,"y":380,"wires":[["ee0e78a9fd186260"]]},{"id":"ee0e78a9fd186260","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water target changed.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":380,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"56fe8de4ca0accc2","type":"throttle","z":"b32e0571792d7b62","name":"","throttleType":"block","timeLimit":"5","timeLimitType":"seconds","countLimit":"1","blockSize":"1","locked":false,"x":810,"y":240,"wires":[["236f372b74a37ee7"]]},{"id":"236f372b74a37ee7","type":"function","z":"b32e0571792d7b62","name":"","func":"var sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 18;\nvar target_max = 18.5;\nvar target_min = 17.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":200,"wires":[["963c579f1f2147cf"]]},{"id":"f6b9e1edd0f3c7ff","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is Hot.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":200,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"963c579f1f2147cf","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":1020,"y":200,"wires":[["f6b9e1edd0f3c7ff"]]},{"id":"f2ecdcadaf2dc5f9","type":"debug","z":"b32e0571792d7b62","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":260,"wires":[]},{"id":"1767d305b38e1869","type":"debug","z":"b32e0571792d7b62","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":300,"wires":[]},{"id":"4570f679ad3737c2","type":"debug","z":"b32e0571792d7b62","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":420,"wires":[]},{"id":"81dd10f6410922fe","type":"MySQLdatabase","name":"","host":"192.168.1.1","port":"3306","test":"test","tz":"","charset":"UTF8"},{"id":"f9ed343b.599e58","type":"telegram bot","botname":"TestBot","usernames":"xxxx","chatids":"-xxxx","baseapiurl":"","updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true}]

I have tried using the output of throttle from the top to reset throttle at the bottom, but the messages then flow for at least one occurrence on both, causing issues. So how can I issue a reset, but stop onward processing of that message from throttle?

I use this node to only send a message when there is a status change.

filter
Report by Exception (RBE) node - only passes on data if the payload has changed. It can also block unless, or ignore if the value changes by a specified amount (Dead- and Narrowband mode).

So in my case, the values within the payload will change (the last temp reading) as it would be going up if the boiler is on, or down if hot water is being used?

That said, I think i've cracked it -

on the reset msg functions i tested if the incoming message was to reset, if it was, then return null. If not then reset the throttle.

On the function which updates the database and turns on the heating, i did the same - first was to check if the incoming message was a reset == true. If it was then bin the message, if not then carry on.
Its messy, but seems to work for now...

[{"id":"16b40f2c9d6a8226","type":"function","z":"b32e0571792d7b62","name":"","func":"var sensor = '28-7ee0c31d64ff';\nvar temprature= msg.payload;\n\nmsg.topic = \"select last_reading,target from current where sensor = '\"+sensor+\"';\"\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":300,"wires":[["0884cea35ae60ff2"]]},{"id":"1e16d02a449bfe1b","type":"inject","z":"b32e0571792d7b62","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"","payloadType":"date","x":130,"y":300,"wires":[["16b40f2c9d6a8226"]]},{"id":"0884cea35ae60ff2","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":420,"y":300,"wires":[["66b648ca6ff8741e"]]},{"id":"b4782609be35343f","type":"throttle","z":"b32e0571792d7b62","name":"","throttleType":"reset","timeLimit":"5","timeLimitType":"seconds","countLimit":"1","blockSize":"1","locked":false,"x":810,"y":400,"wires":[["035c7d8be5655196","138220852667d178"]]},{"id":"66b648ca6ff8741e","type":"change","z":"b32e0571792d7b62","name":"","rules":[{"t":"set","p":"hot_water_temp","pt":"msg","to":"msg.payload[0].last_reading","tot":"msg"},{"t":"set","p":"hot_water_target","pt":"msg","to":"msg.payload[0].target","tot":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":300,"wires":[["f3aa1a630417f661"]]},{"id":"f3aa1a630417f661","type":"switch","z":"b32e0571792d7b62","name":"","property":"hot_water_temp","propertyType":"msg","rules":[{"t":"gte","v":"60","vt":"num"},{"t":"lt","v":"hot_water_target","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":300,"wires":[["56fe8de4ca0accc2","f2ecdcadaf2dc5f9","3f54b9e6508e4adc"],["b4782609be35343f","1767d305b38e1869","4c65f807505e06d0"]]},{"id":"035c7d8be5655196","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is Low.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":300,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"55a8f641702a115f","type":"telegram sender","z":"b32e0571792d7b62","name":"Send (HotWater)","bot":"f9ed343b.599e58","haserroroutput":false,"outputs":1,"x":1410,"y":300,"wires":[[]]},{"id":"138220852667d178","type":"function","z":"b32e0571792d7b62","name":"","func":"if (msg.reset == true)\n{return null;}\nelse{\nvar sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 21;\nvar target_max = 21.5;\nvar target_min = 20.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\n\n\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":460,"wires":[["1dca25dfb1522534","1767d305b38e1869"]]},{"id":"1dca25dfb1522534","type":"mysql","z":"b32e0571792d7b62","d":true,"mydb":"81dd10f6410922fe","name":"","x":1020,"y":380,"wires":[["ee0e78a9fd186260"]]},{"id":"ee0e78a9fd186260","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water target changed.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":380,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"56fe8de4ca0accc2","type":"throttle","z":"b32e0571792d7b62","name":"","throttleType":"reset","timeLimit":"5","timeLimitType":"seconds","countLimit":"1","blockSize":"1","locked":false,"x":810,"y":240,"wires":[["8bbb0c1978bb977e"]]},{"id":"f6b9e1edd0f3c7ff","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\n\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is Hot.\"};\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1190,"y":200,"wires":[["55a8f641702a115f"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"963c579f1f2147cf","type":"mysql","z":"b32e0571792d7b62","d":true,"mydb":"81dd10f6410922fe","name":"","x":1020,"y":200,"wires":[["f6b9e1edd0f3c7ff"]]},{"id":"8bbb0c1978bb977e","type":"function","z":"b32e0571792d7b62","name":"","func":"if (msg.reset == true)\n{return null;}\nelse{\nvar sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 18;\nvar target_max = 18.5;\nvar target_min = 17.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\n\n\nreturn msg;\n\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":180,"wires":[["963c579f1f2147cf","f2ecdcadaf2dc5f9"]]},{"id":"4c65f807505e06d0","type":"function","z":"b32e0571792d7b62","name":"reset msg","func":"if (msg.reset == true)\n{return null;}\nelse{\nmsg.reset = true;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":160,"wires":[["669a1eb2f9aa0350","56fe8de4ca0accc2"]]},{"id":"3f54b9e6508e4adc","type":"function","z":"b32e0571792d7b62","name":"reset msg","func":"if (msg.reset == true)\n{return null;}\nelse{\nmsg.reset = true;\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":480,"wires":[["0d390336a83d7d39","b4782609be35343f"]]},{"id":"4f771eb07f9c95a1","type":"inject","z":"b32e0571792d7b62","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payloadType":"date","x":300,"y":160,"wires":[["4c65f807505e06d0","3f54b9e6508e4adc"]]},{"id":"81dd10f6410922fe","type":"MySQLdatabase","name":"","host":"192.168.x.x","port":"3306","test":"test","tz":"","charset":"UTF8"},{"id":"f9ed343b.599e58","type":"telegram bot","botname":"TestBot","usernames":"user","chatids":"-xxxx","baseapiurl":"","updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true}]

1 Like

Glad you have a solution.

Thanks

I'll defo have a look at the filter option for RBE - maybe a better way to do this, too many moving parts in it for my liking.

Any if anyone knows outside of what i have done on how to send a reset to the throttle without forwarding the message to the next node that would also still be appreciated!

Just to follow up on this for anyone else, I could not get throttle and reset to work reliably - somewhere it would get stuck or need to have double messages sent with and without reset etc, so I have redone the flow based on filter (RBE). If the temprature is above 60, a variable isHot is set to 1, if below the target it is set to 0. Based on the value changing from 1 to 0 or 0 to 1, the RBE will allow the flow to continue, and the further flows down the line will check for the isHot to be 1 or 0 to send the correct onward messages.

[{"id":"b32e0571792d7b62","type":"tab","label":"Check Hot Water","disabled":false,"info":""},{"id":"16b40f2c9d6a8226","type":"function","z":"b32e0571792d7b62","name":"","func":"var sensor = '28-7ee0c31d64ff';\nvar temprature= msg.payload;\n\nmsg.topic = \"select last_reading,target from current where sensor = '\"+sensor+\"';\"\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":180,"wires":[["0884cea35ae60ff2"]]},{"id":"1e16d02a449bfe1b","type":"inject","z":"b32e0571792d7b62","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"","payloadType":"date","x":110,"y":100,"wires":[["16b40f2c9d6a8226"]]},{"id":"0884cea35ae60ff2","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":220,"y":260,"wires":[["66b648ca6ff8741e"]]},{"id":"66b648ca6ff8741e","type":"change","z":"b32e0571792d7b62","name":"","rules":[{"t":"set","p":"hot_water_temp","pt":"msg","to":"msg.payload[0].last_reading","tot":"msg"},{"t":"set","p":"hot_water_target","pt":"msg","to":"msg.payload[0].target","tot":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":180,"wires":[["f3aa1a630417f661"]]},{"id":"f3aa1a630417f661","type":"switch","z":"b32e0571792d7b62","name":"","property":"hot_water_temp","propertyType":"msg","rules":[{"t":"gte","v":"60","vt":"num"},{"t":"btwn","v":"59","vt":"num","v2":"hot_water_target","v2t":"msg"},{"t":"lt","v":"hot_water_target","vt":"msg"}],"checkall":"false","repair":false,"outputs":3,"x":510,"y":180,"wires":[["18082308287a9e61"],[],["fa0a4bc1852f03ac"]]},{"id":"fa0a4bc1852f03ac","type":"change","z":"b32e0571792d7b62","name":"cooled down","rules":[{"t":"set","p":"isHot","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":240,"wires":[["fe135a58f52925e9","eb3de20618961011"]]},{"id":"fe135a58f52925e9","type":"rbe","z":"b32e0571792d7b62","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"isHot","x":830,"y":180,"wires":[["9c6f203da787ba82"]]},{"id":"18082308287a9e61","type":"change","z":"b32e0571792d7b62","name":"got hot","rules":[{"t":"set","p":"isHot","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":120,"wires":[["fe135a58f52925e9","bd3b8d344b7b1d63"]]},{"id":"9c6f203da787ba82","type":"function","z":"b32e0571792d7b62","name":"prep sql","func":"if (msg.reset == true)\n{return null;} \n\nif (msg.isHot == 0) {\nvar sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 21;\nvar target_max = 21.5;\nvar target_min = 20.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\nreturn msg;\n    \n} else {\nvar sensor = '28-021nosensor6';\n//var sensor = '28-7ee0c31d64ff';\nvar target_temp = 18;\nvar target_max = 18.5;\nvar target_min = 17.5;\n\nmsg.topic = \"update current set target=\"+target_temp+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set max_target=\"+target_max+\" where sensor = \"+\"'\"+sensor+\"';\\\n   update current set min_target=\"+target_min+\" where sensor = \"+\"'\"+sensor+\"';\\\n   commit;\"\n\n\nreturn msg;\n\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":180,"wires":[["1109bd0185f33ce2","595441c9bb3f3cd3"]]},{"id":"93e62ea51027d1ba","type":"function","z":"b32e0571792d7b62","name":"Prepare Telegram","func":"var tel_chat_id = global.get('Telegram_chat');\n\nvar chatIds = [];\nchatIds.push(-tel_chat_id);\n//chatIds.push(-nnnnnnnnnnnnnn);\nif (msg.isHot == 0) {\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is cold turning on Hot water.\"};\n}\nelse {\nmsg.payload = {chatId: chatIds, type : 'message', content : \"Hot Water is hot turning off Hot water.\"};    \n}\n\n// activate markdown\nmsg.payload.options = {disable_web_page_preview : true, parse_mode : \"Markdown\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1250,"y":280,"wires":[["2f06f6ca389fe2a1"]],"icon":"font-awesome/fa-pencil-square-o"},{"id":"2f06f6ca389fe2a1","type":"telegram sender","z":"b32e0571792d7b62","name":"Send (HotWater)","bot":"f9ed343b.599e58","haserroroutput":false,"outputs":1,"x":1370,"y":180,"wires":[[]]},{"id":"bd3b8d344b7b1d63","type":"debug","z":"b32e0571792d7b62","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":40,"wires":[]},{"id":"eb3de20618961011","type":"debug","z":"b32e0571792d7b62","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":340,"wires":[]},{"id":"1109bd0185f33ce2","type":"debug","z":"b32e0571792d7b62","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":320,"wires":[]},{"id":"595441c9bb3f3cd3","type":"mysql","z":"b32e0571792d7b62","mydb":"81dd10f6410922fe","name":"","x":1140,"y":180,"wires":[["93e62ea51027d1ba"]]},{"id":"81dd10f6410922fe","type":"MySQLdatabase","name":"","host":"192.168.1.1","port":"3306","test":"test","tz":"","charset":"UTF8"},{"id":"f9ed343b.599e58","type":"telegram bot","botname":"TestBot","usernames":"user","chatids":"chatid","baseapiurl":"","updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true}]

I would have suggested two different approaches that avoid the use of throttles or RBE.

  1. You setup a function node with context that stores the current value before sending the message on. When a new message comes in, gets the new value, compares to the old one, something like:
msg.payload.send_update = false;

if ((new_value < old_value) && (new_value < preset_value)) {
    msg.payload.heater_on = true;
	msg.payload.send_update = true;
} else if (new_value < preset_value) {
	msg.payload.heater_on = true;
} else {
	msg.payload.heater_on = false;
	msg.payload.send_update = true;
}

return msg;

With the two flags and just a pair of switch nodes, you can easily trigger the alerts or not. Of course, you need to handle the context.

  1. If you don't like using context, what you can do is, after processing the message in the function node, save the older value outside the payload (for instance, in msg.old_value), clear the payload, then add information for a join node (msg.parts.index = 2 and msg.parts.count = 2). Loop the flow back and into a join node. The regular input goes through a change node that adds the info for the join node ((msg.parts.index = 1 and msg.parts.count = 2). This will require that you inject a dummy 1st message in the join node so it can join with the first reading, you can select a dummy old value that won't trigger the heater (100 degrees, for instance), and it will work on its own from there.

Doing it in example 1 is prob the better way for me - tbh looking at the code I have and what you have given as an example, I'm just putting the change/switch and filter into the function if I understand correctly, and adding a flow variable to store the last value.

I guessed you would have a similar code, in cases like this, storing the old value and switching some flags in a function node, then diverting messages according to the flags with switch nodes is probably the most straightforward way.