Here’s a configuration example for a pico remote using the custom component lutron_caseta_pro. This configuration simultaneously controls an overhead light and an LED strip. By pressing the favourite button the remote switches between which light it is controlling. It does so by using an MQTT topic to keep track of the state of the favourite button.
The buttons work as you would expect, except for two features. One, if the LED strip is already on, the on button is pressed, and the LED strip control is selected with the favourite button, then the LED strip will switch effects. Two, the ceiling light dimmer controls take larger steps at a higher brightness state and smaller steps at lower brightness.
Automations:
# Pico on button pressed and favourite button status = 0
# Turn light.master_bedroom_main_lights to full brightness
- alias: Pico on and favourite = 0
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '1'
condition:
condition: template
value_template: "{{ is_state('sensor.pico_mid_button_pressed', '0') }}"
action:
service: light.turn_on
data:
brightness: 255
entity_id: light.master_bedroom_main_lights
# Pico on button pressed, favourite button = 1, and light.desk_led_strip = off
# Turn light.desk_led_strip on
- alias: Pico on and favourite = 1
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '1'
condition:
condition: template
value_template: "{{ is_state('sensor.pico_mid_button_pressed', '1') and is_state('light.desk_led_strip', 'off' )}}"
action:
service: light.turn_on
entity_id: light.desk_led_strip
# Pico ON button pressed, favourite button = 1, and light.desk_led_strip = on
# Change light.desk_led_strip effect
- alias: Pico ON and favourite = 1
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '1'
condition:
condition: template
value_template: "{{ is_state('sensor.pico_mid_button_pressed', '1') and is_state('light.desk_led_strip', 'on' )}}"
action:
service: light.turn_on
entity_id: light.desk_led_strip
data_template:
effect: "{{ (['bpm', 'candy cane', 'confetti', 'cyclon rainbow', 'dots', 'fire', 'glitter', 'juggle', 'noise', 'police one', 'ripple', 'sinelon', 'twinkle']|random) }}"
# Pico RAISE button pressed
#
# If sensor.pico_mid_button_pressed is 1 then increase the brightness of light.desk_led_strip
# or if sensor.pico_mid_button_pressed is 0 then increase the brightness of light.master_bedroom_main_lights
#
# The brightness if statements have the ldimmer take larger steps at the higher end of
# brightness and smaller steps at the lower end of brightness for light.master_bedroom_main_lights
- alias: Pico raise button pressed
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '8'
action:
service: light.turn_on
data_template:
entity_id: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
light.desk_led_strip
{% else %}
light.master_bedroom_main_lights
{% endif -%}
brightness: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
{{ [255, state_attr('light.desk_led_strip', 'brightness')|int(0) + 25]|min }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) > 76 %}
{{ [255, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) + 50]|min }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) > 26 and state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) < 77 %}
{{ [255, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) + 10]|min }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) < 27 %}
{{ [255, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) + 3]|min }}
{% endif -%}
# Pico middle button pressed to change which light set is controlled.
- alias: Pico favourite button pressed
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '2'
action:
service: mqtt.publish
data_template:
topic: 'remote/mid_button'
payload: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
0
{% else %}
1
{% endif -%}
# Pico lower button pressed
#
# If sensor.pico_mid_button_pressed is 1 then decrease the brightness of light.desk_led_strip
# or if sensor.pico_mid_button_pressed is 0 then decrease the brightness of light.master_bedroom_main_lights
#
# The brightness if statements have the ldimmer take larger steps at the higher end of
# brightness and smaller steps at the lower end of brightness for light.master_bedroom_main_lights
- alias: Pico lower button pressed
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '16'
action:
service: light.turn_on
data_template:
entity_id: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
light.desk_led_strip
{% else %}
light.master_bedroom_main_lights
{% endif -%}
brightness: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
{{ [0, state_attr('light.desk_led_strip', 'brightness')|int(0) - 25]|max }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) > 76 %}
{{ [0, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) - 50]|max }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) > 26 and state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) < 76 %}
{{ [0, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) - 10]|max }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) > 6 and state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) < 27 %}
{{ [0, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) - 3]|max }}
{% elif state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) < 7 %}
{{ [0, state_attr('light.master_bedroom_main_lights', 'brightness')|int(0) - 1]|max }}
{% endif -%}
# Pico off button pressed
#
# If sensor.pico_mid_button_pressed is 1 then turn off light.desk_led_strip or
# if sensor.pico_mid_button_pressed is 0 then turn off light.master_bedroom_main_lights
- alias: pico remote off button pressed
trigger:
platform: state
entity_id: sensor.main_lights_remote_1
to: '4'
action:
service: light.turn_off
data_template:
entity_id: >-
{%- if is_state('sensor.pico_mid_button_pressed', '1') %}
light.desk_led_strip
{% else %}
light.master_bedroom_main_lights
{% endif -%}
Sensor entry in configuration.yaml
# Sensors
sensor:
- platform: mqtt
name: "pico_mid_button_pressed"
state_topic: "remote/mid_button"