Skip to content

Instantly share code, notes, and snippets.

@rhl2401
Last active September 27, 2024 21:24
Show Gist options
  • Save rhl2401/3a445e446b707061cf5c28187b454aa0 to your computer and use it in GitHub Desktop.
Save rhl2401/3a445e446b707061cf5c28187b454aa0 to your computer and use it in GitHub Desktop.
Plex light dimmer
blueprint:
name: Plex light control
description: 'Dim your lights when playing something from Plex.
This blueprint works very well with Tautulli for Plex and is developed based on this add-on.
Your body must be
started
stopped
paused
resumed
in order for this blueprint to work.
The payload of the message must be formatted like
{body: resume}
Configure the message in Tautulli and you are good to go. Just make sure that the body of the messages are correct.
'
domain: automation
input:
light:
name: Target light
selector:
entity:
domain: light
dim_transition:
name: Transistion dimming
description: Set the transistion speed of dimming the light
default: 2
selector:
number:
min: 0.1
max: 10
mode: slider
step: 0.1
unit_of_measurement: s
play_brightness:
name: Play brightnes
description: Brightness when a movie is playing.
default: 20
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
pause_brightness:
name: Pause brightness
description: Brightness when movie is paused.
default: 60
selector:
number:
min: 1.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
stop_brightness:
name: Stop brightness
description: Brightness when movie has been stopped or ended.
default: 75
selector:
number:
min: 1.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
topic:
name: MQTT Topic
description: The topic used to notify.
default: tautulli
source_url: https://rl-online-media.dk
trigger:
platform: mqtt
topic: !input 'topic'
condition:
condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
action:
- variables:
payload: '{{ trigger.payload_json }}'
- choose:
- conditions: '{{ payload["body"] == ''resumed'' }}'
sequence:
- service: light.turn_on
data_template:
entity_id: !input 'light'
brightness_pct: !input 'play_brightness'
transition: !input 'dim_transition'
- conditions: '{{ payload["body"] == ''paused'' }}'
sequence:
- service: light.turn_on
data_template:
entity_id: !input 'light'
brightness_pct: !input 'pause_brightness'
transition: !input 'dim_transition'
- conditions: '{{ payload["body"] == ''started'' }}'
sequence:
- service: light.turn_on
data_template:
entity_id: !input 'light'
brightness_pct: !input 'play_brightness'
transition: !input 'dim_transition'
- conditions: '{{ payload["body"] == ''stopped'' }}'
sequence:
- service: light.turn_on
data_template:
entity_id: !input 'light'
brightness_pct: !input 'stop_brightness'
transition: !input 'dim_transition'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment