Ahh I see. Yeah I have the same automation basically but I wouldnāt want it to auto dim lights if things are playing on the shield, only if itās Jellyfin/Emby playing.
Otherwise I donāt want it to dim for YouTubeTV, YouTube, etc.
Iām guessing Iāll just have to stick with the emby media player as the entity ID thenā¦ just a pain in the butt because the start/stop triggers are instant but the pause/unpause information that is relayed takes a solid 15-20 seconds sometimes before it reports back to HA and therefore making the pause/unpause automations for the lights very slow.
Yeah maybe. I was also just noticing that when I start something on Android TV, it isnāt updating to āplayingā for a solid 6-8 seconds, same goes for paused/stopping too.
I previously used Plex with Tautulli with MQTT and it was instant and so nice but wanted to abandon that platform due to trust issued and move to an open-source solution in Jellyfin.
The start/stop work perfectly so maybe Iāll just have to deal with the slow response when pausing.
I believe the androidtv package polls the device every 10 seconds. So if youāre unlucky and pause directly after a poll, it could take up to 10 seconds before the new state is read. Typically for me, itās much shorter.
This will help. I will just add this to my triggers:
- entity_id: media_player.nvidia_shield
from: playing
platform: state
to: standby
And through some quick testing itās triggered within that time frame you mentioned, which is much better than the Emby/Jellyfin would report back when paused. Itās not perfect like MQTT was with Plex but MUCH better than the solid 15-20 seconds it was before.
I updated my automations last night because of a new one I made where I donāt want the lights to dim. Itās pretty easy to add a condition so the automation only happens when emby is playing. In my particular instance I didnāt want the dimming automations to happen when google cast is playing so I added this.
Do you find yourself having random āplayingā to āpausedā moments with it?
I thought it ok but noticed that it goes from āplayingā to āpausedā very randomly when Iām using Jellyfin (itās an open-source player forked from Emby). I have no idea what is causing it but you can see the random blips of paused on this chart. Anything that looks like a sliver of teal is one of those random cases. The other teal lines that look longer than a sliver were legitimate pauses.
It lasts about 1 polling session and it goes back to āplayedā and dims the lights again.
Just wondering if you have run into that at all. I tried to do the ADB GET_PROPERTIES and I believe I have all it all set properly.
Itās very possible I just have the properties set wrong but I canāt figure out why itās going into the āpausedā state because itāll be sometimes 20 minutes into a show/movie and havenāt changed or even touched the remote and it goes into that āpausedā state and the lights brighten up and 8-10 seconds later they dim back down because itās reporting āplayingā.
Just wondering I guess if youāve run into this at all or what your solution has been.
Iāve had some movies that play the whole way through without issue, other times Iāve had the lights brighten and dim 2-3 times during a single movie. It basically comes down to jellyfin/emby not setting a media_session_state like every other app does so playback is determined solely by wake_lock_size. Really the only solution is for JF/emby to add media_session_state to their apps. For me, it seems to happen rarely enough that Iām fine waiting for them to fix their apps. I did make a post outlining this issue.
Nice! I know you posted it on Jellyfinās github but just in case others stumble across this in the future and have the same issue/request, I thought Iād link your github enhancement request so people know that it is in the pipeline for a future Jellyfin release.
Thanks for bringing this all to light and keeping it updated!
In developer tools > services, use androidtv.adb_command service with command: GET_PROPERTIES for the desired entity. Then, check the adb_response in developer tools > states for that same entity.
for emby androidTV
tv.emby.embyatv
I had to input, [{"playing": {"wake_lock_size": 3, "wake_lock_size": 4}}, {"paused": {"wake_lock_size": 2, "wake_lock_size": 1}}]
it works.
if i reopen the rule it says [{"playing": {"wake_lock_size": 4}}, {"paused": {"wake_lock_size": 1}}]
either way, its working now.
this [POST] had a bunch of configs THIS DOC. was helpful for figuring out syntax, the ADB commands, reponses to get it working.
THIS POST, has code that allows me to turn on Hue Sync via Hue Essentials when Emby starts playing. (just fixed.)