Logic Machine Forum
event get value based on the physical address - 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 get value based on the physical address (/showthread.php?tid=4602)



event get value based on the physical address - Fahd - 23.02.2023

Hi, 

I have a 1byte Value group address (10/0/23 ) and there are two KNX devices that are sending  values in that group address  ( their physical address is 8.0.10 and 8.3.3 )

How can I write the same value on another grp address only when 8.0.10 is the one that sends it?


RE: event get value based on the physical address - admin - 23.02.2023

Code:
if event.src == '8.0.10' then
  value = event.getvalue()
  grp.write('10/1/23', value)
end



RE: event get value based on the physical address - Fahd - 23.02.2023

(23.02.2023, 07:19)admin Wrote:
Code:
if event.src == '8.0.10' then
  value = event.getvalue()
  grp.write('10/1/23', value)
end

event.src, I couldn't find it in the Lua manual.

Thanks a lot.


RE: event get value based on the physical address - admin - 23.02.2023

It's in the built-in help in the scripting editor under "Scripting basics".


RE: event get value based on the physical address - Erwin van der Zwart - 23.02.2023

Try log(event), this way you can see what's available (:

Code:
Event for Event Logging Test (7/7/7) 23.02.2023 08:45:07
* table:
["datalen"]
  * number: 0
["script"]
  * table:
   ["execmode"]
    * string:
   ["tag"]
    * string:
   ["execonread"]
    * bool: false
   ["name"]
    * string: Event for Event Logging Test (7/7/7)
   ["id"]
    * number: 91
["srcraw"]
  * number: 0
["src"]
  * string: local
["type"]
  * string: groupwrite
["meta"]
  * string: admin:192.168.10.197
["sender"]
  * string: us
["datahex"]
  * string: 00
["nobuswrite"]
  * bool: false
["dstraw"]
  * number: 16135
["getvalue"]
  * function: 0xb6d508c0
["dst"]
  * string: 7/7/7



RE: event get value based on the physical address - tassiebean - 06.10.2023

Hi Erwin, thanks for your post here! Most helpful.

There's so many times I've wanted to update a visualisation object from a script but not have it trigger the event script associated with that object. I only want the script executed if the user changes the object value via the visualisation. Many examples for this that I've written - set point for air conditioners, or a master slider for multiple lights, Hue scenes that change the individual light globe brightnesses, etc. I have been using flags that would be set and reset by interdependent scipts but it quickly becomes very unwieldy.

I see I can now check event["sender"] in my script and quit, for example, if the event was called by another script, and not by the user via the Visualisation.

I've been using the Schneider CBus Automation Controllers, and have tentatively found that sender seems to take these values:

us - if script is triggered by the user updating an object via the visualisation.
cl - if script is triggered by updating the object in another script.
cb - if script is triggered by the object being updated by a wall switch button (and maybe other hardware input devices?).

Do you have any listing and description of what values event["sender"] may return?
Also, this appears to be a somewhat undocumented feature, so is it likely to remain unchanged in future firmware updates?

Thanks for any help you can give.

Phil


RE: event get value based on the physical address - admin - 06.10.2023

List of senders: https://forum.logicmachine.net/showthread.php?tid=1562&pid=9574#pid9574