LogicMachine Forum
Rooms status - Printable Version

+- LogicMachine 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: Rooms status (/showthread.php?tid=5387)



Rooms status - Stuart2000 - 27.04.2024

Hello, looking for 2 scripts using TAG.

How many rooms are in use based on a 1bit signal.

How many rooms have heating or cooling demands based on 1 byte signals.


RE: Rooms status - fleeceable - 27.04.2024

I use something like this to check alarms...
Resident script:

Code:
function check_count(tag, GA)   count = 0   data = grp.tag(tag)   for i=1, #data, 1 do     if string.sub(data[i].datatype, 1, 1) == '1' then --boolean       if data[i].value == true then           count = count +1       end     else       if data[i].value >0 then           count = count +1       end     end   end   grp.checkupdate(GA, count) end check_count('OCCUPIED','X/X/X')) --ADD TAG WHAT TO CHECK AND GROUP ADDRESS WHERE COUNT VALUE IS WRITTEN check_count('HEATING','X/X/X')) check_count('COOLING', 'X/X/X'))