forked from apollo1220/blueprints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone_charger.yaml
70 lines (70 loc) · 2.02 KB
/
phone_charger.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
blueprint:
name: Charge phone
description: Charges phone until a percentage and then turns off until percentage
drops below a defined point.
domain: automation
input:
phone_battery:
name: Phone Battery level
description: This sensor will be used to determine the charge level of the phone
selector:
entity:
domain: sensor
device_class: battery
phone_charger:
name: Phone Charger
description: Entity that controls supplying power to the phone
selector:
target:
entity:
domain: switch
low_battery:
name: Low Battery
description: Battery below which the phone should be charged
selector:
number:
min: 10.0
max: 95.0
unit_of_measurement: percentage
mode: slider
step: 1.0
charged_battery:
name: Charged Battery
description: Battery above which the phone should stop charging (should be greater
then Low Battery)
selector:
number:
min: 80.0
max: 100.0
unit_of_measurement: percentage
mode: slider
step: 1.0
source_url: https://github.com/apollo1220/blueprints/blob/main/phone_charger.yaml
mode: single
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: !input 'phone_battery'
below: !input 'low_battery'
- platform: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
sequence:
- service: homeassistant.turn_off
target: !input 'phone_charger'
default:
- service: homeassistant.turn_on
target: !input 'phone_charger'
- wait_for_trigger:
- platform: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
continue_on_timeout: false
- service: homeassistant.turn_off
target: !input 'phone_charger'