Skip to content

Commit 708d2b2

Browse files
authored
Add lambda examples for deep sleep actions
The C++ function names for the deep_sleep actions are not immediately obvious.
1 parent 6211537 commit 708d2b2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

content/components/deep_sleep.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ on_...:
148148
id: deep_sleep_1
149149
until: "16:00:00"
150150
time_id: sntp_id
151+
152+
# in a lambda
153+
- lambda: |-
154+
id(deep_sleep_1).begin(true);
151155
```
152156

153157
Configuration options:
@@ -167,6 +171,10 @@ Useful for keeping the ESP active during data transfer or OTA updating (See note
167171
on_...:
168172
then:
169173
- deep_sleep.prevent: deep_sleep_1
174+
175+
# in a lambda
176+
- lambda: |-
177+
id(deep_sleep_1).prevent_deep_sleep();
170178
```
171179

172180
> [!NOTE]
@@ -199,7 +207,7 @@ on_...:
199207
> then:
200208
> - deep_sleep.enter: deep_sleep_1
201209
> ```
202-
210+
203211
{{< anchor "deep_sleep-allow_action" >}}
204212

205213
## `deep_sleep.allow` Action
@@ -210,6 +218,10 @@ This action allows the given deep sleep component to enter deep sleep, after pre
210218
on_...:
211219
then:
212220
- deep_sleep.allow: deep_sleep_1
221+
222+
# in a lambda
223+
- lambda: |-
224+
id(deep_sleep_1).enable();
213225
```
214226

215227
## See Also

0 commit comments

Comments
 (0)