Skip to content

Commit 18a996d

Browse files
committed
docs: Added automation example for calendars
1 parent d36710b commit 18a996d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

_docs/entities/octoplus.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ Calendar sensor to record saving sessions. Will be `on` when a saving session th
5353

5454
The events are supplied by OE API and does not store past events indefinitely. Past events could be removed without notice.
5555

56+
### Automation Example
57+
58+
Below is an example of raising a persistent notification 5 minutes before a saving session starts.
59+
60+
```yaml
61+
triggers:
62+
- trigger: calendar
63+
entity_id: calendar.octopus_energy_{{ACCOUNT_ID}}_octoplus_saving_sessions
64+
event: start
65+
offset: -00:05:00
66+
actions:
67+
- action: persistent_notification.create
68+
data:
69+
title: Saving Session Starting
70+
message: >
71+
{% set minutes = ((state_attr(trigger.entity_id, 'end_time') | as_datetime - state_attr(trigger.entity_id, 'start_time') | as_datetime).seconds / 60) | round(0) | string %}
72+
{% set start_time = (state_attr(trigger.entity_id, 'start_time') | as_datetime).strftime('%H:%M') %}
73+
Saving session starts at {{ start_time }} for {{ minutes }} minutes.
74+
```
75+
5676
## Saving Session Events
5777
5878
`event.octopus_energy_{{ACCOUNT_ID}}_octoplus_saving_session_events`
@@ -182,6 +202,26 @@ Calendar sensor to record free electricity sessions. Will be `on` when a free el
182202

183203
You can use the [data_last_retrieved sensor](./diagnostics.md#free-electricity-sessions-data-last-retrieved) to determine when the underlying data was last retrieved from the OE servers.
184204

205+
### Automation Example
206+
207+
Below is an example of raising a persistent notification 5 minutes before a free electricity session starts.
208+
209+
```yaml
210+
triggers:
211+
- trigger: calendar
212+
entity_id: calendar.octopus_energy_{{ACCOUNT_ID}}_octoplus_free_electricity_session
213+
event: start
214+
offset: -00:05:00
215+
actions:
216+
- action: persistent_notification.create
217+
data:
218+
title: Free Electricity Session Starting
219+
message: >
220+
{% set minutes = ((state_attr(trigger.entity_id, 'end_time') | as_datetime - state_attr(trigger.entity_id, 'start_time') | as_datetime).seconds / 60) | round(0) | string %}
221+
{% set start_time = (state_attr(trigger.entity_id, 'start_time') | as_datetime).strftime('%H:%M') %}
222+
Free electricity session starts at {{ start_time }} for {{ minutes }} minutes.
223+
```
224+
185225
## Free Electricity Session Events
186226

187227
`event.octopus_energy_{{ACCOUNT_ID}}_octoplus_free_electricity_session_events`

0 commit comments

Comments
 (0)