Skip to content

Commit f0b81c6

Browse files
Services to actions (#1950)
* Rename services to actions for 2024.8 * Remove data prefixes
1 parent 9b91732 commit f0b81c6

File tree

7 files changed

+52
-52
lines changed

7 files changed

+52
-52
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Track the battery type, when the battery was replaced, when a battery is low bas
1111

1212
A battery+ sensor provides useful attributes for easy use in dashboards, the standard battery can optionally be hidden.
1313

14-
Battery low, replaced and not reported are all via events and services, you have the option of creating your own automations for these or using the predefined ones in [community](https://andrew-codechimp.github.io/HA-Battery-Notes/community).
14+
Battery low, replaced and not reported are all via events and actions, you have the option of creating your own automations for these or using the predefined ones in [community](https://andrew-codechimp.github.io/HA-Battery-Notes/community).
1515

1616
*Please :star: this repo if you find it useful*
1717
*If you want to show your support please*
@@ -56,7 +56,7 @@ battery_notes:
5656

5757
## Docs
5858

59-
To get full use of the integration, read the documentation. It contains community quick starts as well as details on all the services, events and entities.
59+
To get full use of the integration, read the documentation. It contains community quick starts as well as details on all the actions, events and entities.
6060

6161
[!["Documentation"](https://raw.githubusercontent.com/andrew-codechimp/ha-battery-notes/main/docs/assets/documentation.png)](https://andrew-codechimp.github.io/HA-Battery-Notes/)
6262

docs/actions.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Actions
2+
3+
## battery_notes.set_battery_replaced
4+
5+
For updating the [battery replaced date](./entities.md#battery-replaced). This allows you to change the date a battery was replaced.
6+
7+
See how to use this action in the [community contributions](./community.md)
8+
9+
| Data attribute | Optional | Description |
10+
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
11+
| `device_id` | `yes` | The device id that you want to change the battery replaced date for. |
12+
| `source_entity_id` | `yes` | The entity id that you want to change the battery replaced date for (only used for entity associated battery notes). |
13+
| `datetime_replaced` | `yes` | The optional datetime that you want to set the battery replaced to, if omitted the current date/time will be used. |
14+
15+
You must specify either a device_id or entity_id, entity_id will be used in preference if both are specified. This allows the action to work with battery notes associated with both a device and also an individual entity, whether it is part of a device or not.
16+
17+
## battery_notes.check_battery_last_reported
18+
19+
For raising events for devices that haven't reported their battery level.
20+
21+
The action will raise a seperate [battery_not_reported](./events.md/#battery_not_reported) event for each device where its last reported date is older than the number of days specified.
22+
23+
You can use this action to schedule checks on batteries that is convenient to you, e.g. when you wake up, once a week etc.
24+
25+
See how to use this action in the [community contributions](./community.md)
26+
27+
| Data attribute | Optional | Description |
28+
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
29+
| `days_last_reported` | `no` | The number of days since a device last reported its battery level. |
30+
31+
## battery_notes.check_battery_low
32+
33+
For raising events for devices that have a battery low status.
34+
35+
The action will raise a seperate [battery_threshold](./events.md/#battery_threshold) event for each device that have a battery low status.
36+
37+
You can use this action as a reminder that is convenient to you, e.g. when you wake up, once a week etc. The event has a boolean data item `reminder` to determine if the event was raised by this action or the device battery going to a low state.
38+
39+
See how to use this action in the [community contributions](./community.md)

docs/community.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mode: queued
7373
```
7474
7575
### Check Battery Low daily reminder
76-
Call the check battery low service every day to raise events for those that are still low.
76+
Call the check battery low action every day to raise events for those that are still low.
7777
To be used in conjunction with a [Battery Low Notification](community.md/#battery-low-notification) or similar.
7878
7979
```yaml
@@ -146,7 +146,7 @@ mode: queued
146146
```
147147
148148
### Check Battery Last Reported Daily
149-
Call the check battery last reported service every day to raise events for those not reported in the last two days.
149+
Call the check battery last reported action every day to raise events for those not reported in the last two days.
150150
To be used in conjunction with a Battery Not Reported automation.
151151
152152
```yaml
@@ -164,7 +164,7 @@ mode: single
164164
```
165165
166166
### Battery Not Reported
167-
Respond to events raised by the check_battery_last_reported service and create notifications.
167+
Respond to events raised by the check_battery_last_reported action and create notifications.
168168
169169
Note this cannot be run manually as it examines event triggers, use it with the [Check Battery Last Reported Daily](community.md/#check-battery-last-reported-daily) or similar.
170170
@@ -193,7 +193,7 @@ max: 30
193193
194194
## Automation Tips
195195
196-
To call the battery replaced service from an entity trigger you will need the device_id, here's an easy way to get this
196+
To call the battery replaced action from an entity trigger you will need the device_id, here's an easy way to get this
197197
198198
```yaml
199199
action:
@@ -224,7 +224,7 @@ It is extended from the example Battery Replaced automation yaml above for those
224224
225225
This blueprint will allow notifications to be raised and/or custom actions to be performed when the battery not reported event is fired.
226226
It is extended from the example Battery Not Reported automation yaml above for those who'd prefer an easy way to get started.
227-
You must trigger the check_battery_not_reported service via an automation to raise events, see [Check Battery Last Reported Daily](community.md/#check-battery-last-reported-daily) above.
227+
You must trigger the check_battery_not_reported action via an automation to raise events, see [Check Battery Last Reported Daily](community.md/#check-battery-last-reported-daily) above.
228228
229229
## Contributing
230230
If you want to contribute then [fork the repository](https://github.com/andrew-codechimp/HA-Battery-Notes), edit this page which is in the docs folder and submit a pull request.

docs/events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can use this to send notifications in your preferred method. An example aut
2020
| `battery_quantity` | `int` | Battery quantity. |
2121
| `battery_level` | `float` | Battery level % of the device. |
2222
| `previous_battery_level` | `float` | Previous battery level % of the device. |
23-
| `reminder` | `bool` | Returns true if the event was raised by a service call, false if it's from a device event. |
23+
| `reminder` | `bool` | Returns true if the event was raised by an action, false if it's from a device event. |
2424

2525
### Automation Example
2626

@@ -113,9 +113,9 @@ mode: queued
113113
## Battery Not Reported
114114
`battery_notes_battery_not_reported`
115115

116-
This is fired from the [check_battery_last_reported](./services.md/#check_battery_last_reported) service call for each device that has not reported its battery level for the number of days specified in the service call.
116+
This is fired from the [check_battery_last_reported](./actions.md/#check_battery_last_reported) action call for each device that has not reported its battery level for the number of days specified in the action call.
117117

118-
The service can raise multiple events quickly so when using with an automation it's important to use the `mode: queued` to handle these.
118+
The action can raise multiple events quickly so when using with an automation it's important to use the `mode: queued` to handle these.
119119

120120
| Attribute | Type | Description |
121121
|-----------|------|-------------|

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Integration to add battery notes to a device or entity, with automatic discovery via a growing [battery library](library.md) for devices.
44
Track the battery type, when the battery was replaced, when a battery is low based on device or global thresholds and also when a battery hasn't been reported for a while.
5-
Battery low, replaced and not reported are all via events and services, you have the option of creating your own automations for these or using the predefined ones in [community](./community.md).
5+
Battery low, replaced and not reported are all via events and actions, you have the option of creating your own automations for these or using the predefined ones in [community](./community.md).
66

77
*Please :star: this repo on [GitHub](https://github.com/andrew-codechimp/HA-Battery-Notes) if you find it useful*
88
*If you want to show your support please*
@@ -17,7 +17,7 @@ The integration will add additional diagnostic entities to your device.
1717
![device example](./assets/screenshot-device.png)
1818

1919
* [Entities](./entities.md)
20-
* [Services](./services.md)
20+
* [Actions](./actions.md)
2121
* [Events](./events.md)
2222

2323
## How to use Battery Notes

docs/services.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ nav:
77
- Home: index.md
88
- Entities: entities.md
99
- Events: events.md
10-
- Services: services.md
10+
- Actions: actions.md
1111
- Library: library.md
1212
- Configuration: configuration.md
1313
- Community: community.md

0 commit comments

Comments
 (0)