KH665
February 5, 2018, 3:11pm
1
Would anybody be able to format this please
alias: ‘Spotify switches to MBP’
trigger:
platform: template
value_template: “{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘wneessen-mbp’) %}true{% endif %}”
condition:
condition: template
value_template: ‘{{ trigger.to_state == “true” }}’
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘MacBook’
alias: ‘Spotify switches to PC living room’
trigger:
platform: template
value_template: “{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘LIGHTNING’) %}true{% endif %}”
condition:
condition: template
value_template: ‘{{ trigger.to_state == “true” }}’
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘PC Living Room’
alias: ‘Spotify switches to FireTV living room’
trigger:
platform: template
value_template: “{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘Amazon FireTV’) %}true{% endif %}”
condition:
condition: template
value_template: ‘{{ trigger.to_state == “true” }}’
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘FireTV living room’
alias: ‘Spotify switches to elexa’
trigger:
platform: template
value_template: “{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘Echo WoZi’) %}true{% endif %}”
condition:
condition: template
value_template: ‘{{ trigger.to_state == “true” }}’
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘Alexa living room’
alias: ‘Spotify switches to Winnis iPhone’
trigger:
platform: template
value_template: “{% if is_state_attr(‘media_player.spotify’, ‘source’, "Winni’s iPhone") %}true{% endif %}”
condition:
condition: template
value_template: ‘{{ trigger.to_state == “true” }}’
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘Winnis iPhone’
Perform actions
alias: “Play Spotify on MacBook”
trigger:
platform: state
entity_id: input_select.spotify_source
to: ‘MacBook’
action:
service: script.turn_on
entity_id: script.spotify_mbp
alias: "Spotify to play PC living room
trigger:
platform: state
entity_id: input_select.spotify_source
to: ‘PC Living Room’
action:
service: script.turn_on
entity_id: script.spotify_lightning
alias: "Spotify play on FireTV Living Room "
trigger:
platform: state
entity_id: input_select.spotify_source
to: ‘FireTV Living Room’
action:
service: script.turn_on
entity_id: script.spotify_firetv_wozi
alias: “Spotify play Alexa living room”
trigger:
platform: state
entity_id: input_select.spotify_source
to: ‘Alexa Living Room’
action:
service: script.turn_on
entity_id: script.spotify_echo_wozi
alias: “Spotify play on Winnis Iphone”
trigger:
platform: state
entity_id: input_select.spotify_source
to: ‘Winnis iPhone’
action:
service: script.turn_on
entity_id: script.spotify_winnis_iphone
Bahnburner
(Bahnburner)
February 6, 2018, 3:21am
2
This should do it.
- alias: 'Spotify switches to MBP’
trigger:
platform: template
value_template: "{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘wneessen-mbp’) %}true{% endif %}"
condition:
condition: template
value_template: '{{ trigger.to_state == “true” }}'
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘MacBook’
- alias: 'Spotify switches to PC living room’
trigger:
platform: template
value_template: "{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘LIGHTNING’) %}true{% endif %}"
condition:
condition: template
value_template: '{{ trigger.to_state == “true” }}'
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘PC Living Room’
- alias: 'Spotify switches to FireTV living room’
trigger:
platform: template
value_template: "{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘Amazon FireTV’) %}true{% endif %}"
condition:
condition: template
value_template: '{{ trigger.to_state == “true” }}'
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘FireTV living room’
- alias: 'Spotify switches to elexa’
trigger:
platform: template
value_template: "{% if is_state_attr(‘media_player.spotify’, ‘source’, ‘Echo WoZi’) %}true{% endif %}"
condition:
condition: template
value_template: '{{ trigger.to_state == “true” }}'
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘Alexa living room’
- alias: 'Spotify switches to Winnis iPhone’
trigger:
platform: template
value_template: "{% if is_state_attr(‘media_player.spotify’, ‘source’, “Winni’s iPhone”) %}true{% endif %}"
condition:
condition: template
value_template: '{{ trigger.to_state == “true” }}'
action:
service: input_select.select_option
entity_id: input_select.spotify_source
data:
option: ‘Winnis iPhone’
##Perform actions
- alias: "Play Spotify on MacBook"
trigger:
platform: state
entity_id: input_select.spotify_source
to: 'MacBook’
action:
service: script.turn_on
entity_id: script.spotify_mbp
- alias: "Spotify to play PC living room
trigger:
platform: state
entity_id: input_select.spotify_source
to: 'PC Living Room’
action:
service: script.turn_on
entity_id: script.spotify_lightning
- alias: "Spotify play on FireTV Living Room "
trigger:
platform: state
entity_id: input_select.spotify_source
to: 'FireTV Living Room’
action:
service: script.turn_on
entity_id: script.spotify_firetv_wozi
- alias: "Spotify play Alexa living room"
trigger:
platform: state
entity_id: input_select.spotify_source
to: 'Alexa Living Room’
action:
service: script.turn_on
entity_id: script.spotify_echo_wozi
- alias: "Spotify play on Winnis Iphone"
trigger:
platform: state
entity_id: input_select.spotify_source
to: 'Winnis iPhone’
action:
service: script.turn_on
entity_id: script.spotify_winnis_iphone