FAQ
TL;DR: Yes—OpenBeken schedules with day‑bit masks; weekdays mask = 62 (0x3E). "Each bit corresponds to each day." Use these flags to build reliable timers and avoid hex/decimal mistakes. [Elektroda, p.kaczmarek2, post #21095451]
Why it matters: This FAQ helps OpenBeken users quickly create, debug, and verify weekly schedules with addClockEvent.
Quick Facts
- Day-bit mapping: Sun=1, Mon=2, Tue=4, Wed=8, Thu=16, Fri=32, Sat=64; weekdays=62 (0x3E), all days=127 (0x7F). [Elektroda, p.kaczmarek2, post #21095451]
- Friday flag is decimal 32 or hex 0x20; using 0x32 triggers extra days. [Elektroda, p.kaczmarek2, post #20767676]
- Backlog currently lacks delay support; use an alias with addRepeatingEvent for delayed actions. [Elektroda, p.kaczmarek2, post #21293997]
- Official addClockEvent examples were published; open autoexecExamples.md and search “addClockEvent.” [Elektroda, p.kaczmarek2, post #20549602]
- Practical setup often starts NTP and waits for NTPState 1 before adding schedules. [Elektroda, agarg, post #21293852]
Is there a scheduler in OpenBeken, or do I just add timers?
Yes. Use addClockEvent to schedule time-based actions. The project maintainer directed users to this command for scheduling needs and linked the reference documentation. It’s the canonical way to implement clock/weekly rules in OpenBeken scripts. [Elektroda, p.kaczmarek2, post #20546898]
How do weekday flags work in addClockEvent?
"Each bit corresponds to each day, starting with Sunday, which is 1." So Mon=2, Tue=4, Wed=8, Thu=16, Fri=32, Sat=64. Weekdays Mon–Fri total 62 (0x3E). All seven days total 127 (0x7F). This bitmask approach lets you combine any days you need in one schedule. [Elektroda, p.kaczmarek2, post #21095451]
Why did my Friday mask 0x32 also trigger on Thursday?
Because 0x32 is hexadecimal for decimal 50, which includes multiple bits. Friday is decimal 32 or hex 0x20. Using 0x32 inadvertently includes the Thursday bit (0x10) and more. Use 32 (decimal) or 0x20 (hex) to target only Friday. [Elektroda, p.kaczmarek2, post #20767676]
What mask enables Monday to Friday only?
Sum the weekday bits: 2 + 4 + 8 + 16 + 32 = 62. In hexadecimal, that is 0x3E. Use that as the second parameter in addClockEvent to schedule Monday through Friday only. [Elektroda, p.kaczmarek2, post #21095451]
What mask enables all days of the week?
Use all seven bits: 1 + 2 + 4 + 8 + 16 + 32 + 64 = 127. In hexadecimal that’s 0x7F. This enables Sunday through Saturday. [Elektroda, p.kaczmarek2, post #21095451]
How do I set up NTP so schedules fire on real time?
Enable NTP and wait for sync before adding events. How-To:
- startDriver NTP; set ntp_setServer and ntp_timeZoneOfs.
- waitFor NTPState 1 to confirm sync.
- Then addClockEvent lines.
This ensures the device knows the correct clock before scheduling runs. [Elektroda, agarg, post #21293852]
My backlog with delay_s inside addClockEvent didn’t work. How do I add a delay?
Backlog currently lacks delay support. Use an alias that schedules a one-shot repeating event. Example: alias turn_off_after_time addRepeatingEvent 10 1 power1 off; alias do_cycle backlog power1 on; turn_off_after_time; then call do_cycle from addClockEvent. "We don’t have delay support in backlog yet." [Elektroda, p.kaczmarek2, post #21293997]
How can I sanity-check my schedule before relying on it?
Test the command chain by running the alias manually, then wire it into addClockEvent. For example, run do_cycle to verify ON happens now and OFF occurs after the delay. "Test it by using 'do_cycle' as a command" and add it to the clock event once verified. [Elektroda, p.kaczmarek2, post #21293997]
What time format does addClockEvent expect?
Use HH:MM:SS in 24-hour format, such as 14:31:00 or 12:00:00. Keep seconds explicit to avoid ambiguity and ensure precise triggers. [Elektroda, p.kaczmarek2, post #21293997]
Where can I find working addClockEvent examples for autoexec.bat?
Open the project’s autoexecExamples.md and search for “addClockEvent.” The maintainer added demos there specifically to illustrate scheduler usage. [Elektroda, p.kaczmarek2, post #20549602]
Can I schedule two actions one minute apart?
Yes. Add two addClockEvent lines one minute apart, for example 08:15:00 and 08:16:00, using your chosen day mask (e.g., 0x7F). A user demonstrated ON at 08:15 and OFF at 08:16 successfully. [Elektroda, agarg, post #21294481]
How do I schedule weekends only?
Combine Sunday and Saturday bits: 1 + 64 = 65, which is 0x41 in hex. Use 65 (decimal) or 0x41 (hex) as the day mask. [Elektroda, p.kaczmarek2, post #21095451]
How do I schedule just Thursday?
Use the Thursday bit alone. That’s decimal 16 or hexadecimal 0x10. Set the second parameter of addClockEvent to 16 (or 0x10). [Elektroda, p.kaczmarek2, post #21095451]
Can I trigger an alias directly from addClockEvent?
Yes. Define an alias (e.g., do_cycle) and use that alias name as the command in addClockEvent. This also enables delayed actions via addRepeatingEvent within the alias. [Elektroda, p.kaczmarek2, post #21293997]