Why does "media_player.turn_on" act as a toggle on Google Home/Chromecast devices


Anyone know why Google Home/Chromecast devices respond to “media_player.turn_on” by toggling on and off? It’s really messing up some of my automations when a Google device is already on and the automation turns it off by mistake. This behavior doesn’t happen on my Logitech Media Players.


not sure, but my understanding is that when you turn on a chromecast media player it attempts to connect to it to send some audio
if you’re already playing audio on that device, it will most likely stop the stream to initiate a new one (which is missing if all you’ve done is to turn it on)
you probably need to understand why they’re turned on “by mistake” and set some conditions to avoid turning on if the state is different than on…


Not exactly the problem I’m facing. I’m trying to keep them turned on but sending a “turn_on” while already on, causes them to turn “off”


try this:


Lol! Thanks, that’s my post. Sending the silent mp3 was my work around to not getting the “turn_on” command to solve the issue. Cheers :wink:


LOL just implemented this today based in your post :smiley:


Nice- I just edited the post to reflect one little adjustment. I found the wake-up ping was failing about once every 45 minutes so I changed the frequency to 2-minutes. Now there are two chances to hit the mark in every 5-minute sleep cycle. Seems to be 100% reliable now.


I use this script to turn it on:

alias: “Turn on Google Home”
- condition: state
entity_id: media_player.bedroom
state: ‘off’
- service: media_player.turn_on
entity_id: media_player.bedroom
- delay: ‘00:00:03’

So if it is already on, then leave it