25.12.2020, 19:55
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.
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
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