This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Telegram message with blocking
#1
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..

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
Reply


Messages In This Thread
Telegram message with blocking - by AlexLV - 30.10.2022, 18:47
RE: Telegram message with blocking - by admin - 31.10.2022, 07:09

Forum Jump: