Figuring out a way to still use notify groups for this rewrite

This commit is contained in:
2023-08-16 16:13:53 -04:00
parent c32c751e97
commit abd30f7ff2

View File

@ -4,22 +4,24 @@ script:
sequence: sequence:
- variables: - variables:
room_services: >- room_services: >-
{% set alexa_speaker = states.media_player | {% if room in areas() %}
selectattr('entity_id', 'in', area_entities(room)) | {% set alexa_speaker = states.media_player |
rejectattr('attributes.last_called', 'undefined') | selectattr('entity_id', 'in', area_entities(room)) |
selectattr('entity_id', 'search', 'echo_dot') | rejectattr('attributes.last_called', 'undefined') |
map(attribute='entity_id') | selectattr('entity_id', 'search', 'echo_dot') |
list | first %} map(attribute='entity_id') |
list | first %}
{% set google_speaker = states.media_player |
selectattr('entity_id', 'in', area_entities(room)) | {% set google_speaker = states.media_player |
rejectattr('attributes.device_class', 'undefined') | selectattr('entity_id', 'in', area_entities(room)) |
selectattr('attributes.device_class', 'search', '(speaker)') | rejectattr('attributes.device_class', 'undefined') |
map(attribute='entity_id') | selectattr('attributes.device_class', 'search', '(speaker)') |
list | first %} map(attribute='entity_id') |
list | first %}
{% set tts = "alexa" if alexa_speaker is defined else "google" %}
{"area":"{{room}}","alexa_speaker":"{{alexa_speaker|default({}) }}","jarvis_tts":"{{tts}}","google_speaker":"{{google_speaker|default({}) }}"} {% set tts = "alexa" if alexa_speaker is defined else "google" %}
{% endif %}
{"area":"{{room}}","alexa_speaker":"{{alexa_speaker|default({}) }}","jarvis_tts":"{{tts|default("google") }}","google_speaker":"{{google_speaker|default({}) }}"}
- stop: "Services acquired" - stop: "Services acquired"
response_variable: "room_services" response_variable: "room_services"