-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbinary_sensors.yaml
96 lines (90 loc) · 4 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
- platform: template
sensors:
danny_home:
friendly_name: "Danny Home"
device_class: presence
value_template: "{{ states('sensor.danny_bedroom') |int(50) > 50 or states('sensor.danny_den') | int(50) > 50 }}"
tosh_home:
friendly_name: "Tosh Home"
device_class: presence
value_template: "{{ states('sensor.tosh_bedroom') |int(50) > 50 or states('sensor.tosh_den') | int(50) > 50 }}"
danny_sleep_tracking:
friendly_name: "Danny Sleep Tracking"
value_template: "{{ is_state('input_boolean.danny_sleep', 'on') }}"
tosh_sleep_tracking:
friendly_name: "Tosh Sleep Tracking"
value_template: "{{ is_state('input_boolean.tosh_sleep', 'on') }}"
windows:
friendly_name: "Windows"
device_class: window
value_template: >-
{{ is_state('binary_sensor.bathroom_window', 'on')
or is_state('binary_sensor.bedroom_window', 'on')
or is_state('binary_sensor.den_window', 'on')
or is_state('binary_sensor.kitchen_window', 'on')
or is_state('binary_sensor.living_room_left_bay_window', 'on')
or is_state('binary_sensor.living_room_right_bay_window', 'on')
or is_state('binary_sensor.living_room_side_window', 'on')
or is_state('binary_sensor.ollies_window', 'on') }}
precipitation_outlook:
friendly_name: "Precipitation Outlook"
value_template: "{{ state_attr('weather.kvny_hourly', 'forecast') is search('rainy') or state_attr('weather.kvny_hourly', 'forecast') is search('snowy') }}"
#icon_template: "{{ 'mdi:water' if state_attr('binary_sensor.percipitation_outlook', 'friendly_message') is search('Rain') 'mdi:snowflake' if state_attr('binary_sensor.percipitation_outlook', 'friendly_message') is search('Snow') else 'mdi:weather-sunny' }}"
attribute_templates:
friendly_message: >
{% set ns = namespace(rain_expected = 'False') %}
{% for forecast in state_attr('weather.kvny_hourly', 'forecast') %}
{% if ns.rain_expected == 'False' %}
{% if forecast.condition is search("rainy") %}
{% set ns.rain_expected = 'True' %}
Rain {{ "in " ~ loop.index0 ~ " hours" if loop.index0 > 1 else "soon" }},
{{ "light" if forecast.precipitation_probability < 11 else "moderate" if forecast.precipitation_probability < 31 else "heavy" }}
{% elif forecast.condition is search("snowy") %}
{% set ns.rain_expected = 'True' %}
Snow {{ "in " ~ loop.index0 ~ " hours" if loop.index0 > 1 else "soon" }}, {{forecast.precipitation_probability}} inches
{% endif %}
{% endif %}
{% endfor %}
{% if ns.rain_expected == 'False' %}
Precipitation not expected
{% endif %}
- platform: bayesian
prior: 0.6
name: "Dannys Bayesian Presence"
probability_threshold: 0.82
observations:
# - entity_id: 'device_tracker.nmap_tracker_ba_44_87_65_78_c2'
# prob_given_true: 0.99
# prob_given_false: 0.3
# platform: 'state'
# to_state: 'home'
- entity_id: 'device_tracker.dannys_pixel_8_pro'
prob_given_true: 0.9
prob_given_false: 0.3
platform: 'state'
to_state: 'home'
- entity_id: 'sensor.dannys_pixel_8_pro_wifi_connection'
prob_given_false: 0.2
prob_given_true: 0.99
platform: 'state'
to_state: 'shakuyi-5G'
- platform: bayesian
prior: 0.6
name: "Natachas Bayesian Presence"
probability_threshold: 0.82
observations:
# - entity_id: 'device_tracker.nmap_tracker_f0_5c_77_ce_45_5b'
# prob_given_true: 0.99
# prob_given_false: 0.3
# platform: 'state'
# to_state: 'home'
- entity_id: 'device_tracker.toshs_pixel_7_pro'
prob_given_true: 0.9
prob_given_false: 0.3
platform: 'state'
to_state: 'home'
- entity_id: 'sensor.toshs_pixel_7_pro_wifi_connection'
prob_given_false: 0.2
prob_given_true: 0.99
platform: 'state'
to_state: 'shakuyi-5G'