Hey there, complete noob here. I have been trying this in my developer hassio image and have not had any success. I used that hassio image and placed everything with the config file ( removed the call outs to automation, scripts, groups…etc.). I have debugged it to this error:
"16:47:43 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=4 from 2018-08-17 16:45:21.686237)
2018-08-17 16:47:44 WARNING (MainThread) [homeassistant.components.http] You have been advised to set http.api_password.
2018-08-17 16:48:05 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-08-17 16:48:21 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: (possible options: Bathroom, Brandon Bedrooom)
2018-08-17 16:48:21 ERROR (MainThread) [homeassistant.core] Invalid service data for input_boolean.turn_on: Entity ID is an invalid entity id for dictionary value @ data[‘entity_id’]. Got ‘’
2018-08-17 16:48:21 ERROR (MainThread) [homeassistant.core] Invalid service data for input_boolean.turn_off: Entity ID is an invalid entity id for dictionary value @ data[‘entity_id’]. Got ‘’
"
Sorry for how ugly this is going to look, but here is the config file:
# Attempt to Change Sonos
input_boolean:
sonos_bathrooom_slave:
name: Bathroom
sonos_brandon_bedroom_slave:
name: Brandon Bedroom
input_select:
master_sonos:
name: Master Sonos Player
icon: mdi:itunes
options:
- Bathroom
- Brandon Bedrooom
#Senor
sensor:
-
platform: yr
-
platform: template
sensors:
sonos_join_speakers:
entity_id:
- input_boolean.sonos_bathroom_slave
- input_boolean.sonos_brandon_bedroom_slave
value_template: >-
{% set master = states.sensor.sonos_group_master.state %}
{% for player in states.media_player -%}
{%- set domain, device = player.entity_id.split(’.’) -%}
{%- set new_domain = “input_boolean” -%}
{%- set new_device = [device, “slave”]|join("") -%}
{%- set switch = [new_domain,new_device] | join(".") -%}
{%- if is_state(switch, ‘on’) and player.entity_id != master -%}
{{player.entity_id}},
{%- endif -%}
{%- endfor %}
sonos_unjoin_speakers:
entity_id:
- input_boolean.sonos_brandon_bedroom_slave
- input_boolean.sonos_bathroom_slave
value_template: >-
{% set master = states.sensor.sonos_group_master.state %}
{% for player in states.media_player -%}
{%- set domain, device = player.entity_id.split(’.’) -%}
{%- set new_domain = “input_boolean” -%}
{%- set new_device = [device, “slave”]|join("") -%}
{%- set switch = [new_domain,new_device] | join(".") -%}
{%- if is_state(switch, ‘off’) and player.entity_id != master -%}
{{player.entity_id}},
{%- endif -%}
{%- endfor %}
sonos_not_group_slaves:
friendly_name: Not Group Slaves
value_template: >-
{% for player in states.media_player if player.attributes.is_coordinator -%}
{%- if loop.last -%}{{player.entity_id}}–
{%- else -%}{{player.entity_id}};
{%- endif -%}
{%- endfor %}
sonos_group_slaves:
friendly_name: Group Slaves
value_template: >-
{% for player in states.media_player if player.state == ‘playing’ and not player.attributes.is_coordinator -%}
{%- if loop.last -%}{{player.entity_id}}–
{%- else -%}{{player.entity_id}};
{%- endif -%}
{%- endfor %}sonos_group_song:
friendly_name: Group Song
value_template: >-
{% for player in states.media_player if player.state == ‘playing’ and not player.attributes.is_coordinator %}
{{player.attributes.media_title}}
{% endfor %}
sonos_group_master:
entity_id:
- sensor.sonos_group_song
value_template: >-
{% set group_song = states.sensor.sonos_group_song.state %}
{% for player in states.media_player if player.state == ‘playing’ and player.attributes.is_coordinator and player.attributes.media_title in group_song %}
{{player.entity_id}}
{% endfor %}
#Automation
automation: -
alias: ‘Set Sonos States’
initial_state: on
trigger:- platform: state
entity_id: sensor.sonos_group_slaves - platform: state
entity_id: sensor.sonos_not_group_slaves - platform: state
entity_id: sensor.sonos_group_master - platform: homeassistant
event: start
action: - service: input_select.select_option
data_template:
entity_id: input_select.master_sonos
option: >-
{% set master = states.sensor.sonos_group_master.state %}
{% if master == “media_player.sonos_bathroom_room”%}Bathroom
{% elif master == “media_player.sonos_brandon_bedrooom_room”%}Brandon Bedroom
{% endif %} - service: input_boolean.turn_on
data_template:
entity_id: ‘{%- set slaves = states.sensor.sonos_group_slaves.state -%}{{slaves|replace("–", “_slave”)|replace(";", "_slave, ")|replace(“media_player”, “input_boolean”)}}’ - service: input_boolean.turn_off
data_template:
entity_id: ‘{%- set slaves = states.sensor.sonos_not_group_slaves.state -%}{{slaves|replace("–", “_slave”)|replace(";", "_slave, ")|replace(“media_player”, “input_boolean”)}}’
#Script
script:
sonos_group_speakers:
sequence: - service: media_player.sonos_join
data_template:
master: >-
{% if is_state(“input_select.master_sonos”, “Bathroom”) %}media_player.sonos_bathroom
{% elif is_state(“input_select.master_sonos”, “Brandon Bedroom”) %}media_player.sonos_brandon_bedroom
{% endif %}
entity_id: ‘{%- set slaves = states.sensor.sonos_join_speakers.state -%}{{slaves[:-1]}}’ - service: media_player.sonos_unjoin
data_template:
entity_id: ‘{%- set slaves = states.sensor.sonos_unjoin_speakers.state -%}{{slaves[:-1]}}’
#Script
group:
sonos_grouping_options:
view: no
name: Group Sonos Players
control: hidden
entities: - input_select.master_sonos
- input_boolean.sonos_bathroom_slave
- input_boolean.sonos_brandon_bedroom_slave
- script.sonos_group_speakers
- platform: state
I have verified the names of the sonos devices through the entity registry.
media_player.brandon_bedroom:
media_player.bathroom:
Thank you all in advance for the help!
(Sorry for the formatting, i’m searching now to see if I can fix that)