I have a lot of users on my Plex, and I like to keep updated on what are the Plex clients watching.
Here is the Automation :
- 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 %}
data:
icon_url: "{{ picture }}"
If you have ideas to improve it, please let me know !
EDIT 11:
If you are using Hass.Agent to have notifications on windows like on your phone, you can add this action under the first one:
- service: notify.hass_agent_nameOfYourDevice
data:
title: "Playing on {{ device }}"
message: >
{% if series == None %}
{{ title }}
{% else %}
{{ series }} - {{ title }}
{% endif %}
data:
image: "http://homeassistant.local:8123{{ picture }}"