Skip to content

Commit

Permalink
202409 docs (#2274)
Browse files Browse the repository at this point in the history
* Add battery replaced event documentation

* Add battery replaced example

* Add beta tag
  • Loading branch information
andrew-codechimp authored Oct 27, 2024
1 parent 858c914 commit 7466a49
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,42 @@ action:
trigger.event.data.battery_type }}
mode: queued
max: 30
```

## Battery Replaced (BETA ONLY)
`battery_notes_battery_replaced`

This is fired when the battery is replaced, either by a button press or the action.

This can be useful for adding batteries to a shopping list or inventory system.

| Attribute | Type | Description |
|-----------|------|-------------|
| `device_id` | `string` | The device id of the device. |
| `source_entity_id` | `string` | The entity id of the sensor associated with the battery note. |
| `device_name` | `string` | The device name (or associated sensor name if no device). |
| `battery_type_and_quantity` | `string` | Battery type & quantity. |
| `battery_type` | `string` | Battery type. |
| `battery_quantity` | `int` | Battery quantity. |

### Automation Example

Note this cannot be run manually as it examines event triggers.

```yaml
alias: Battery Replaced
description: Battery replaced
trigger:
- platform: event
event_type: battery_notes_battery_replaced
condition: []
action:
- service: persistent_notification.create
data:
title: |
{{ trigger.event.data.device_name }} Battery Replaced
message: >
You just used {{trigger.event.data.battery_type_and_quantity }} batteries
mode: queued
max: 30
```

0 comments on commit 7466a49

Please sign in to comment.