Logic Machine Forum
Binary Alert Message - 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: Binary Alert Message (/showthread.php?tid=666)



Binary Alert Message - german.cespedes@ecoelec.cl - 10.03.2017

Dear,

Perform a message alert for temperature and everything is perfect, as the example below:

Value = event.getvalue()
if Value <= 15 then
  Alarm_text = table.concat({'Tmep too low', Value, '°C'})
  alert(Alarm_text)
elseif Value <= 30 then
  Alarm_text = table.concat({'Tmep too high', Value, '°C'})
  alert(Alarm_text)
end


The problem is that I try to have an alert when the group address 0/4/2 is in logical value "1", making allusion that it is a failure of a bomb and it does not work for me, here I leave the program and the screen of the program , I hope you can help me.

value = event.getvalue()
if Value <= 1 then
  Alarm_text = table.concat({'TERMICO BOMBA 1'})
  alert(Alarm_text)
end


Greetings.


RE: Binary Alert Message - admin - 10.03.2017

In second script you have two different variables: value and Value.


RE: Binary Alert Message - leondias - 10.03.2017

if value is boolean, try one of these:
if value then
if not value then
or use true or false instead of 1 and 0


RE: Binary Alert Message - german.cespedes@ecoelec.cl - 10.03.2017

(10.03.2017, 11:41)leondias Wrote: if value is boolean, try one of these:
if value then
if not value then
or use true or false instead of 1 and 0

thansks leondias, 

Make the change to true and work perfectly.

value = event.getvalue()
if value == true then
  Alarm_text = table.concat({'FALLA TERMICO BOMBA 1'})
  alert(Alarm_text)
end

regards

(10.03.2017, 06:53)admin Wrote: In second script you have two different variables: value and Value.

Change the "V" to "v" and change the "1" logic to true and work perfectly

thanks   Big Grin