Logic Machine Forum
Event trigger information - 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: Event trigger information (/showthread.php?tid=4935)



Event trigger information - Novodk - 26.08.2023

If I have a event script linked to a tag is it possible to "read" what group address with that tag triggered the event, and write it in a telegram message?

something like this:

value = event.getvalue()

if value==true and grp.getvalue('1/0/0') then

telegram('Group %s triggered the event')

end


RE: Event trigger information - Erwin van der Zwart - 26.08.2023

You look for event.dst


RE: Event trigger information - Novodk - 27.08.2023

(26.08.2023, 20:37)Erwin van der Zwart Wrote: You look for event.dst

I had some trouble implementing it, and I could not find any information in the docs, but I figured it out and it works, thank you



Code:
value = event.getvalue()
objekt = grp.find(event.dst)

if value==true and grp.getvalue('1/0/0') then

    alert("ALARM " .. objekt.name .. " ALARM")
    telegram("ALARM " .. objekt.name .. " ALARM")
end