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.

different value throughout the day
#16
(16.06.2018, 17:57)benthoma Wrote:
(11.06.2018, 21:59)Erwin van der Zwart Wrote: Hi,

Try this:
Code:
now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('1/1/1', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('1/1/1', false)
end
For enable/disable script above from 1 bit use this: (sample is assuming event script script above is called 'timebasedevent')
Code:
if event.getvalue() == true then
  script.enable('timebasedevent')
else
  script.disable('timebasedevent')
end
BR,

Erwin
The first code. Can we do different things with a true value and a false value?


Hi ! i tried the first script, saved and enabled but it seem the object value given not changing. Tried to change value as hours follow the current timing, object value also no changed. Do i have to set the script run and check everytime (this wat i read throught out the search regard scripting)


this what in my script

now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('0/0/100', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('0/0/100', false)
end
Reply


Messages In This Thread
RE: different value throughout the day - by ricole87 - 12.06.2021, 06:03

Forum Jump: