"get_room_lights" script

This commit is contained in:
2023-08-16 14:00:24 -04:00
parent 177c4a9a51
commit c32c751e97

View File

@ -1,5 +1,6 @@
script:
get_room_services:
alias: Get Room Services
sequence:
- variables:
room_services: >-
@ -20,4 +21,19 @@ script:
{% 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({}) }}"}
- stop: "Services acquired"
response_variable: "room_services"
response_variable: "room_services"
get_room_lights:
alias: Get Room Lights
sequence:
- variables:
area: >
{{ room }}
entities: >
{% set lights = states.light |
selectattr('entity_id', 'in', area_entities(area)) |
map(attribute='entity_id') |
list | join(',') %}
{"lights":"{{lights}}"}
- stop: "Lights acquired"
response_variable: "entities"