Skip to content

Commit

Permalink
damn parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmartin committed Dec 3, 2020
1 parent 7cf5c39 commit 7d6634d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 217 deletions.
20 changes: 10 additions & 10 deletions homeassistant/motion/automation.webcam.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1784,12 +1784,12 @@
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected-${MOTION_CAMERA}'
+ '.jpg?e='
+ states('sensor.motion_detected_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_event_${MOTION_CAMERA}')
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animated-${MOTION_CAMERA}'
+ '.gif?e='
+ states('sensor.motion_detected_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_event_${MOTION_CAMERA}')
+ ')' }}
Camera ${MOTION_CAMERA} detected {{ states('sensor.motion_detected_count_${MOTION_CAMERA}') -}}:
{{ states('sensor.motion_detected_list_${MOTION_CAMERA}') -}};
Expand Down Expand Up @@ -1834,12 +1834,12 @@
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_entity-${MOTION_CAMERA}'
+ '.jpg?e='
+ states('sensor.motion_detected_entity_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_entity_event_${MOTION_CAMERA}')
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_entity_animated-${MOTION_CAMERA}'
+ '.gif?e='
+ states('sensor.motion_detected_entity_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_entity_event_${MOTION_CAMERA}')
+ ')' }}
Camera ${MOTION_CAMERA} detected {{ states('sensor.motion_detected_entity_count_${MOTION_CAMERA}') }} entity(s)
for {{ states('sensor.motion_detected_entity_elapsed_${MOTION_CAMERA}') }} seconds
Expand Down Expand Up @@ -1883,12 +1883,12 @@
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_person-${MOTION_CAMERA}'
+ '.jpg?e='
+ states('sensor.motion_detected_person_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_person_event_${MOTION_CAMERA}')
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_person_animated-${MOTION_CAMERA}'
+ '.gif?e='
+ states('sensor.motion_detected_person_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_person_event_${MOTION_CAMERA}')
+ ')' }}
Camera ${MOTION_CAMERA} detected {{ states('sensor.motion_detected_person_count_${MOTION_CAMERA}') }} person(s)
for {{ states('sensor.motion_detected_person_elapsed_${MOTION_CAMERA}') }} seconds
Expand Down Expand Up @@ -1932,12 +1932,12 @@
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_vehicle-${MOTION_CAMERA}'
+ '.jpg?e='
+ states('sensor.motion_detected_vehicle_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_vehicle_event_${MOTION_CAMERA}')
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_vehicle_animated-${MOTION_CAMERA}'
+ '.gif?e='
+ states('sensor.motion_detected_vehicle_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_vehicle_event_${MOTION_CAMERA}')
+ ')' }}
Camera ${MOTION_CAMERA} detected {{ states('sensor.motion_detected_vehicle_count_${MOTION_CAMERA}') }} vehicle(s)
for {{ states('sensor.motion_detected_vehicle_elapsed_${MOTION_CAMERA}') }} seconds
Expand Down Expand Up @@ -1981,12 +1981,12 @@
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animal-${MOTION_CAMERA}'
+ '.jpg?e='
+ states('sensor.motion_detected_animal_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_animal_event_${MOTION_CAMERA}')
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animal_animated-${MOTION_CAMERA}'
+ '.gif?e='
+ states('sensor.motion_detected_animal_event_${MOTION_CAMERA}'
+ states('sensor.motion_detected_animal_event_${MOTION_CAMERA}')
+ ')' }}
Camera ${MOTION_CAMERA} detected {{ states('sensor.motion_detected_animal_count_${MOTION_CAMERA}') }} animal(s)
for {{ states('sensor.motion_detected_animal_elapsed_${MOTION_CAMERA}') }} seconds
Expand Down
128 changes: 0 additions & 128 deletions homeassistant/motion/sensor.webcam.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -541,27 +541,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_annotated_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} entity device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_annotated_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_annotated_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_annotated_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}

## when
- platform: template
sensors:
Expand Down Expand Up @@ -853,27 +832,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} entity device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_detected_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_detected_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_detected_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}

## when
- platform: template
sensors:
Expand Down Expand Up @@ -1184,27 +1142,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_entity_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} entity device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_detected_entity_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_detected_entity_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_detected_entity_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}

## when - human readable
- platform: template
sensors:
Expand Down Expand Up @@ -1587,27 +1524,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_person_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} person device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_detected_person_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_detected_person_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_detected_person_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_person_camera_${MOTION_CAMERA}:
Expand Down Expand Up @@ -2143,28 +2059,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_vehicle_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} vehicle device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_detected_vehicle_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_detected_vehicle_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_detected_vehicle_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}


- platform: template
sensors:
motion_detected_vehicle_camera_${MOTION_CAMERA}:
Expand Down Expand Up @@ -2700,28 +2594,6 @@
{% else %}null{% endif %}
{% endif %}

- platform: template
sensors:
motion_detected_animal_device_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} animal device
icon_template: 'mdi:raspberry-pi'
value_template: >
{% if is_state('binary_sensor.motion_detected_animal_${MOTION_CAMERA}','on') and is_state('binary_sensor.motion_detected_animal_old_${MOTION_CAMERA}','off') %}
{% set s = state_attr('sensor.motion_event_annotated_${MOTION_CAMERA}','event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states('sensor.motion_detected_animal_device_${MOTION_CAMERA}') %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}


- platform: template
sensors:
motion_detected_animal_camera_${MOTION_CAMERA}:
Expand Down
95 changes: 16 additions & 79 deletions homeassistant/sensor/motion/selected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,89 +93,26 @@

- platform: template
sensors:
motion_camera_selected_annotated_device:
friendly_name: Annotation at
icon_template: 'mdi:calendar-clock'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_annotated_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
motion_camera_selected_detected_device:
friendly_name: Detection at
icon_template: 'mdi:calendar-clock'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_detected_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
motion_camera_selected_detected_entity_device:
friendly_name: Entity detection at
icon_template: 'mdi:eye'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_detected_entity_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
motion_camera_selected_detected_person_device:
friendly_name: Person detection at
icon_template: 'mdi:account'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_detected_person_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
motion_camera_selected_detected_vehicle_device:
friendly_name: Vehicle detection at
icon_template: 'mdi:car'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_detected_vehicle_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
motion_camera_selected_detected_animal_device:
friendly_name: Animal detection at
icon_template: 'mdi:cow'
motion_camera_selected_device:
friendly_name: Camera device
icon_template: 'mdi:raspberry-pi'
value_template: >-
{% set c = states('sensor.motion_camera_name_selected') %}
{% if c|lower != 'none' and c|lower != 'null' and c|lower != 'unavailable' and c|lower != 'unknown' %}
{% set ep = states('sensor.motion_detected_animal_device_' + c) %}
{% if ep|lower != 'none' and ep|lower != 'null' and ep|lower != 'unknown' and ep|lower != 'unavailable' %}
{% set p = ep %}
{% if is_state('binary_sensor.motion_detected_' + c,'on') and is_state('binary_sensor.motion_detected_old_' + c,'off') %}
{% set s = state_attr('sensor.motion_event_annotated_' + c,'event') %}
{% if s is not none and s is mapping %}
{% set p = s.device %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}
{% set s = states.sensor.motion_camera_selected_device.state %}
{% if s is not none and s|lower != 'unavailable' and s|lower != 'unknown' and s|lower != 'none' %}
{{ s }}
{% else %}null{% endif %}
{% endif %}
{% endif %}
{% if p is defined %}
{{ p }}
{% else %}Pending{% endif %}
## when
Expand Down

0 comments on commit 7d6634d

Please sign in to comment.