To help emulate the Tautulli playback notifications i have setup the following on my Jellyfin server and HA to send me a notification when someone starts playing a movie or show.
Jellyfin Generic Webhook on Playback event, URL is the URL of your HA Webhook:
{
"Name": "{{{Name}}}",
"Username": "{{{Username}}}",
"NotificationUsername": "{{NotificationUsername}}",
"SeriesName": "{{SeriesName}}",
"SeasonNumber00": "{{SeasonNumber00}}",
"EpisodeNumber00": "{{EpisodeNumber00}}",
"Year": "{{Year}}",
"ServerName": "{{ServerName}}",
"NotificationType": "{{NotificationType}}",
"DeviceName": "{{DeviceName}}",
"ClientName": "{{ClientName}}",
"ItemType": "{{ItemType}}",
"ItemId": "{{ItemId}}",
"ServerUrl": "{{ServerUrl}}",
"ServerId": "{{ServerId}}",
"Thumbnail": "https://URLOFSERVER/Items/{{ItemId}}/Images/Primary",
"ItemUrl": "https://URLOFSERVER/web/index.html#!/details?id={{ItemId}}&serverId={{ServerId}}",
"Provider_tmdb": "{{Provider_tmdb}}",
"Provider_imdb": "{{Provider_imdb}}"
}
I have to hardcode my Jellyfin URL as the serverUrl variable doesnt work for me - not sure why.
Here is my automation YAML
alias: Jellyfin Webhook Notification
description: ''
trigger:
- platform: webhook
webhook_id: YOURCUSTOMWEBHOOKID
condition: []
action:
- service: notify.mobile_app_iphone
data:
title: '{{ trigger.json.ServerName }}: {{ trigger.json.NotificationType }}'
message: >-
{{ trigger.json.NotificationUsername | capitalize }} started playing
from {{ trigger.json.ClientName }} on {{ trigger.json.DeviceName }}
data:
subtitle: >-
{% if trigger.json.ItemType == 'Episode' %} {{ trigger.json.SeriesName
}} - S{{ trigger.json.SeasonNumber00 }}E{{
trigger.json.EpisodeNumber00 }} - {{ trigger.json.Name }} {% else %}
{{ trigger.json.Name }} ({{ trigger.json.Year }}) {% endif %}
image: '{{ trigger.json.Thumbnail }}'
group: jellyfin-notification-group
url: '{{ trigger.json.ItemUrl }}'
actions:
- action: URI
title: View on IMDB
uri: https://www.imdb.com/title/{{ trigger.json.Provider_imdb }}
mode: single
Here is the notification, opening it will show you a cover or thumbnail from the show and provide a link to IMDB. Tapping the notification opens up the jellyfin server to the item being played.
So although this all works i was wondering if there was a better way of doing this or how else this could be expanded upon?
There doesnt appear to be a good way to make the actions contextual, i.e. if TV show show these actions else show these.
1 post - 1 participant