#automation for when chromecast starts playing isnt working

1 messages · Page 1 of 1 (latest)

vast rose
#

Hi all, I set up a pretty simple automation for whenever my chromecast starts playing media, the light should turn on and dim. The action works fine, I've tested it; however, the trigger doesn't seem to be working at all.

I have tried a trigger for when the chromecast turns on and that seems to work. It's almost as if the "play" events aren't being registered. Looking at the logs of the device, i only see that on/off actions are being recorded so maybe that's the issue? Anyone know where I can enable tracking of other actions?

alias: turn down lights for tv
description: ""
triggers:
  - device_id: <redacted>
    domain: media_player
    entity_id: <redacted>
    type: playing
    trigger: device
    for:
      hours: 0
      minutes: 0
      seconds: 2
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data:
      brightness_pct: 1
    target:
      device_id: <redacted>
mode: single
#

here's what my logbook looks like for the device

velvet atlas
#

on/off seems to be "casting something"/"idle"

#

i use "off" for one minute as a trigger to determine when to cast a ha dashboard to my chromecast

nova valve
#

Just a note, there is no reason te redact the device id and entry id. They are just randomly generator identifiers only relevant for your HA instance

vast rose
velvet atlas
#

if you i have not really tried to look for that. i only needed to find out when nothing else was casting. and that seems to be "off"

vast rose
nova valve
#

It depends on the integration which states are reported.
But the media player from the cast integration should show a playing state

vast rose
#

im updating my chromecast as we speak FYI

nova valve
#

Are you using the entity from the cast integration?

#

You can see the current state of an entity in devtools > states. Listening to events seems a bit overkill to me

vast rose
#

lemme take a look at the states tab

#

@nova valve state is only on or off, no playing or paused

#

@nova valve would it be helpful if i shared my screen in the hangout channel?

nova valve
#

This is my Chromecast

vast rose
#

hmm

#

what's the integration you're using for that?

#

is it android tv remote?

nova valve
#

No, the cast integration

#

I already mentioned that twice

vast rose
#

oh sorry, i misunderstood

#

i tried grabbing the cast integration and adding my chromecast but it isn't working... probably conflicting with the android tv remote integration. lemme wipe those

keen fiber
#

😐 How familiar are you with templating?

#

You could have a trigger set as a template (for when a template evaluates as true) such that
{{ states('<redacted>') == 'playing' }}

vast rose
#

im trying to get the google cast integration set up but it isn't discovering my chromecast even though the android tv remote integration does

#

err soryr, it is discovering it, but it's unavailable

keen fiber
#

Hmmm... The Android TV integration doesn't have the media_player entity (it is called remote). It does not interfere with Google Cast as the Android TV integration provides the ability for Home Assistant to issue commands to control your Chromecast.

#

I would check all of your entities associated with that TV.

#

See if maybe there is a second entity referring to that TV.

#

(In my case, there is a 'media_player.living_room_tv_2' as well as one without the _2 at the end.)

#

The one without the underscore 2 never broadcasts a playing state. (Just on or off)

vast rose
#

i got rid of my android tv remote integration and just have the cast integration now

#

so no other devices referring to that entity

#

just checked my devices

keen fiber
#

Does it show up in Google Home?

vast rose
#

yep

#

how do i view logs related to an integration?

#

i wonder if that will be helpful

#

hmmm this seems relevant

keen fiber
#

Are you trying to set everything up local?

vast rose
#

yeah, im giving up on the mdns and just using my chromecast ip

#

its sort of working

keen fiber
#

Yeah, casting from Chromecast, etc... is not local. It is cloud-based.

vast rose
#

state on the entity is showing "paused" when i'm playing something though

#

im so lost... i have a feeling this integration doesnt actually do what im looking for

#

im not looking to control my chromecast from HA, i just want it to detect states so i can run automations on them 😦

keen fiber
#

Is your computer monitor your TV?

vast rose
#

no, it's on a tv

keen fiber
#

My computer monitor is the same as my TV.

#

My chromecast is hooked up to the same TV.

vast rose
#

err sorry i mean i dont use my tv as my monitor

keen fiber
#

While it is playing, refresh the states a couple of times and check to see if it changes.

#

It might be delayed.

vast rose
#

how do i refresh the states?

#

do you mean refresh the browser?

keen fiber
#

You could, otherwise:

#

Click on the circular arrow.

vast rose
#

ahh

#

doesnt appear to be changing the state despite that i'm playing

#

I have a feeling that this cast integration is only used to cast stuff FROM home assistant TO chromecast... it's not necessarily for determining if chromecast is playing(eg. when casting from phone to chromecast)

#

ok interesting!

#

so if i cast something from my phone on youtube it shows playing

#

when i was using the remote that came with the chromecast it wasn't changing

#

ok, when i cast plex from my phone to the chromecast i see the state changing also

#

the issue is state changes that come from the remote, none of those are being recorded

#

hmmm pausing/playing from the remote when the media is casted from my phone seems to be recorded as well... it's just when i pick something to play from the remote

vast rose
#