diff --git a/blueprints/automation/wd-close-weather-notification.yaml b/blueprints/automation/wd-close-weather-notification.yaml index 1f6f6ed..24f1fd0 100644 --- a/blueprints/automation/wd-close-weather-notification.yaml +++ b/blueprints/automation/wd-close-weather-notification.yaml @@ -55,9 +55,11 @@ blueprint: default: "{{ entity_name }} is open! Trigger: {{ trigger_state }}" selector: text: {} + trigger: - platform: state entity_id: !input weather_sensor + # Cannot split in trigger, so we use a single state to: !input weather_trigger_states - platform: numeric_state entity_id: !input temperature_sensor @@ -65,15 +67,20 @@ trigger: - platform: numeric_state entity_id: !input temperature_sensor below: !input temp_below + condition: - condition: state entity_id: !input openings state: 'on' + action: - variables: + selected_openings: !input openings + message_template: !input custom_message + notify_service_name: !input notify_service open_entities: > {{ states - | selectattr('entity_id','in', !input openings) + | selectattr('entity_id','in', selected_openings) | selectattr('state','eq','on') | map(attribute='attributes.friendly_name') | list }} @@ -83,11 +90,12 @@ action: {% else %} unknown {% endif %} - - service: "{{ !input notify_service }}" + + - service: "{{ notify_service_name }}" data: message: > {% for entity_name in open_entities %} - {{ !input custom_message + {{ message_template | replace('{{ entity_name }}', entity_name) | replace('{{ trigger_state }}', trigger_state) }}