Clean up some syntax in security template sensors
This commit is contained in:
@ -129,61 +129,61 @@ template:
|
|||||||
unique_id: fb4ab414-3ceb-44d2-8276-66027a936329
|
unique_id: fb4ab414-3ceb-44d2-8276-66027a936329
|
||||||
device_class: window
|
device_class: window
|
||||||
state: >
|
state: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('living_room')) |
|
| selectattr('entity_id','in',area_entities('living_room'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list | count %}
|
| list | count %}
|
||||||
{{ windows_open > 0 }}
|
{{ windows_open > 0 }}
|
||||||
attributes:
|
attributes:
|
||||||
windows_open: >
|
windows_open: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('living_room')) |
|
| selectattr('entity_id','in',area_entities('living_room'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
- name: Kitchen Windows
|
- name: Kitchen Windows
|
||||||
unique_id: 55c8c1a9-862b-4844-a34b-f44a11d1935c
|
unique_id: 55c8c1a9-862b-4844-a34b-f44a11d1935c
|
||||||
device_class: window
|
device_class: window
|
||||||
state: >
|
state: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('kitchen')) |
|
| selectattr('entity_id','in',area_entities('kitchen'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list | count %}
|
| list | count %}
|
||||||
{{ windows_open > 0 }}
|
{{ windows_open > 0 }}
|
||||||
attributes:
|
attributes:
|
||||||
windows_open: >
|
windows_open: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('kitchen')) |
|
| selectattr('entity_id','in',area_entities('kitchen'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
- name: Downstairs Bathroom Windows
|
- name: Downstairs Bathroom Windows
|
||||||
unique_id: cb3ed72e-d2a2-40f0-8db9-bc834a90f865
|
unique_id: cb3ed72e-d2a2-40f0-8db9-bc834a90f865
|
||||||
device_class: window
|
device_class: window
|
||||||
state: >
|
state: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('downstairs_bathroom')) |
|
| selectattr('entity_id','in',area_entities('downstairs_bathroom'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list | count %}
|
| list | count %}
|
||||||
{{ windows_open > 0 }}
|
{{ windows_open > 0 }}
|
||||||
attributes:
|
attributes:
|
||||||
windows_open: >
|
windows_open: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('downstairs_bathroom')) |
|
| selectattr('entity_id','in',area_entities('downstairs_bathroom'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
- name: Security Faults
|
- name: Security Faults
|
||||||
unique_id: fe4e7867-6abb-43c5-adde-67971b64cc08
|
unique_id: fe4e7867-6abb-43c5-adde-67971b64cc08
|
||||||
@ -195,11 +195,11 @@ template:
|
|||||||
- name: "Bypassed Sensors"
|
- name: "Bypassed Sensors"
|
||||||
unique_id: 612f1314-494b-40f8-8c20-d5310aa17ab4
|
unique_id: 612f1314-494b-40f8-8c20-d5310aa17ab4
|
||||||
state: >-
|
state: >-
|
||||||
{{ states.select |
|
{{ states.select
|
||||||
selectattr('state','in',['Faulted','Always']) |
|
| selectattr('state','in',['Faulted','Always'])
|
||||||
map(attribute='entity_id') |
|
| map(attribute='entity_id')
|
||||||
map('device_id') |
|
| map('device_id')
|
||||||
list }}
|
| list }}
|
||||||
- name: "Window Faults"
|
- name: "Window Faults"
|
||||||
unique_id: 79b8ffe8-3f7c-4d4e-9809-b2023da1d497
|
unique_id: 79b8ffe8-3f7c-4d4e-9809-b2023da1d497
|
||||||
unit_of_measurement: 'faults'
|
unit_of_measurement: 'faults'
|
||||||
@ -332,25 +332,25 @@ template:
|
|||||||
unique_id: 780770d2-8b5a-4c96-aee4-459281cc3471
|
unique_id: 780770d2-8b5a-4c96-aee4-459281cc3471
|
||||||
unit_of_measurement: 'open'
|
unit_of_measurement: 'open'
|
||||||
state: >-
|
state: >-
|
||||||
{% set windows = states.binary_sensor |
|
{% set windows = states.binary_sensor
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('attributes.entity_id','eq',null) |
|
| selectattr('attributes.entity_id','eq',null)
|
||||||
rejectattr('entity_id','search','windows') %}
|
| rejectattr('entity_id','search','windows') %}
|
||||||
{% set windows_open = windows |
|
{% set windows_open = windows
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
list |
|
| list
|
||||||
count %}
|
| count %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
attributes:
|
attributes:
|
||||||
open: >
|
open: >
|
||||||
{% set windows = states.binary_sensor |
|
{% set windows = states.binary_sensor
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('attributes.entity_id','eq',null) |
|
| selectattr('attributes.entity_id','eq',null)
|
||||||
rejectattr('entity_id','search','windows') %}
|
| rejectattr('entity_id','search','windows') %}
|
||||||
{% set window_names = windows |
|
{% set window_names = windows
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ window_names }}
|
{{ window_names }}
|
||||||
icon: >-
|
icon: >-
|
||||||
{% if states('sensor.windows_open') | int == 0 %}
|
{% if states('sensor.windows_open') | int == 0 %}
|
||||||
@ -374,10 +374,10 @@ template:
|
|||||||
states.binary_sensor.front_window_1,
|
states.binary_sensor.front_window_1,
|
||||||
states.binary_sensor.front_window_2
|
states.binary_sensor.front_window_2
|
||||||
] %}
|
] %}
|
||||||
{% set window_names = windows |
|
{% set window_names = windows
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ window_names }}
|
{{ window_names }}
|
||||||
icon: >-
|
icon: >-
|
||||||
{% if states('sensor.front_windows_open') | int == 0 %}
|
{% if states('sensor.front_windows_open') | int == 0 %}
|
||||||
@ -389,21 +389,21 @@ template:
|
|||||||
unique_id: d7b12353-3017-4640-b871-323425ea62d1
|
unique_id: d7b12353-3017-4640-b871-323425ea62d1
|
||||||
unit_of_measurement: 'open'
|
unit_of_measurement: 'open'
|
||||||
state: >-
|
state: >-
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('living_room')) |
|
| selectattr('entity_id','in',area_entities('living_room'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='entity_id') |
|
| map(attribute='entity_id')
|
||||||
list | count %}
|
| list | count %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
attributes:
|
attributes:
|
||||||
open: >
|
open: >
|
||||||
{% set windows_open = states.binary_sensor |
|
{% set windows_open = states.binary_sensor
|
||||||
selectattr('entity_id','in',area_entities('living_room')) |
|
| selectattr('entity_id','in',area_entities('living_room'))
|
||||||
selectattr('attributes.device_class','eq','window') |
|
| selectattr('attributes.device_class','eq','window')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='entity_id') |
|
| map(attribute='entity_id')
|
||||||
list | count %}
|
| list | count %}
|
||||||
{{ windows_open }}
|
{{ windows_open }}
|
||||||
icon: >
|
icon: >
|
||||||
{% if states('sensor.living_room_windows_open') | int == 0 %}
|
{% if states('sensor.living_room_windows_open') | int == 0 %}
|
||||||
@ -416,18 +416,18 @@ template:
|
|||||||
unit_of_measurement: 'open'
|
unit_of_measurement: 'open'
|
||||||
state: >-
|
state: >-
|
||||||
{% set doors = expand('binary_sensor.exterior_doors') %}
|
{% set doors = expand('binary_sensor.exterior_doors') %}
|
||||||
{% set doors_open = doors |
|
{% set doors_open = doors
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
list |
|
| list
|
||||||
count %}
|
| count %}
|
||||||
{{ doors_open }}
|
{{ doors_open }}
|
||||||
attributes:
|
attributes:
|
||||||
open: >
|
open: >
|
||||||
{% set doors = expand('binary_sensor.exterior_doors') %}
|
{% set doors = expand('binary_sensor.exterior_doors') %}
|
||||||
{% set door_names = doors |
|
{% set door_names = doors
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ door_names }}
|
{{ door_names }}
|
||||||
icon: >-
|
icon: >-
|
||||||
{% if states('sensor.doors_open') | int == 0 %}
|
{% if states('sensor.doors_open') | int == 0 %}
|
||||||
@ -439,29 +439,29 @@ template:
|
|||||||
unique_id: 772aa056-881a-4778-ba5b-19e46afc107a
|
unique_id: 772aa056-881a-4778-ba5b-19e46afc107a
|
||||||
unit_of_measurement: 'open'
|
unit_of_measurement: 'open'
|
||||||
state: >-
|
state: >-
|
||||||
{% set exterior = expand('binary_sensor.exterior_doors') |
|
{% set exterior = expand('binary_sensor.exterior_doors')
|
||||||
map(attribute='entity_id') |
|
| map(attribute='entity_id')
|
||||||
list %}
|
| list %}
|
||||||
{% set interior = states.binary_sensor |
|
{% set interior = states.binary_sensor
|
||||||
selectattr('attributes.device_class','eq','door') |
|
| selectattr('attributes.device_class','eq','door')
|
||||||
rejectattr('entity_id','in',exterior) |
|
| rejectattr('entity_id','in',exterior)
|
||||||
rejectattr('entity_id','eq','binary_sensor.exterior_doors') |
|
| rejectattr('entity_id','eq','binary_sensor.exterior_doors')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
list |
|
| list
|
||||||
count %}
|
| count %}
|
||||||
{{ interior }}
|
{{ interior }}
|
||||||
attributes:
|
attributes:
|
||||||
open: >
|
open: >
|
||||||
{% set exterior = expand('binary_sensor.exterior_doors') |
|
{% set exterior = expand('binary_sensor.exterior_doors')
|
||||||
map(attribute='entity_id') |
|
| map(attribute='entity_id')
|
||||||
list %}
|
| list %}
|
||||||
{% set interior = states.binary_sensor |
|
{% set interior = states.binary_sensor
|
||||||
selectattr('attributes.device_class','eq','door') |
|
| selectattr('attributes.device_class','eq','door')
|
||||||
rejectattr('entity_id','in',exterior) |
|
| rejectattr('entity_id','in',exterior)
|
||||||
rejectattr('entity_id','eq','binary_sensor.exterior_doors') |
|
| rejectattr('entity_id','eq','binary_sensor.exterior_doors')
|
||||||
selectattr('state','eq','on') |
|
| selectattr('state','eq','on')
|
||||||
map(attribute='attributes.friendly_name') |
|
| map(attribute='attributes.friendly_name')
|
||||||
list %}
|
| list %}
|
||||||
{{ interior }}
|
{{ interior }}
|
||||||
icon: >-
|
icon: >-
|
||||||
{% if states('sensor.interior_doors') | int == 0 %}
|
{% if states('sensor.interior_doors') | int == 0 %}
|
||||||
|
Reference in New Issue
Block a user