Skip to content

Commit

Permalink
Update events documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codechimp committed Nov 21, 2024
1 parent f7c9e13 commit 1849c5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ sort:
### Battery Low Notification
Raise a persistent notification when a battery is low, dismiss when it's not low
!!! note
Battery Threshold events are only raised when the device has a Battery+ entity or a [Battery Low Template](./index.md/#battery_low_template) is added to the Battery Notes configuration.
```yaml
alias: Battery Low Notification
description: Battery Low Notification with auto dismiss
Expand Down Expand Up @@ -111,6 +115,10 @@ mode: single
### Battery Replaced
Mark a battery as replaced when there is an increase in battery level.
!!! note
Battery Increased events are only raised when the device has a Battery+ entity or a [Battery Low Template](./index.md/#battery_low_template) is added to the Battery Notes configuration.
```yaml
alias: Battery Replaced
description: Battery Replaced
Expand Down
14 changes: 11 additions & 3 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ The following events are raised by the integration. These events can be used wit
## Battery Threshold
`battery_notes_battery_threshold`

This is fired when any device within Battery Notes has a battery level changed to either below or above the device specific or global threshold.
This is fired when a device within Battery Notes has a battery level changed to either below or above the device specific or global threshold.

You can use this to send notifications in your preferred method. An example automation below displays a persistent notification.

!!! note

Battery Threshold events are only raised when the device has a Battery+ entity or a [Battery Low Template](./index.md/#battery_low_template) is added to the Battery Notes configuration.

| Attribute | Type | Description |
|-----------|------|-------------|
| `device_id` | `string` | The device id of the device. |
Expand All @@ -20,7 +24,7 @@ You can use this to send notifications in your preferred method. An example aut
| `battery_quantity` | `int` | Battery quantity. |
| `battery_level` | `float` | Battery level % of the device. |
| `previous_battery_level` | `float` | Previous battery level % of the device. |
| `reminder` | `bool` | Returns true if the event was raised by an action, false if it's from a device event. |
| `reminder` | `bool` | Returns true if the event was raised by an action, false if it's from a device event. |

### Automation Example

Expand Down Expand Up @@ -74,11 +78,15 @@ mode: queued
## Battery Increased
`battery_notes_battery_increased`

This is fired when any device within Battery Notes has a battery level increased above the battery_increase_threshold (default 25%) if not changed within [configuration setting](./configuration.md).
This is fired when a device within Battery Notes has a battery level increased above the battery_increase_threshold (default 25%) if not changed within [configuration setting](./configuration.md).

It deliberately does not update the battery_replaced sensor allowing you to choose how you want to handle this. The increase theshold allows for detecting/handling of partially charged batteries rather than just full batteries.
An example automation below shows how to update the battery_replaced.

!!! note

Battery Increased events are only raised when the device has a Battery+ entity or a [Battery Low Template](./index.md/#battery_low_template) is added to the Battery Notes configuration.

| Attribute | Type | Description |
|-----------|------|-------------|
| `device_id` | `string` | The device id of the device. |
Expand Down

0 comments on commit 1849c5f

Please sign in to comment.