I had an automation working back in HomeAssistant I think 60, running in a virtual python environment, where I could tell if my Roku was watching a movie, or watching TV or was playing or paused or stopped. It worked fantastic for about 3 days.
I even recorded a video and posted it on Facebook all bragging like.
Then I upgraded the HomeAssistant instance, and it broke, but I didn’t work on it as I almost immediately after that changed over to a HASSIO instance in a different virtual machine.
I’m searching on my own, and trying my best to retrace my steps, but I can’t figure out where I lost the ability to track the Plex instance on my Roku, and what it was doing at any point in time.
The automation was this… it is my tracking point to figure out where I’ve gone wrong with either tracking my Plex server as a sensor, or tracking the players as media_players. If anyone could even just let me know where I’ve gotten lost, I am happy to work on it myself. I miss that bragging point.
# dim the lights if a movie at night
alias: movies night lights
trigger:
- platform: state
entity_id: sensor.plex_status
to: 'playing'
condition:
- condition: state
entity_id: sensor.roku_plex
state: 'movie'
- condition: state
entity_id: group.living_room
state: 'on'
action:
- service: script.record_livingroom
- service: script.movies_lights
- service: input_boolean.turn_on
entity_id: input_boolean.we_dimmed
It did work. Honest. I have a video to prove it. As I’ve rebuilt, I’ve lost the original virtual machine, I just had made copies of the original scripts. I could be missing a custom component sensor maybe ?
I had it - once - never to be seen again.
I am not sure if it’s me or a system change between updates and/or HomeAssistant to HASSIO, or even something I missed when building this virtual machine. So many variables, and I changed just about everyone of them, and now it’s not working.
The sensor.plex I have has a value as the state. It’s the number of watching in progress.
So you can only trigger on platform : numeirc_state, above: 0
But I still have limited information about the Plex sessions, including that since 0.60, the “include_non_clients” option fails the component… And most clients are not client but session only (Android client, Home Theater app on W10…)
I don’t get it ? The plex sensor works as expected, counts the playing sessions (client or just sessions, music, movie, shows…).
I have a customisation that hides the value if zero, even if I play from the android app (not a “client”), I get the status modified :
The purpose of the sensor was to differentiate what was playing on my Roku Plex app - dim the lights if a movie was playing - if paused or stopped - return the lights back to what ever level they were at before they were dimmed.
I had it working briefly myself but it stopped at some stage. I too was looking to work on these automations again recently and noticed that there was some movement on the thread.
I did get that operation back, but I’ve forgotten how I set up the triggers. It’s shifted to the backburner for now, but it does look like it should work again.