Display should be off during 19:00 and 8:00 from Monday to Friday, and completely in the weekend. Where is the mistake? Do I need another trigger?
I'm a bit unsure what you want (OLED off during daytime or off during night time). From your code I think you want the display only on during the daytime and always off on the weekend. So that's what I coded. You can change it if that's not what you need.
Code: Select all
on Clock#Time=All,**:** do
LogEntry,"Processing One-Minute Clock Event: Time is %systm_hm%, Day=%sysweekday%"
if %sysweekday%>1 and %sysweekday%<7 // Allowed Date Range, Mon=2, Fri=6
LogEntry,"Mon(2)-Fri(6) Detected, (Day=%sysweekday%)"
if %systm_hm% > 08:00 and %systm_hm% < 19:00 // 8AM - 7:00PM Time Range
LogEntry,"Oled Display Turn On Time"
OledFramedCmd,display,on
else
LogEntry,"Oled Display Turn Off Time"
OledFramedCmd,display,off
endif
else
LogEntry,"Weekend:Turn Off Oled Display"
OledFramedCmd,display,off
endif
endon
The Clock#Time event will be triggered once per minute. This is what runs the rule.
I can't verify the rule since I don't use an OLED. If doesn't work then use serial log to assist with the debugging.
- Thomas