forked from sibbl/hass-lovelace-kindle-screensaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbattery_sensor_blueprint.yaml
44 lines (43 loc) · 1.25 KB
/
battery_sensor_blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
blueprint:
name: Kindle Screensaver Battery Level
domain: automation
input:
webhook_id:
name: Webhook ID
description: Unique and secret ID of ID to use for webhook. It's recommended to run `openssl rand -hex 16` to generate something random.
default: set_kindle_battery_level
local_only:
name: Only allow connections from the local network
selector:
boolean:
default: true
battery_level:
name: Entity to save battery level in
description: Please create a new helper entity first.
selector:
entity:
domain: input_number
battery_charging:
name: Entity to save battery charging state in
description: Please create a new helper entity first.
selector:
entity:
domain: input_boolean
trigger:
- platform: webhook
webhook_id: !input webhook_id
local_only: !input local_only
action:
- service: input_number.set_value
target:
entity_id: !input battery_level
data:
value: "{{ trigger.json.batteryLevel }}"
- service_template: >-
{% if trigger.json.isCharging %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
target:
entity_id: !input battery_charging