Home Assistant - Stop streaming on Google Home speakers when not home
Emiliano Guerzoni
Project Manager | BESS Development | Driving 3+ GW of Energy Storage Projects in Italy
Hi everyone,
Today I would like to introduce the following automation, which is very useful especially when you leave your home and are in a hurry.
Use case
You are getting ready to go out and you are streaming music on the google home you have at home.
It's late. You go out but you forget to stop the music.
Software configuration
family:
? entities:
? ? - person.A
? ? - person.B
- person.C
The state of the entity group.family will be:
Home Assistant code (yaml)
This is the piece of code -?Automation?- you have to write down:
alias: Position - Tunrn off google home
description: Turn off google home if familiy group is not_home
trigger:
? - platform: state
? ? entity_id: group.family
? ? from: home
? ? to: not_home
? ? for: "00:00:15"
condition: []
action:
? - service: media_player.turn_off
? ? data: {}
? ? target:
? ? ? device_id:
? ? ? ? - device_A
? ? ? ? - device_B
? ? ? ? - ....
? ? ? ? - device_N
mode: single
领英推荐
Some specifics about the code above
I do hope you have enjoyed this article. I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below!
Thank you for reading.
--------------------------------------------------------------------------------------------------------
Other recent articles about Home Assistant: