Plex Notifications Automation Success Story

I recently set up an automation to notify me when Plex starts playing, and I wanted to share my experience with the community. It’s been a fantastic way to stay updated on what my family is watching, and I thought I’d document the process in case anyone else is interested in doing something similar.

The setup involved creating an automation that triggers when a Plex client changes from idle to playing. I used the built-in notification services to send alerts to my phone and desktop. Here’s a quick breakdown of the steps I took:

  1. Trigger Setup: I configured the automation to monitor the state changes of my Plex clients. Specifically, it watches for transitions from ‘idle’ or ‘unavailable’ to ‘playing’.
  2. Notification Content: I wanted the notifications to be informative, so I included details like the device name, series title (if available), and episode title. I also added an icon for better visual cues.
  3. Multiple Devices: To ensure I never miss a notification, I set up alerts for both my mobile app and desktop using Hass.Agent. This way, notifications appear on my phone and desktop simultaneously.

Here’s a snippet of the automation configuration I used:

yaml

  • id: ‘1431594919196’
    alias: Notifications Plex
    description: ‘’
    mode: single
    trigger:
    • platform: state
      from: [‘idle’, ‘unavailable’]
      to: ‘playing’
      entity_id:
      • media_player.plex_television
      • media_player.plex_mom_television
        variables:
        device: ‘{{ state_attr(trigger.entity_id, ‘friendly_name’) }}’
        series: ‘{{ state_attr(trigger.entity_id, ‘media_series_title’) }}’
        title: ‘{{ state_attr(trigger.entity_id, ‘media_title’) }}’
        picture: ‘{{ state_attr(trigger.entity_id, ‘entity_picture’) }}’
        action:
    • service: notify.mobile_app_<phone_name>
      data:
      title: “Playing on {{ device }}”
      message: >
      {% if series == None %}
      {{ title }}
      {% else %}
      {{ series }} - {{ title }}
      {% endif %}
      icon_url: ‘{{ picture }}’
    • service: notify.hass_agent_nameOfYourDevice
      data:
      title: “Playing on {{ device }}”
      message: >
      {% if series == None %}
      {{ title }}
      {% else %}
      {{ series }} - {{ title }}
      {% endif %}
      image: “http://homeassistant.local:8123{{ picture }}”

This setup has worked beautifully for me, but I’m always looking for ways to improve it. If anyone has suggestions or alternative methods, I’d love to hear them! It’s amazing how a simple automation can enhance the user experience, and I’m grateful to the community for all the resources that made this possible.