Hi all
I guess that almost every Home Assistant user can relate to making things work vs. make things work the best way. I’m trying to get this right - for once!
I have a mixed setup of Audio-devices in my home:
- 3* Google Home Mini’s
- 1* Soundbard with Google Cast-support (So it’s powering on and off like it should)
- 2* Legacy speakers with Google Chomecast Audio
The two legacy speakers is:
- Kitchen-speaker NAD (power-control by
switch.s20
) - Office-speaker Marshall(power-control by
switch.sonoff4
)
Issue/Wish: Control the power of the legacy devices, for both “single” playback, and with support for group/team playback. (Power on if playback on Google Chromecast Audio, and power off after fx. 5 minuters)
Automation for single device is pretty easy (Click for code...)
automation:
- alias: 'NAD Off Auto-control'
id: NAD-off-chromecast
hide_entity: true
trigger:
- platform: state
entity_id: media_player.kitchen_speaker
to: 'off'
for:
minutes: 5
- platform: state
entity_id: media_player.kitchen_speaker
to: 'paused'
for:
minutes: 5
condition:
condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: media_player.kitchen_speaker
state: 'off'
- condition: state
entity_id: media_player.kitchen_speaker
state: 'paused'
- condition: state
entity_id: switch.s20
state: 'on'
action:
service: switch.turn_off
data:
entity_id: switch.s20
- alias: 'NAD On Auto-control'
id: NAD-on-chromecast
hide_entity: true
trigger:
- platform: state
entity_id: media_player.kitchen_speaker
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: media_player.kitchen_speaker
state: 'playing'
- condition: state
entity_id: switch.s20
state: 'off'
action:
service: switch.turn_on
data:
entity_id: switch.s20
Well… At least. Cause i’m also facing problems with the speaker turning off, if a manually turning it on, for other reasons. Fx. for bluetooh input, or audio-jack from my PC. Maybe you have input to this, too?
My “Groups” / Teams is called:
- Team Mini (Our Google Home Mini’s)
- Team Maxi (Soundbar and the two legacy speakers)
- Team Battle (All of them)
I can’t came up with the best solution for the automation part, when it comes to the team-playback. I thought that it could be an idea to create an automation, which just synced the team-playback up to each single Google Audio-device, but i couldn’t get this to work.
I also tried this (see below), but it’s not working properly - and i was hoping for a better way to do this.
Switch control based on Maxi-group playback
alias: test1
trigger:
platform: state
entity_id: media_player.maxi_group
to: 'playing'
condition:
condition: and
conditions:
- condition: state
entity_id: media_player.maxi_group
state: 'playing'
- condition: state
entity_id: switch.sonoff4
state: 'off'
action:
service: switch.turn_on
data:
entity_id: switch.sonoff4
I’ve already looked through the forum multiple times, but i can’t find a solution which fitted my setup… Or at least, i can’t see how X, Y and Z solution could become helpful for my setup