Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time of day wakeup example #1265

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/DeepSleep.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ Once device maintenance is completed, place it back into DeepSleep mode using or

## Rules

!!! example
An example of a ruleset which deepsleeps a device with a RTC module attached during a certain portion of the day (i.e. at night). Mem1 is set to wakeup time in the morning (i.e. 540) and Mem2 to sleep time (i.e. 1080). For network attached devices with no RTC module, `time#initialized` trigger is better than `system#init`. Might be smart to have a DeepSleep gpio assigned if you need to access the device outside of normal awake hours.
```
rule1
on system#init do backlog event timecheck=%time%; ruletimer1 1 endon
on time#minute do event timecheck=%time%; ruletimer1 1 endon
on event#timecheck<%mem1% do Var1 3600 endon
on event#timecheck>%mem1% do Var1 0 endon
on event#timecheck>%mem2% do Var1 3600 endon
on rules#timer=1 do deepsleeptime %var1% endon
```

The following triggers can be used to execute commands upon wake-up or right before entering DeepSleep:
- `Power1#Boot` : is the earliest trigger. But valid only if you have a `Relay` output defined.
- `Switch1#Boot` : is the next trigger, also occur very early in the boot process. But valid only if you have `Switch` input defined.
Expand Down