Notification of exceeding wind speed threshold - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Notification of exceeding wind speed threshold (/showthread.php?tid=4242) |
Notification of exceeding wind speed threshold - JRP - 15.09.2022 hello I need to send a notification to telegram that a certain wind speed threshold has been exceeded. To get started, create the following script as a proof of principle Code: require("user.Telegram") -- Requiere la librería de usuario The problem is that while the wind alarm signal is above the threshold, notifications are sent continuously, I only want it to be sent once and require user action to dismiss the alarm. How could I do it? Thank you RE: Notification of exceeding wind speed threshold - RomansP - 15.09.2022 Hello JRP! You can make a script for current wind speed object. You will have three objects 1.)current wind speed, 2.)wind speed threshold 3.)alarm (boolean object) Code: local wind_current = grp.getvalue('34/1/57') Every time when wind speed changes, script will check the value of wind speed, if it is above threshold value (and alarm was off) it sets alarm object value to true and sends log. Next time if alarm was on (alarm object value was true) it will not send any log (till you unset the alarm object). RE: Notification of exceeding wind speed threshold - JRP - 16.09.2022 thanks i will try it. Greetings RE: Notification of exceeding wind speed threshold - JRP - 23.09.2022 Hello The script does not work, the message to telegram says sending. The funny thing is that once the alarm has been activated and the notification is not supposed to be sent to Telegram, the log does not appear, but the notification is sent. I have put the else statement, a variable with a fixed text and a log and the first time the text is not shown in the log (notification 1), the second time the text is shown and the notification continues to be sent. Very rare indeed. Any ideas? Thank you RE: Notification of exceeding wind speed threshold - admin - 24.09.2022 Post your full script. Most likely your telegram call is outside of "if" block. RE: Notification of exceeding wind speed threshold - JRP - 24.09.2022 Hello That's what I thought, but it's the same script as the one proposed but with my variables and addresses. This is the script Code: require("user.Telegram") -- Requiere la librería de usuario RE: Notification of exceeding wind speed threshold - JRP - 27.09.2022 Any suggestion? Greeting RE: Notification of exceeding wind speed threshold - Daniel - 27.09.2022 Check errors on telegram like this res, err = telegram(message) log(res, err) RE: Notification of exceeding wind speed threshold - admin - 27.09.2022 Check that you don't have any other telegram() calls in Common functions, user library or in a duplicate script. |