This repository has been archived by the owner on Apr 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
leaf-automations.yaml
82 lines (78 loc) · 2.1 KB
/
leaf-automations.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
71
72
73
74
75
76
77
78
79
80
81
82
# trigger when house power exceeds 6kW in the early morning (cheap tariff)
# of course, you'll need the power sensor set up...
- alias: LEAF refresh on suspected charge start
trigger:
- platform: numeric_state
entity_id: sensor.power_meter_house
above: 6
for:
minutes: 2
condition:
condition: time
before: "05:00:00"
action:
- service: switch.toggle
entity_id: switch.leaf_refresh
- delay: 60
- service: switch.toggle
entity_id: switch.leaf_refresh
# Trigger for frequent updates when charging
- alias: LEAF refresh while charging
trigger:
# the 'for' is to avoid a race condition between the new values
# for last_updated and leaf_charging...
- platform: state
entity_id: sensor.leaf_last_updated
for:
seconds: 60
condition:
condition: state
entity_id: binary_sensor.leaf_charging
state: 'on'
action:
- delay: 240
- service: switch.toggle
entity_id: switch.leaf_refresh
- alias: LEAF refresh on climate start
trigger:
- platform: state
entity_id: switch.leaf_climate_control
condition: []
action:
- service: switch.toggle
entity_id: switch.leaf_refresh
- delay: 60
- service: switch.toggle
entity_id: switch.leaf_refresh
# Trigger when climate turned on from Home Assistant
- alias: LEAF refresh while climate running
trigger:
- platform: state
entity_id: sensor.leaf_last_updated
condition:
condition: state
entity_id: binary_sensor.leaf_hvac_running
state: 'on'
action:
- delay: 300
- service: switch.toggle
entity_id: switch.leaf_refresh
# Trigger when someone gets home, possibly in the car
# You'll need to set up person tracking and update names
- alias: LEAF refresh on return home
trigger:
- platform: state
entity_id:
- person.driver1
- person.driver2
from: 'not_home'
to: 'home'
for:
minutes: 1
condition: []
action:
- service: switch.toggle
entity_id: switch.leaf_refresh
- delay: 60
- service: switch.toggle
entity_id: switch.leaf_refresh