#Plex Automation

1 messages · Page 1 of 1 (latest)

steady elm
#

In Plex HTPC, Music can be Playing and then you can Play a Movie which takes over, when the Movie is Finished or is Stopped, the Music picks up from where it left off.

This is useful as I Shuffle my Entire Music Library and having the Playlist Persistent means that I do not have to Shuffle the Music everytime which has the possibility of listening to the same Songs again and again.

I have Created an Automation in Home Assistant that performs an Action if a Movie is Played, however, I have an Issue.

If I Shuffle my Music and then Start the Movie, the Automation thinks that Music is still Playing whereas the Movie is.

If I Stop the Music, this is not ideal, then Start Playing the Movie the Automation works as expected.

Now, I have only been using Home Assistant for a Week so I am on a Steep Learning Curve and may have missed something.

Any suggestions?

Thanks in advance

Kevin

tulip gust
#

Please share your automation in yaml. See:

spark pierBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

tulip gust
#

But I assume you trigger in the player state changing to playing and then check the type it's playing. For this case to work you need to add the opposite. Trigger on type changing to movie and then check if you're playing.

steady elm
#

alias: Turn Off Living Room Lights when Plex Plays a Movie
description: ""
triggers:

  • device_id: 19e06788e8002d366b73214114703f40
    domain: media_player
    entity_id: 6b2fe06253da96b8f3a1583d1796e9f3
    type: playing
    trigger: device
    conditions:
  • condition: state
    entity_id: media_player.plex_plex_htpc_for_windows_knc_htpc
    state:
    • movie
      attribute: media_content_type
      actions:
  • action: notify.notify
    metadata: {}
    data:
    message: Test
    mode: single
#

For Testing purposes I just Send a Notification when the Automation is succesful.

#

Also, When I have the Music Playing and then Start the Movie, the Automation Trace reports that Music is Playing and not the Movie which not correct.

steady elm
#

Plex Automation

tulip gust
#

Step 1, read the link I posted 😄 Without proper formatting yaml is hard to read and impossible top copy-paste.

Step 2, it's indeed as I thought. So also add a trigger like

  - trigger: state
    entity_id:
      - media_player.plex_plex_htpc_for_windows_knc_htpc
    attribute: media_content_type
    to:
      - movie

And add a condition that checks if it is indeed playing.

steady elm
#

Adding the extra Trigger seems to have worked.

#

Thanks

steady elm
#

After more Testing, If I Start Playing a Movie without First Stopping the Music Playing the Automation still thinks that the Music is Playing when in fact the Movie is.