30.10.2022, 18:47
Hi,
Boiler status I receive from powertag, updating periodically. I want message to telegram should be sent only once, when status changed. But my simple script not working, could not find where is the problem..
Can you please check where I am wrong..
Alex
Boiler status I receive from powertag, updating periodically. I want message to telegram should be sent only once, when status changed. But my simple script not working, could not find where is the problem..
Can you please check where I am wrong..
Code:
require("user.telegram")
local statuss = event.getvalue('42/2/10')----Boiler status
local alarm = event.getvalue('0/0/102') ---alarm status
--log(statuss)
--log (alarm)
if statuss == true then
if alarm == false then
message = 'Бойлер включен' ---message is not working, boiler is on
telegram(message)
grp.write('0/0/102', true) -- trying to block next alarm
alarm = true -- t
end
else
message = 'Бойлер выключен' --message working, boiler is off
telegram(message)
grp.write('0/0/102', false) -- trying to unblock next alarm when statuss is changed
alarm = false
end
Alex