-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
104 lines (103 loc) · 5.12 KB
/
template.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
- sensor:
- name: "Number of hours until the Hippo's next adventure starts"
unique_id: next_hippo_departure_hrs
# note that if there is no future departures, it defaults to 25 hrs + 10 seconds to avoid floating point math issues
state: "{{(as_timestamp(states('sensor.next_hippo_departure' ), as_timestamp(now()) + 90010 ) - as_timestamp(now())) / 3600 }}"
- name: "Downstairs Temperature"
unique_id: honeywell_temp
unit_of_measurement: '°F'
state: "{{ states.climate.thermostat.attributes.current_temperature }}"
- name: "Humidity difference between bathroom and house"
unique_id: bathroom_humidity_diff
unit_of_measurement: '%'
state: "{{ states('sensor.bathroom_sensor_humidity')|float(0)|round(0) - states('sensor.home_humidity')|float(0)|round(0) | int }}"
- name: "Home Temperature"
unique_id: house_avg_temp
unit_of_measurement: '°F'
state: >-
{{ ((float(states('sensor.bedroom_temperature')) + float(states('sensor.home_temperature')) + float(states('sensor.living_room_temperature'))) / 3) | round(2) }}
- unique_id: "trevor_location"
attributes:
friendly_name: "Trevor's Location"
entity_picture: "/local/trevor.jpg"
state: >-
{% if states('sensor.trevor_ble_area') != 'unknown' and states('sensor.trevor_ble_area') != 'unavailable'%}
{{ states('sensor.trevor_ble_area') }}
{% else %}
{{ states('person.trevor').replace('not_home', 'Away').title() }}
{% endif %}
- unique_id: "emily_location"
attributes:
friendly_name: "Emily's Location"
entity_picture: "/local/emily.jpg"
state: >-
{% if states('sensor.emily_ble_area') != 'unknown' and states('sensor.emily_ble_area') != 'unavailable'%}
{{ states('sensor.emily_ble_area') }}
{% else %}
{{ states('person.emily').replace('not_home', 'Away').title() }}
{% endif %}
- trigger:
- platform: time_pattern
minutes: "/5"
- platform: homeassistant
event: start
- platform: state
entity_id: weather.kbfi_daynight
- platform: event
event_type: event_template_reloaded
action:
- service: weather.get_forecasts
data:
type: twice_daily
target:
entity_id: weather.kbfi_daynight
response_variable: daily
- service: nws.get_forecasts_extra
data:
type: twice_daily
target:
entity_id: weather.kbfi_daynight
response_variable: weather_forecast
sensor:
- name: kbfi daynight
state: "{{ states('weather.kbfi_daynight') }}"
icon: mdi:weather-cloudy
attributes:
forecast: "{{ daily['weather.kbfi_daynight'].forecast }}"
- name: kbfi daynight extra
state: "{{ states('weather.kbfi_daynight') }}"
icon: mdi:weather-cloudy
attributes:
forecast: "{{ weather_forecast['weather.kbfi_daynight'].forecast }}"
- name: "{{ as_timestamp(state_attr('sensor.kbfi_daynight', 'forecast').0.datetime) | timestamp_custom('%A') }} {{'morning' if (state_attr('sensor.kbfi_daynight', 'forecast').0.is_daytime) else 'night'}} temperature"
unique_id: temperature_0d
unit_of_measurement: '°F'
state: "{{ state_attr('sensor.kbfi_daynight', 'forecast').0.temperature }}"
- name: "{{ as_timestamp(state_attr('sensor.kbfi_daynight', 'forecast').1.datetime) | timestamp_custom('%A') }} {{'morning' if (state_attr('sensor.kbfi_daynight', 'forecast').1.is_daytime) else 'night'}} temperature"
unique_id: temperature_1d
unit_of_measurement: '°F'
state: "{{ state_attr('sensor.kbfi_daynight', 'forecast').1.temperature }}"
- name: "{{ as_timestamp(state_attr('sensor.kbfi_daynight', 'forecast').2.datetime) | timestamp_custom('%A') }} {{'morning' if (state_attr('sensor.kbfi_daynight', 'forecast').2.is_daytime) else 'night'}} temperature"
unique_id: temperature_2d
unit_of_measurement: '°F'
state: "{{ state_attr('sensor.kbfi_daynight', 'forecast').2.temperature }}"
- name: "{{ as_timestamp(state_attr('sensor.kbfi_daynight', 'forecast').3.datetime) | timestamp_custom('%A') }} {{'morning' if (state_attr('sensor.kbfi_daynight', 'forecast').3.is_daytime) else 'night'}} temperature"
unique_id: temperature_3d
unit_of_measurement: '°F'
state: "{{ state_attr('sensor.kbfi_daynight', 'forecast').3.temperature }}"
- name: "{{ as_timestamp(state_attr('sensor.kbfi_daynight', 'forecast').4.datetime) | timestamp_custom('%A') }} {{'morning' if (state_attr('sensor.kbfi_daynight', 'forecast').4.is_daytime) else 'night'}} temperature"
unique_id: temperature_4d
unit_of_measurement: '°F'
state: "{{ state_attr('sensor.kbfi_daynight', 'forecast').4.temperature }}"
- trigger:
- platform: time_pattern
minutes: "/3"
sensor:
- name: "Next time the Hippo is set to go on an adventure"
unique_id: next_hippo_departure
state: >-
{% if (integration_entities('scheduler') | select('is_state', 'on') | list | length ) > 0 %}
{{integration_entities('scheduler')| select('is_state', 'on') | map('state_attr','next_trigger') | sort | first | as_datetime }}
{%else%}
unknown
{% endif %}