Move template sensors to template key #109
This commit is contained in:
@ -151,192 +151,6 @@ binary_sensor:
|
|||||||
prob_given_true: 0.99
|
prob_given_true: 0.99
|
||||||
prob_given_false: 0.01
|
prob_given_false: 0.01
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: template
|
|
||||||
sensors:
|
|
||||||
adults_home_fix:
|
|
||||||
friendly_name: "Adults Home Fix"
|
|
||||||
unique_id: c63364fb-c3cb-44a6-8fba-5d63e3f9c981
|
|
||||||
value_template: >
|
|
||||||
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
|
|
||||||
broken
|
|
||||||
{% elif is_state('group.adults','home') %}
|
|
||||||
home
|
|
||||||
{% elif is_state('group.adults','not_home') %}
|
|
||||||
not_home
|
|
||||||
{% endif %}
|
|
||||||
icon_template: >
|
|
||||||
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
|
|
||||||
mdi:alert-circle
|
|
||||||
{% elif is_state('group.adults','home') %}
|
|
||||||
mdi:home
|
|
||||||
{% elif is_state('group.adults','not_home') %}
|
|
||||||
mdi:home-outline
|
|
||||||
{% endif %}
|
|
||||||
family_home_fix:
|
|
||||||
friendly_name: "Family Home Fix"
|
|
||||||
unique_id: f27a1a56-0c7e-46ee-9f21-a48cc1a0421c
|
|
||||||
value_template: >
|
|
||||||
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
|
|
||||||
broken
|
|
||||||
{% elif is_state('group.family','home') %}
|
|
||||||
home
|
|
||||||
{% elif is_state('group.family','not_home') %}
|
|
||||||
not_home
|
|
||||||
{% endif %}
|
|
||||||
icon_template: >
|
|
||||||
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
|
|
||||||
mdi:alert-circle
|
|
||||||
{% elif is_state('group.family','home') %}
|
|
||||||
mdi:home
|
|
||||||
{% elif is_state('group.family','not_home') %}
|
|
||||||
mdi:home-outline
|
|
||||||
{% endif %}
|
|
||||||
tony_location:
|
|
||||||
friendly_name: "Tony"
|
|
||||||
unique_id: 2620a9d0-01f0-4af4-8438-a0c860735aab
|
|
||||||
value_template: >-
|
|
||||||
{% set person = states.person.tony_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
Home
|
|
||||||
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
|
||||||
Grocery Store
|
|
||||||
{% elif person in ['Rite Aid'] %}
|
|
||||||
Pharmacy
|
|
||||||
{% else %}
|
|
||||||
{% if person in ['not_home','Stationary'] %}
|
|
||||||
{{ state_attr('device_tracker.life360_tony_stork','address') }}
|
|
||||||
{% else %}
|
|
||||||
{{ states('person.tony_stork') }}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
icon_template: >-
|
|
||||||
{% set person = states.person.tony_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
mdi:home
|
|
||||||
{% else %}
|
|
||||||
mdi:car
|
|
||||||
{% endif %}
|
|
||||||
tina_location:
|
|
||||||
friendly_name: "Tina"
|
|
||||||
unique_id: 5439165c-f73e-4870-826a-d12c99e35487
|
|
||||||
value_template: >-
|
|
||||||
{% set person = states.person.christina_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
Home
|
|
||||||
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
|
||||||
Grocery Store
|
|
||||||
{% elif person in ['Rite Aid'] %}
|
|
||||||
Pharmacy
|
|
||||||
{% elif person in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %}
|
|
||||||
Work
|
|
||||||
{% else %}
|
|
||||||
{% if person in ['not_home','Stationary'] %}
|
|
||||||
{{ state_attr('device_tracker.life360_christina_stork','address') }}
|
|
||||||
{% else %}
|
|
||||||
{{ states('person.christina_stork') }}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
icon_template: >-
|
|
||||||
{% set person = states.person.christina_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
mdi:home
|
|
||||||
{% else %}
|
|
||||||
mdi:car
|
|
||||||
{% endif %}
|
|
||||||
kallen_location:
|
|
||||||
friendly_name: "Kallen"
|
|
||||||
unique_id: d4b4c324-52aa-41e4-b446-8ba0d6b45cd3
|
|
||||||
value_template: >-
|
|
||||||
{% set person = states.person.kallen_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
Home
|
|
||||||
{% elif person in ['School','Middle School','High School'] %}
|
|
||||||
School
|
|
||||||
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
|
||||||
Grocery Store
|
|
||||||
{% elif person in ['Rite Aid'] %}
|
|
||||||
Pharmacy
|
|
||||||
{% else %}
|
|
||||||
{% if person in ['not_home','Stationary'] %}
|
|
||||||
{{ state_attr('device_tracker.life360_kallen_stork','address') }}
|
|
||||||
{% else %}
|
|
||||||
{{ states('person.kallen_stork') }}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
icon_template: >-
|
|
||||||
{% set person = states.person.kallen_stork.state %}
|
|
||||||
{% if person in ['Home','home'] %}
|
|
||||||
mdi:home
|
|
||||||
{% else %}
|
|
||||||
mdi:car
|
|
||||||
{% endif %}
|
|
||||||
people_home:
|
|
||||||
friendly_name: "People"
|
|
||||||
unique_id: 053d3a0a-f5b4-48e0-a8df-4d847d0fe9c3
|
|
||||||
unit_of_measurement: 'home'
|
|
||||||
value_template: >-
|
|
||||||
{{ states['person'] | selectattr('state','eq','home') | list | count }}
|
|
||||||
people_away:
|
|
||||||
friendly_name: "People"
|
|
||||||
unique_id: e46e51a6-3c57-4599-840b-fca6884f867e
|
|
||||||
unit_of_measurement: 'away'
|
|
||||||
value_template: >-
|
|
||||||
{% set people = [
|
|
||||||
states.person.tony_stork,
|
|
||||||
states.person.christina_stork,
|
|
||||||
states.person.kallen_stork,
|
|
||||||
] %}
|
|
||||||
{{ people | selectattr('state','ne','home') | list | count }}
|
|
||||||
front_door_opened_today:
|
|
||||||
friendly_name: "Front Door Opened Today"
|
|
||||||
unique_id: 6a8bb32e-5f4e-4d1f-8e17-77f07e5b174a
|
|
||||||
unit_of_measurement: 'times'
|
|
||||||
value_template: >-
|
|
||||||
{{ states('input_number.front_door_opened_today') | int }}
|
|
||||||
icon_template: >-
|
|
||||||
{% if states('input_number.front_door_opened_today') | int > 0 %}
|
|
||||||
mdi:door-open
|
|
||||||
{% else %}
|
|
||||||
mdi:door-closed
|
|
||||||
{% endif %}
|
|
||||||
back_door_opened_today:
|
|
||||||
friendly_name: "Back Door Opened Today"
|
|
||||||
unique_id: 77786cc9-64de-4035-a635-e831a3b0ef63
|
|
||||||
unit_of_measurement: 'times'
|
|
||||||
value_template: >-
|
|
||||||
{{ states('input_number.back_door_opened_today') | int }}
|
|
||||||
icon_template: >-
|
|
||||||
{% if states('input_number.back_door_opened_today') | int > 0 %}
|
|
||||||
mdi:door-open
|
|
||||||
{% else %}
|
|
||||||
mdi:door-closed
|
|
||||||
{% endif %}
|
|
||||||
basement_studio_door_opened_today:
|
|
||||||
friendly_name: "Basement Studio Door Opened Today"
|
|
||||||
unique_id: 3d74efd0-2df5-438e-a015-26ac1ce2c4ee
|
|
||||||
unit_of_measurement: 'times'
|
|
||||||
value_template: >-
|
|
||||||
{{ states('input_number.basement_studio_door_opened_today') | int }}
|
|
||||||
icon_template: >-
|
|
||||||
{% if states('input_number.basement_studio_door_opened_today') | int > 0 %}
|
|
||||||
mdi:door-open
|
|
||||||
{% else %}
|
|
||||||
mdi:door-closed
|
|
||||||
{% endif %}
|
|
||||||
downstairs_bathroom_door_opened_today:
|
|
||||||
friendly_name: "Downstairs Bathroom Door Opened Today"
|
|
||||||
unique_id: cdc850bc-3747-405d-8b16-3b79ba9fbc87
|
|
||||||
unit_of_measurement: 'times'
|
|
||||||
value_template: >-
|
|
||||||
{{ states('input_number.downstairs_bathroom_door_opened_today') | int }}
|
|
||||||
icon_template: >-
|
|
||||||
{% if states('input_number.downstairs_bathroom_door_opened_today') | int > 0 %}
|
|
||||||
mdi:door-open
|
|
||||||
{% else %}
|
|
||||||
mdi:door-closed
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
template:
|
template:
|
||||||
- binary_sensor:
|
- binary_sensor:
|
||||||
- name: "Tony Home"
|
- name: "Tony Home"
|
||||||
@ -435,6 +249,177 @@ template:
|
|||||||
{{ sleeping | selectattr('state','eq','on') | list | count }}
|
{{ sleeping | selectattr('state','eq','on') | list | count }}
|
||||||
unit_of_measurement: ''
|
unit_of_measurement: ''
|
||||||
icon: mdi:sleep
|
icon: mdi:sleep
|
||||||
|
- unique_id: c63364fb-c3cb-44a6-8fba-5d63e3f9c981
|
||||||
|
name: "Adults Home Fix"
|
||||||
|
state: >
|
||||||
|
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
|
||||||
|
broken
|
||||||
|
{% elif is_state('group.adults','home') %}
|
||||||
|
home
|
||||||
|
{% elif is_state('group.adults','not_home') %}
|
||||||
|
not_home
|
||||||
|
{% endif %}
|
||||||
|
icon: >
|
||||||
|
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] %}
|
||||||
|
mdi:alert-circle
|
||||||
|
{% elif is_state('group.adults','home') %}
|
||||||
|
mdi:home
|
||||||
|
{% elif is_state('group.adults','not_home') %}
|
||||||
|
mdi:home-outline
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: f27a1a56-0c7e-46ee-9f21-a48cc1a0421c
|
||||||
|
name: "Family Home Fix"
|
||||||
|
state: >
|
||||||
|
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
|
||||||
|
broken
|
||||||
|
{% elif is_state('group.family','home') %}
|
||||||
|
home
|
||||||
|
{% elif is_state('group.family','not_home') %}
|
||||||
|
not_home
|
||||||
|
{% endif %}
|
||||||
|
icon: >
|
||||||
|
{% if states('person.tony_stork') in ['unknown','unavailable'] or states('person.christina_stork') in ['unknown','unavailable'] or states('person.kallen_stork') in ['unknown','unavailable'] %}
|
||||||
|
mdi:alert-circle
|
||||||
|
{% elif is_state('group.family','home') %}
|
||||||
|
mdi:home
|
||||||
|
{% elif is_state('group.family','not_home') %}
|
||||||
|
mdi:home-outline
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: 2620a9d0-01f0-4af4-8438-a0c860735aab
|
||||||
|
name: "Tony"
|
||||||
|
state: >-
|
||||||
|
{% set person = states.person.tony_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
Home
|
||||||
|
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
||||||
|
Grocery Store
|
||||||
|
{% elif person in ['Rite Aid'] %}
|
||||||
|
Pharmacy
|
||||||
|
{% else %}
|
||||||
|
{% if person in ['not_home','Stationary'] %}
|
||||||
|
{{ state_attr('device_tracker.life360_tony_stork','address') }}
|
||||||
|
{% else %}
|
||||||
|
{{ states('person.tony_stork') }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
icon: >-
|
||||||
|
{% set person = states.person.tony_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
mdi:home
|
||||||
|
{% else %}
|
||||||
|
mdi:car
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: 5439165c-f73e-4870-826a-d12c99e35487
|
||||||
|
name: "Tina"
|
||||||
|
state: >-
|
||||||
|
{% set person = states.person.christina_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
Home
|
||||||
|
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
||||||
|
Grocery Store
|
||||||
|
{% elif person in ['Rite Aid'] %}
|
||||||
|
Pharmacy
|
||||||
|
{% elif person in ['Bob Evans','BobEvans'] and is_state('input_boolean.work_today','on') %}
|
||||||
|
Work
|
||||||
|
{% else %}
|
||||||
|
{% if person in ['not_home','Stationary'] %}
|
||||||
|
{{ state_attr('device_tracker.life360_christina_stork','address') }}
|
||||||
|
{% else %}
|
||||||
|
{{ states('person.christina_stork') }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
icon: >-
|
||||||
|
{% set person = states.person.christina_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
mdi:home
|
||||||
|
{% else %}
|
||||||
|
mdi:car
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: d4b4c324-52aa-41e4-b446-8ba0d6b45cd3
|
||||||
|
name: "Kallen"
|
||||||
|
state: >-
|
||||||
|
{% set person = states.person.kallen_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
Home
|
||||||
|
{% elif person in ['School','Middle School','High School'] %}
|
||||||
|
School
|
||||||
|
{% elif person in ['WalMart','Wal-Mart','Kroger','Chief','Meijer','Dollar General - Clinton St','Aldi'] %}
|
||||||
|
Grocery Store
|
||||||
|
{% elif person in ['Rite Aid'] %}
|
||||||
|
Pharmacy
|
||||||
|
{% else %}
|
||||||
|
{% if person in ['not_home','Stationary'] %}
|
||||||
|
{{ state_attr('device_tracker.life360_kallen_stork','address') }}
|
||||||
|
{% else %}
|
||||||
|
{{ states('person.kallen_stork') }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
icon: >-
|
||||||
|
{% set person = states.person.kallen_stork.state %}
|
||||||
|
{% if person in ['Home','home'] %}
|
||||||
|
mdi:home
|
||||||
|
{% else %}
|
||||||
|
mdi:car
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: 053d3a0a-f5b4-48e0-a8df-4d847d0fe9c3
|
||||||
|
name: "People"
|
||||||
|
unit_of_measurement: 'home'
|
||||||
|
state: >-
|
||||||
|
{{ states['person'] | selectattr('state','eq','home') | list | count }}
|
||||||
|
- unique_id: e46e51a6-3c57-4599-840b-fca6884f867e
|
||||||
|
name: "People"
|
||||||
|
unit_of_measurement: 'away'
|
||||||
|
state: >-
|
||||||
|
{% set people = [
|
||||||
|
states.person.tony_stork,
|
||||||
|
states.person.christina_stork,
|
||||||
|
states.person.kallen_stork,
|
||||||
|
] %}
|
||||||
|
{{ people | selectattr('state','ne','home') | list | count }}
|
||||||
|
- unique_id: 6a8bb32e-5f4e-4d1f-8e17-77f07e5b174a
|
||||||
|
name: "Front Door Opened Today"
|
||||||
|
unit_of_measurement: 'times'
|
||||||
|
state: >-
|
||||||
|
{{ states('input_number.front_door_opened_today') | int }}
|
||||||
|
icon: >-
|
||||||
|
{% if states('input_number.front_door_opened_today') | int > 0 %}
|
||||||
|
mdi:door-open
|
||||||
|
{% else %}
|
||||||
|
mdi:door-closed
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: 77786cc9-64de-4035-a635-e831a3b0ef63
|
||||||
|
name: "Back Door Opened Today"
|
||||||
|
unit_of_measurement: 'times'
|
||||||
|
state: >-
|
||||||
|
{{ states('input_number.back_door_opened_today') | int }}
|
||||||
|
icon: >-
|
||||||
|
{% if states('input_number.back_door_opened_today') | int > 0 %}
|
||||||
|
mdi:door-open
|
||||||
|
{% else %}
|
||||||
|
mdi:door-closed
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: 3d74efd0-2df5-438e-a015-26ac1ce2c4ee
|
||||||
|
name: "Basement Studio Door Opened Today"
|
||||||
|
unit_of_measurement: 'times'
|
||||||
|
state: >-
|
||||||
|
{{ states('input_number.basement_studio_door_opened_today') | int }}
|
||||||
|
icon: >-
|
||||||
|
{% if states('input_number.basement_studio_door_opened_today') | int > 0 %}
|
||||||
|
mdi:door-open
|
||||||
|
{% else %}
|
||||||
|
mdi:door-closed
|
||||||
|
{% endif %}
|
||||||
|
- unique_id: cdc850bc-3747-405d-8b16-3b79ba9fbc87
|
||||||
|
name: "Downstairs Bathroom Door Opened Today"
|
||||||
|
unit_of_measurement: 'times'
|
||||||
|
state: >-
|
||||||
|
{{ states('input_number.downstairs_bathroom_door_opened_today') | int }}
|
||||||
|
icon: >-
|
||||||
|
{% if states('input_number.downstairs_bathroom_door_opened_today') | int > 0 %}
|
||||||
|
mdi:door-open
|
||||||
|
{% else %}
|
||||||
|
mdi:door-closed
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
sensor:
|
sensor:
|
||||||
|
Reference in New Issue
Block a user