Skip to content

Commit f7ab4ff

Browse files
Example blueprints (#670)
* First example * WIP * WIP * Docs * Docs * Docs * Docs
1 parent cb59ae3 commit f7ab4ff

File tree

3 files changed

+139
-1
lines changed

3 files changed

+139
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
blueprint:
2+
name: Battery Notes - Battery Replaced
3+
description: Set the battery replaced automatically when the battery increased
4+
author: andrew-codechimp
5+
source_url: https://raw.githubusercontent.com/andrew-codechimp/HA-Battery-Notes/main/docs/blueprints/battery_notes_battery_replaced.yaml
6+
domain: automation
7+
8+
input:
9+
on_replaced_actions:
10+
name: On Replaced Actions
11+
description: User actions to run on battery replacement, the battery is marked as replaced automatically. Use any event data via trigger.event.data.xxx
12+
default: []
13+
selector:
14+
action:
15+
mode: queued
16+
trigger:
17+
- platform: event
18+
event_type: battery_notes_battery_increased
19+
condition: []
20+
action:
21+
- service: battery_notes.set_battery_replaced
22+
data:
23+
device_id: "{{ trigger.event.data.device_id }}"
24+
- alias: "Run user on replaced actions"
25+
choose: []
26+
default: !input 'on_replaced_actions'
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
blueprint:
2+
name: Battery Notes - Battery Threshold
3+
description: Actions to perform when the battery threshold is met
4+
author: andrew-codechimp
5+
source_url: https://raw.githubusercontent.com/andrew-codechimp/HA-Battery-Notes/main/docs/blueprints/battery_notes_battery_threshold.yaml
6+
domain: automation
7+
8+
input:
9+
low_notification:
10+
name: Battery Low Notification
11+
description: Create a persistent notification when the battery is low.
12+
default: True
13+
selector:
14+
boolean:
15+
high_notification:
16+
name: Remove Low Notification
17+
description: Remove the persistent notification when the battery is no longer low. Use any event data via trigger.event.data.xxx
18+
default: True
19+
selector:
20+
boolean:
21+
on_low_actions:
22+
name: On Low Actions
23+
description: User actions to run on battery low.
24+
default: []
25+
selector:
26+
action:
27+
on_high_actions:
28+
name: On High Actions
29+
description: User actions to run on battery returning from low. Use any event data via trigger.event.data.xxx
30+
default: []
31+
selector:
32+
action:
33+
34+
variables:
35+
low_notification: !input low_notification
36+
high_notification: !input high_notification
37+
38+
trigger:
39+
- platform: event
40+
event_type: battery_notes_battery_threshold
41+
event_data:
42+
battery_low: true
43+
id: low
44+
alias: Battery went low
45+
- platform: event
46+
event_type: battery_notes_battery_threshold
47+
event_data:
48+
battery_low: false
49+
id: high
50+
alias: Battery went high
51+
52+
condition: []
53+
54+
action:
55+
- choose:
56+
- conditions:
57+
- condition: trigger
58+
id:
59+
- low
60+
sequence:
61+
- if:
62+
- condition: template
63+
value_template: "{{ low_notification }}"
64+
then:
65+
- service: persistent_notification.create
66+
data:
67+
title: |
68+
{{ trigger.event.data.device_name }} Battery Low
69+
notification_id: "{{ trigger.event.data.device_id }}"
70+
message: >
71+
The device has a battery level of {{
72+
trigger.event.data.battery_level }}% {{ '\n' -}} You need {{
73+
trigger.event.data.battery_quantity }}x {{
74+
trigger.event.data.battery_type }}
75+
- alias: "Run user on low actions"
76+
choose: []
77+
default: !input 'on_low_actions'
78+
- conditions:
79+
- condition: trigger
80+
id:
81+
- high
82+
sequence:
83+
- if:
84+
- condition: template
85+
value_template: "{{ low_notification }}"
86+
then:
87+
- service: persistent_notification.dismiss
88+
data:
89+
notification_id: "{{ trigger.event.data.device_id }}"
90+
- alias: "Run user on high actions"
91+
choose: []
92+
default: !input 'on_high_actions'
93+
94+
mode: queued

docs/community.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ action:
103103
device_id: "{{ device_id(trigger.entity_id) }}"
104104
```
105105
106-
## Contributing
106+
## Blueprints
107107
108+
[Blueprints](https://www.home-assistant.io/docs/automation/using_blueprints/) are an excellent way to get you up and running with the integration quickly. They can also be used as a guide for setting up new automations which you can tailor to your needs.
109+
110+
### Battery Threshold (Beta Only)
111+
112+
[Install blueprint](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fraw.githubusercontent.com%2Fandrew-codechimp%2FHA-Battery-Notes%2Fmain%2Fdocs%2Fblueprints%2Fbattery_notes_battery_threshold.yaml) | [Source](./blueprints/battery_notes_battery_threshold.yaml)
113+
114+
This blueprint will allow notifications to be raised and/or custom actions to be performed when the battery threshold is met.
115+
It is extended from the example Battery Low Notification automation yaml above for those who'd prefer an easy way to get started.
116+
117+
118+
### Battery Replaced (Beta Only)
119+
120+
[Install blueprint](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fraw.githubusercontent.com%2Fandrew-codechimp%2FHA-Battery-Notes%2Fmain%2Fdocs%2Fblueprints%2Fbattery_notes_battery_replaced.yaml) | [Source](./blueprints/battery_notes_battery_replaced.yaml)
121+
122+
This blueprint will automatically update the battery replaced sensor and custom actions to be performed when the battery increases.
123+
It is extended from the example Battery Replaced automation yaml above for those who'd prefer an easy way to get started.
124+
125+
## Contributing
108126
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.

0 commit comments

Comments
 (0)