Logic Machine Forum
How to get value from an object? - 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: How to get value from an object? (/showthread.php?tid=5646)



How to get value from an object? - sck - 02.10.2024

Hi, 
I have created a LM script to control some light functionality manually and I am linking that to a dimming function on a wall switch. The wall switch is calling the address 0/5/27 (DTP diming control) and an event-based script is managing the lights from the LM.
The wall switch is sending two possible values and I cannot capture that from the script. I thought that using event.getvalue() will get me that data, but it only gives me true or false.
When looking on the group address info ´Last Value´ I can see the two possible values.
Could you please let me know how to capture that?
Thanks!


RE: How to get value from an object? - Daniel - 02.10.2024

Your event script is triggered not by your dimming object


RE: How to get value from an object? - sck - 02.10.2024

(02.10.2024, 11:36)Daniel Wrote: Your event script is triggered not by your dimming object

i don´t fully understand.

Is there a way of getting the ´Last value´ info of that object? when calling the script, the wall switch sends that value on the ´info´ column of the diagnostics view


RE: How to get value from an object? - Daniel - 02.10.2024

Yes, when you use event script and event.getvalue() then you will get last value from the object which triggers the event script. In your case is a 1bit object. If you want the dimming value do the same for 3bit dimming object. Alternatively you can do value = grp.getvalue('1/1/1') but this is will be checked each time a script is triggered(in case of event)


RE: How to get value from an object? - sck - 02.10.2024

(02.10.2024, 11:45)Daniel Wrote: Yes, when you use event script and event.getvalue() then you will get last value from the object which triggers the event script. In your case is a 1bit object. If you want the dimming value do the same for 3bit dimming object.  Alternatively you can do value = grp.getvalue('1/1/1') but this is will be checked each time a script is triggered(in case of event)

Thank you for your prompt response but I am afraid I don´t get it. On the one hand, you mention doing the same for 3bit dimming objects but I don´t know what you are referring to. 
On the other hand, you talk about getting the value from 1/1/1 which I also don´t understand since when doing that I only get true or false


RE: How to get value from an object? - Daniel - 02.10.2024

Share your script


RE: How to get value from an object? - sck - 02.10.2024

(02.10.2024, 12:59)Daniel Wrote: Share your script

my script is not relevant as I want to make decisions in my script based on the value I want to capture FROM that script. The issue is that I am not able to capture that value. My script calls another one from the user library, it has only one line.


RE: How to get value from an object? - Daniel - 02.10.2024

see this
https://www.screencast.com/t/DS5uT0acux


RE: How to get value from an object? - sck - 02.10.2024

(02.10.2024, 13:17)Daniel Wrote: see this
https://www.screencast.com/t/DS5uT0acux

very good idea and self-explanatory de video.
Now I am clear. What I didn´t understand is that why I should change the DTP when I have already had one, the surprise is that the one in ETS is not synched in LM... Why this happens?
thanks again, you saved me lot of time.


RE: How to get value from an object? - Daniel - 02.10.2024

Well this is not possible, you must import the ets project to LM for it to be updated.