From 7d6634dbdc96c079b826c9a53d4468d77945d5eb Mon Sep 17 00:00:00 2001 From: dcmartin Date: Wed, 2 Dec 2020 16:23:16 -0800 Subject: [PATCH] damn parentheses --- .../motion/automation.webcam.yaml.tmpl | 20 +-- homeassistant/motion/sensor.webcam.yaml.tmpl | 128 ------------------ homeassistant/sensor/motion/selected.yaml | 95 +++---------- 3 files changed, 26 insertions(+), 217 deletions(-) diff --git a/homeassistant/motion/automation.webcam.yaml.tmpl b/homeassistant/motion/automation.webcam.yaml.tmpl index 16007473c..aa5532526 100644 --- a/homeassistant/motion/automation.webcam.yaml.tmpl +++ b/homeassistant/motion/automation.webcam.yaml.tmpl @@ -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}') -}}; @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/homeassistant/motion/sensor.webcam.yaml.tmpl b/homeassistant/motion/sensor.webcam.yaml.tmpl index a6c444494..f40396328 100644 --- a/homeassistant/motion/sensor.webcam.yaml.tmpl +++ b/homeassistant/motion/sensor.webcam.yaml.tmpl @@ -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: @@ -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: @@ -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: @@ -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}: @@ -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}: @@ -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}: diff --git a/homeassistant/sensor/motion/selected.yaml b/homeassistant/sensor/motion/selected.yaml index 9236df9cc..ab09aa694 100644 --- a/homeassistant/sensor/motion/selected.yaml +++ b/homeassistant/sensor/motion/selected.yaml @@ -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