Hello! I base this on my other blueprint to make this to work as a media controller.
This is intended to work with the 5 button pico device from lutron (on, off, raise, lower, favorite).
In this blueprint the central buttons, favorite, raise and lower will work as play/pause, raise and lower volume.
You can customize the main on/off button (I use it to call a service on spotcast to play my favorite playlist and the other button my wife’s favorite)
Enjoy and improve!
blueprint:
name: RadioRa2 Pico 5 button as MediaPlayer controller
description: "This is for the 5 button picos that have the following model:\n\n PJ2-3BRL-GXX-X01 (Pico3ButtonRaiseLower)\n\nSelect an action for each button listed below. \n\n Based on the work of stephack \n\n The favorite button will play/pause the media, arrows buttons will raise and lower the volume"
domain: automation
input:
pico_remote:
name: NameOfPico
description: "Go to Developers Tools--> Events --> Listen event: lutron_event --> start listen. Push a button of your pico and write here the name on data:id: (without quotes) and without the last underscore and word (ex. without _favorite)"
media_player:
name: MediaPlayer Device
description: "Select the media player to use with the pico remote:"
selector:
entity:
domain: media_player
top_on:
name: Top (On) Button Pressed
description: "Execute when TOP button is PRESSED"
default: []
selector:
action: {}
bottom_off:
name: Bottom (Off) Button Pressed
description: "Execute when BOTTOM button is PRESSED"
default: []
selector:
action: {}
variables:
pico_name: !input pico_remote
trigger:
- platform: event
event_type: lutron_event
condition:
- condition: template
value_template: '{{ pico_name in trigger.event.data.id }}'
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.event.data.action == "single" or
trigger.event.data.action == "pressed" }}
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ "_off" in trigger.event.data.id }}'
sequence: !input bottom_off
- conditions:
- condition: template
value_template: '{{ "_favorite" in trigger.event.data.id }}'
sequence:
- service: media_player.media_play_pause
target:
entity_id:
- !input media_player
- conditions:
- condition: template
value_template: '{{ "_on" in trigger.event.data.id }}'
sequence: !input top_on
- conditions:
- condition: template
value_template: '{{ "_raise" in trigger.event.data.id }}'
sequence:
- repeat:
until:
- condition: template
value_template: '{{ trigger.event.data.action == "released" }}'
sequence:
- service: media_player.volume_up
target:
entity_id:
- !input media_player
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- conditions:
- condition: template
value_template: '{{ "_lower" in trigger.event.data.id }}'
sequence:
- repeat:
until:
- condition: template
value_template: '{{ trigger.event.data.action == "released" }}'
sequence:
- service: media_player.volume_down
target:
entity_id:
- !input media_player
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
default: []
default: []
mode: restart