Lights Off Timer: Jellyfin sleep timer that turns off Home Assistant lights

Jellyfin 12.2 plugin that adds a sleep-timer button next to the volume
control in the web player (end of this episode/movie, or N minutes). When
playback stops with the timer on, it calls a Home Assistant webhook that
turns the lights off after a cooldown; starting playback cancels it.

The repository doubles as a Jellyfin plugin repository: manifest.json at
the root points at the release zips in dist/. build.sh builds in the
.NET 10 SDK container and adds new versions to the manifest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nikrozmanandClaude Opus 5.5 committed 2026-10-30 00:22:48 +01:00
commit 8d456442e6
15 files changed
+934

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
# Home Assistant side of the Jellyfin "Lights Off Timer" plugin.
# Put this in a package (e.g. /config/packages/jellyfin_lights.yaml, with
# `homeassistant: packages: !include_dir_named packages` in configuration.yaml),
# replace the webhook id, reload Timers and Automations, then set the plugin's
# "Home Assistant webhook URL" to https://<your-ha>/api/webhook/<webhook id>.
#
# The plugin POSTs JSON:
# {"event": "started"} playback (re)started -> cancel the countdown
# {"event": "stopped", "cooldown_minutes": 15} playback stopped with the sleep timer on -> start it
timer:
movie_lights_off:
name: Lights off after movie
icon: mdi:movie-open-off
restore: true
automation:
- id: jellyfin_lights_webhook
alias: Jellyfin - playback started/stopped
mode: queued
triggers:
- trigger: webhook
# Anyone who knows this id can trigger it: use a long random string, keep it secret.
webhook_id: CHANGE-ME-to-a-long-random-string
allowed_methods: [POST]
local_only: false # true if Jellyfin is on the same LAN as Home Assistant
actions:
- choose:
- conditions: "{{ trigger.json.event == 'started' }}"
sequence:
- action: timer.cancel
target:
entity_id: timer.movie_lights_off
- conditions: "{{ trigger.json.event == 'stopped' }}"
sequence:
- variables:
minutes: "{{ (trigger.json.cooldown_minutes | default(15)) | int(15) }}"
- action: timer.start
target:
entity_id: timer.movie_lights_off
data:
duration: "{{ '%02d:%02d:00' % (minutes // 60, minutes % 60) }}"
- id: jellyfin_lights_off
alias: Jellyfin - lights off after the movie
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.movie_lights_off
actions:
- action: light.turn_off
target:
entity_id: all # or list the lights you want
data:
transition: 30