this easy script is nice, but I need it to send me to the right about the power outage and it’s conctternally
-if it records a power outage, it sends it to the right
-so at regular intervals, for example, every 15 minutes. it will send me a message about the power state even with the current Volts
-until the electricity is turned on, then it will send me only one message that the device is UP,
-it no longer sends more messages until the caretaker has run out of electricity…
Hello, this script itself, what would its function be? Do you use it to warn if you have low voltage in direct current? I mean, do you have battery modules or something like that?
:if ($voltSystem >= $voltMin and $lastvoltage < $voltMin) do={:log warning "!!!POWER is UP!!! - Current Voltage is: $voltSystem V";}
:if ($voltSystem >= $voltMin and $lastvoltage < $voltMin) do={/tool fetch "https://api.telegram.org/bot$BotID/sendmessage?chat_id=$CHID&parse_mode=markdown&text=%0A.::: $thisbox :::.%0A*!!!POWER is UP!!!%0A%0Current Voltage is: $voltSystem V%0A" keep-result=no;}
:if ($voltSystem <= $voltMin and $lastvoltage > $voltMin) do={:log error "!!!POWER is DOWN!!! - SYSTEM is run from the battery - Current Voltage is: $voltSystem V";}
:if ($voltSystem <= $voltMin and $lastvoltage > $voltMin) do={/tool fetch "https://api.telegram.org/bot$BotID/sendmessage?chat_id=$CHID&parse_mode=markdown&text=%0A.::: $thisbox :::.%0A!!!POWER is DOWN!!! %0ASYSTEM is run from the battery%0A*%0ACurrent Voltage is: $voltSystem V%0A" keep-result=no;}
Hi @diamuxin
I am also using this same script but I dont use Telegram. I only have a low voltage or high voltage email sent to me if the voltages are above or below the limits set.
I have made the above change but every time the script runs it just emails me with the current board voltage.
I would really appreciate it if you could help me with my script?
This is my current script:
#set lowvoltalarm to desired alarm voltage in tenths of a volt. 125 = 12.5v
:global lowvoltalarm 225
:global highvoltalarm 300
:global highvolt
:global lowvolt
:global starttime
:global hivolttime
:global lovolttime
:global vh
:local thisbox [/system identity get name]
:global voltage [/system health get voltage]
:local thistime [/system clock get time]
:local thisdate [/system clock get date]
:local thishour [:pick $thistime 0 2]
:local emessage ($thisbox . " voltage is: " . [:pick $voltage 0 2] . "." . [:pick $voltage 2 3])
:if ([:len $lowvolt] < 1) do={:set lowvolt 999; :set highvolt 0}