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.

Time dependent script
#8
This logic part is wrong: 19 <= hour and hour <= 7
Another issue with this script is that if the input object value is false it will first write 70 then 0 to the output. This can cause the light to flicker.

Corrected version (event script, as it should be):
Code:
value = event.getvalue()

if value then
  hour = os.date('*t').hour

  if hour <= 7 or hour >= 19 then
    out = 10
  else
    out = 70
  end
else
  out = 0
end

grp.checkwrite('1/4/30', out)
Reply


Messages In This Thread
Time dependent script - by FatMax - 18.11.2015, 13:21
RE: Time dependent script - by admin - 19.11.2015, 07:23
RE: Time dependent script - by FatMax - 19.11.2015, 08:33
RE: Time dependent script - by FatMax - 14.01.2016, 13:18
RE: Time dependent script - by admin - 14.01.2016, 13:36
RE: Time dependent script - by FatMax - 14.01.2016, 13:39
RE: Time dependent script - by KoBra - 12.09.2023, 18:34
RE: Time dependent script - by admin - 13.09.2023, 07:44
RE: Time dependent script - by KoBra - 13.09.2023, 13:16
RE: Time dependent script - by admin - 13.09.2023, 14:16
RE: Time dependent script - by KoBra - 14.09.2023, 09:25

Forum Jump: