Skip to content

Commit 7466a49

Browse files
202409 docs (#2274)
* Add battery replaced event documentation * Add battery replaced example * Add beta tag
1 parent 858c914 commit 7466a49

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/events.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,42 @@ action:
156156
trigger.event.data.battery_type }}
157157
mode: queued
158158
max: 30
159+
```
160+
161+
## Battery Replaced (BETA ONLY)
162+
`battery_notes_battery_replaced`
163+
164+
This is fired when the battery is replaced, either by a button press or the action.
165+
166+
This can be useful for adding batteries to a shopping list or inventory system.
167+
168+
| Attribute | Type | Description |
169+
|-----------|------|-------------|
170+
| `device_id` | `string` | The device id of the device. |
171+
| `source_entity_id` | `string` | The entity id of the sensor associated with the battery note. |
172+
| `device_name` | `string` | The device name (or associated sensor name if no device). |
173+
| `battery_type_and_quantity` | `string` | Battery type & quantity. |
174+
| `battery_type` | `string` | Battery type. |
175+
| `battery_quantity` | `int` | Battery quantity. |
176+
177+
### Automation Example
178+
179+
Note this cannot be run manually as it examines event triggers.
180+
181+
```yaml
182+
alias: Battery Replaced
183+
description: Battery replaced
184+
trigger:
185+
- platform: event
186+
event_type: battery_notes_battery_replaced
187+
condition: []
188+
action:
189+
- service: persistent_notification.create
190+
data:
191+
title: |
192+
{{ trigger.event.data.device_name }} Battery Replaced
193+
message: >
194+
You just used {{trigger.event.data.battery_type_and_quantity }} batteries
195+
mode: queued
196+
max: 30
159197
```

0 commit comments

Comments
 (0)