I´m trying out Node Red and moving some automations but get stuck on this. I have a couple input_select for selecting source in my Sonos speakers and can’t figure out what the best way would be to create the following automation in Node Red
- alias: Sonos Kök Genre
trigger:
- entity_id: input_select.genre_kok
platform: state
condition: []
action:
- service: media_player.select_source
data_template:
entity_id: media_player.koket
source: >
{% if is_state("input_select.genre_kok", "Country") %}
DB Snus Country
{%-elif is_state("input_select.genre_kok", "Disco") %}
Det e la Disco Då Ju
{%-elif is_state("input_select.genre_kok", "Hip-Hop") %}
Hip Hop
{%-elif is_state("input_select.genre_kok", "Hippie") %}
Hippie
{%-elif is_state("input_select.genre_kok", "Punk") %}
Punk
{%-elif is_state("input_select.genre_kok", "Rock") %}
Rock
{%-elif is_state("input_select.genre_kok", "Svenskt") %}
Sverige
{% else %}
none
{% endif %}
Basically how can I use a node to fetch the selected input for the source?