forked from basnijholt/home-assistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binary_sensors.yaml
executable file
·164 lines (144 loc) · 6.05 KB
/
binary_sensors.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
#-
# _ _
# | |__ (_)_ __ __ _ _ __ _ _ ___ ___ _ __ ___ ___ _ __ ___
# | '_ \| | '_ \ / _` | '__| | | | / __|/ _ \ '_ \/ __|/ _ \| '__/ __|
# | |_) | | | | | (_| | | | |_| | \__ \ __/ | | \__ \ (_) | | \__ \
# |_.__/|_|_| |_|\__,_|_| \__, |___|___/\___|_| |_|___/\___/|_| |___/
# |___/_____|
#
#- from github.com/basnijholt/home-assistant-config
- platform: template
sensors:
someone_showering:
friendly_name: Someone is showering
value_template: >
{% set humidity = states("sensor.humidity_bathroom") | float(0) %}
{% set treshold = 1.05 * state_attr("sensor.humidity_bathroom_stats", "median") | float(0) %}
{% set derivative = states("sensor.humidity_bathroom_derivative") | float(0) %}
{{ humidity > treshold and derivative > 0.25 }}
motion_detected:
friendly_name: Any motion detected
value_template: >
{{ is_state("binary_sensor.activity_in_kitchen", "on")
or is_state("binary_sensor.activity_in_living_room", "on")
or is_state("binary_sensor.activity_in_hall", "on")
or is_state("binary_sensor.activity_in_toilet", "on")
or is_state("binary_sensor.activity_in_bathroom", "on")
or is_state("binary_sensor.activity_in_bedroom", "on") }}
motion_detected_in_last_hour:
friendly_name: Any motion detected in last hour
value_template: >
{{ is_state("binary_sensor.motion_detected", "on") }}
delay_off: "01:00:00"
someone_in_the_house_in_last_hour:
friendly_name: Someone in the house in the last hour
value_template: >
{{ is_state("binary_sensor.motion_detected_in_last_hour", "on")
or is_state("group.persons", "home") }}
activity_in_bathroom:
friendly_name: Activity in the bathroom
value_template: >
{{ is_state("binary_sensor.motion_sensor_bathroom", "on")
or is_state("binary_sensor.someone_showering", "on") }}
delay_off: "00:03:00"
activity_in_living_room:
friendly_name: Activity in the living room
value_template: >
{{ is_state("binary_sensor.motion_sensor_living_room_klok", "on")
or is_state("media_player.tv", "on")
or is_state("media_player.kef_ls50", "on") }}
delay_off: "00:20:00"
activity_in_toilet:
friendly_name: Activity at the toilet
value_template: >
{{ is_state("binary_sensor.motion_sensor_toilet", "on") }}
delay_off: "00:01:00"
activity_in_kitchen:
friendly_name: Activity in the kitchen
value_template: >
{{ is_state("binary_sensor.motion_sensor_kitchen", "on") }}
delay_off: "00:01:00"
activity_in_hall:
friendly_name: Activity in the hall
value_template: >
{{ is_state("binary_sensor.motion_sensor_hall", "on")
or is_state("binary_sensor.openclose_front_door", "on") }}
delay_off: "00:01:00"
activity_in_bedroom:
friendly_name: Activity in the bedroom
value_template: >
{{ is_state("binary_sensor.motion_sensor_bedroom_door", "on")
or is_state("binary_sensor.motion_sensor_bedroom_kabinet", "on")
or is_state("binary_sensor.motion_sensor_bedroom_desk", "on")
or is_state("binary_sensor.vibration", "on") }}
delay_off: "00:01:00"
activity_outside_bedroom:
friendly_name: Activity outside the bedroom
value_template: >
{{ is_state("binary_sensor.activity_in_hall", "on")
or is_state("binary_sensor.activity_in_living_room", "on")
or is_state("binary_sensor.activity_in_toilet", "on")
or is_state("binary_sensor.activity_in_kitchen", "on")
or is_state("media_player.kef_ls50", "on") }}
delay_off: "00:01:00"
washing_machine:
friendly_name: Washing machine
value_template: >
{{ states("sensor.washing_machine_power") | float(0) > 3 }}
delay_off: "00:05:00"
icon_template: >
{% if is_state("binary_sensor.washing_machine", "on") %}
mdi:washing-machine
{% else %}
mdi:washing-machine-off
{% endif %}
dishwasher:
friendly_name: Dishwasher
value_template: >
{{ states("sensor.dishwasher_watts") | float(0) > 3 }}
delay_off: "00:03:00"
icon_template: >
{% if is_state("binary_sensor.dishwasher", "on") %}
mdi:dishwasher
{% else %}
mdi:dishwasher-off
{% endif %}
worked_enough_today:
friendly_name: Worked enough today
value_template: >
{{ states("sensor.time_at_work_today") | float(0) > 8 }}
icon_template: mdi:briefcase
any_light_on:
friendly_name: Any light is on
value_template: >
{% set automatic_lights_on = is_state("light.automatic_lights", "on") %}
{% set bedroom_lights_on = is_state("light.bedroom_lights", "on") %}
{% set living_room_lights_on = is_state("light.living_room_lights", "on") %}
{{ automatic_lights_on or bedroom_lights_on or living_room_lights_on }}
anything_on:
friendly_name: Anything is on
value_template: >
{% set light_on = is_state("binary_sensor.any_light_on", "on") %}
{% set tv_on = is_state("media_player.tv", "on") %}
{% set kef_on = is_state("media_player.kef_ls50", "on") %}
{% set kef_lsx_on = is_state("media_player.kef_lsx", "on") %}
{{ light_on or tv_on or kef_on or kef_lsx_on }}
vacuum_day:
# XXX: was '("Mon", "Wed", "Sun")' pre-corona because now we're mostly at home
friendly_name: Vacuum day today
value_template: >
{{ as_timestamp(now()) | timestamp_custom("%a") in ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") }}
no_one_home:
friendly_name: No one is home
value_template: >
{{ not is_state("person.bas", "home")
and not is_state("person.marcella", "home") }}
- platform: workday
country: NL
- platform: trend
sensors:
humidity_bathroom_trend:
entity_id: sensor.humidity_bathroom
sample_duration: 300
max_samples: 3