This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script to calculate how many
#3
(11.04.2022, 12:27)admin Wrote: You need to tag all thermostat mode objects with therm-mode tag then the total count per mode can be calculated like this (either event script attached to this tag or a resident script with at least 5 second sleep time):
Code:
counters = {}

objects = grp.tag('therm-mode')

for _, obj in ipairs(objects) do
  value = obj.value
  counters[ value ] = (counters[ value ] or 0) + 1
end

grp.checkupdate('32/1/1', counters[ 1 ] or 0) -- comfort
grp.checkupdate('32/1/2', counters[ 2 ] or 0) -- away
grp.checkupdate('32/1/3', counters[ 3 ] or 0) -- economy

There are several options for blocking writes. One option is to use Custom JavaScript to block certain UI elements based on an object value. Another option is to add additional objects with event scripts which pass the value to the control object only when the mode object has a specific value.
Thank you so much for the script, 

Could you give one solution for blocking the writing?
Reply


Messages In This Thread
Script to calculate how many - by Fahd - 11.04.2022, 11:28
RE: Script to calculate how many - by admin - 11.04.2022, 12:27
RE: Script to calculate how many - by Fahd - 11.04.2022, 14:58
RE: Script to calculate how many - by admin - 12.04.2022, 09:04
RE: Script to calculate how many - by Fahd - 12.04.2022, 09:33
RE: Script to calculate how many - by admin - 12.04.2022, 11:37
RE: Script to calculate how many - by Fahd - 12.04.2022, 11:49

Forum Jump: