Logic Machine Forum
Writing multiple group adresses with same value - 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: Writing multiple group adresses with same value (/showthread.php?tid=3283)



Writing multiple group adresses with same value - Tokatubs - 04.04.2021

I am starting an project with loads of SIemens GD181 VAVs. 

Vnom, Vmin and Vmax needs to be written to group addresses. But lots of the Vavs have same values.
So before i write every value manually in ETS.

But is there a way to write this more easier from Lm5. For example if i add all with same Vnom and add them with same tag "Vnom315", could i then via an script write same value to all GA with this tag?


RE: Writing multiple group adresses with same value - Seijboldt - 04.04.2021

(04.04.2021, 20:29)Tokatubs Wrote: I am starting an project with loads of SIemens GD181 VAVs. 

Vnom, Vmin and Vmax needs to be written to group addresses. But lots of the Vavs have same values.
So before i write every value manually in ETS.

But is there a way to write this more easier from Lm5. For example if i add all with same Vnom and add them with same tag "Vnom315", could i then via an script write same value to all GA with this tag?

Hi,
Yes this is very possible. If you need an example let me know and I'll dig one up Smile

(04.04.2021, 21:02)Seijboldt Wrote:
(04.04.2021, 20:29)Tokatubs Wrote: I am starting an project with loads of SIemens GD181 VAVs. 

Vnom, Vmin and Vmax needs to be written to group addresses. But lots of the Vavs have same values.
So before i write every value manually in ETS.

But is there a way to write this more easier from Lm5. For example if i add all with same Vnom and add them with same tag "Vnom315", could i then via an script write same value to all GA with this tag?

Hi,
Yes this is very possible. If you need an example let me know and I'll dig one up Smile


Here you go, you need to name your objects correctly though.
The code below searches for the name Vnom in any group object and writes the Value to it.

Code:
obj = db:getall('SELECT name FROM objects WHERE name LIKE "%Vnom%"')
Value=69
for _, addr in ipairs(obj) do
    grp.checkwrite(addr.name, Value, 1)
end



RE: Writing multiple group adresses with same value - Tokatubs - 04.04.2021

Wow thanks alot. Whats the correct script to post this in, event, resident or ?


RE: Writing multiple group adresses with same value - Seijboldt - 04.04.2021

(04.04.2021, 21:21)Tokatubs Wrote: Wow thanks alot. Whats the correct script to post this in, event, resident or ?

Event, you only want to run it when you need to.


RE: Writing multiple group adresses with same value - admin - 06.04.2021

It's recommended to use tags instead of DB queries. You can attach an event script to an object that will write to all objects with Vnom tag. Make sure that this object does not have this tag otherwise you will get an infinite loop.
Code:
value = event.getvalue()
objects = grp.tag('Vnom')
objects:checkwrite(value)