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.

Scripting with two thresholds for changing the status of two Objects
#1
Hi,


I am having a humidity sensor which I need to set it to write the status on an Object if the humidity goes below 30%, or write the status on other Object if the humidity goes over 50%. The below example is an Event-based script associated to an Object and I am not sure if I have done it correctly, or if it should exist as Resident script. 


Code:
value = event.getvalue()

if value < 30 then
  grp.write('1/4/11', 1)
else
  grp.write('1/4/11', 0)

end

if value > 50 then
  grp.write('1/4/14', 1)
else
  grp.write('1/4/14', 0) 
   
end

I see no errors while saving this script. Based on how is it coded, the Objects 1/4/11 and 1/4/14 will always be written with 0 if the read value is between 30 and 50?


Thank you,
Andreas
Reply


Messages In This Thread
Scripting with two thresholds for changing the status of two Objects - by andeug - 25.12.2020, 19:55

Forum Jump: