Lutron Pico configuration example

Aside from a few people mentioning that Lutron’s Pico remotes work with the various Lutron / Caséta components, I haven’t seen a good guide or any examples on how to integrate them directly into Hass.

Can anyone provide an example config or a bit more info on how to capture the button presses?

3 Likes

Lutron has 2 different remotes. The Pico remote works directly with Lutron switches and I’m not sure you can use that version separate from a switch. The Lutron connected remote is a Zigbee device and it can be used as a standalone remote.

Here is a simple example of how to trigger some service calls from Pico button state:

- alias: Office Pico
  initial_state: True
  hide_entity: False
  trigger:
    - platform: state
      entity_id: sensor.foyer_front_pico
      to: '2'
  action:
    - service: switch.turn_off
      entity_id: switch.office_hepa_switch
    - service: script.office_motion_timer
1 Like

If you have a Pro hub and using one of the Lutron custom components available, the Pico remotes show up as sensors.

Just like Kobold’s example above you use the pico sensor’s state to trigger automations.

For a pico that has 5 buttons (on, off, up, down and favorite) you’d need to create 5 automations for each of the buttons.

It works great.

Thanks guys!

If anyone else finds it useful, here’s a simple Pico automation I made to control my bedroom lights (hue), and use the center (fav) button to toggle the lights in the rest of the house.

FWIW - I do have the Lutron Caséta Pro hub.

# Pico state codes
# - On: 1
# - Up: 8
# - Fav: 2
# - Down: 16
# - Off: 4

# Turn on the lights outside of the bedroom if they're all off
- id: br_pico_fav_on
  alias: BR Pico fav button pressed
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '2'
  condition:
    condition: state
    entity_id: group.non_bedroom_lights
    state: 'off'
  action:
    service: homeassistant.turn_on
    entity_id: group.non_bedroom_lights

# Turn off the lights outside of the bedroom if any are on
- id: br_pico_fav_on
  alias: BR Pico fav button pressed
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '2'
  condition:
    condition: state
    entity_id: group.non_bedroom_lights
    state: 'on'
  action:
    service: homeassistant.turn_off
    entity_id: group.non_bedroom_lights

# Turn on the bedroom lights
- id: br_pico_on
  alias: BR Pico on
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '1'
  condition:
    condition: state
    entity_id: group.bedroom
    state: 'off'
  action:
    service: light.turn_on
    entity_id: group.bedroom

# Turn off the bedroom lights
- id: br_pico_off
  alias: BR Pico off
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '4'
  condition:
    condition: state
    entity_id: group.bedroom
    state: 'on'
  action:
    service: light.turn_off
    entity_id: group.bedroom

# Brighten the bedroom lights
- id: br_pico_up
  alias: BR Pico up
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '8'
  action:
    service: light.turn_on
    entity_id: group.bedroom
    data_template:
      brightness: >
        {% if is_state('group.bedroom', 'off') %}
        51
        {% else %}
        {% set suggested = states.light.dereks_lamp.attributes.brightness + 51 %}
        {% if suggested < 256 %}
        {{ suggested }}
        {% else %}
        255
        {% endif %}
        {% endif %}

# Dim the bedroom lights
- id: br_pico_down
  alias: BR Pico down
  initial_state: True
  trigger:
    - platform: state
      entity_id: sensor.pico
      to: '16'
  action:
    service: light.turn_on
    entity_id: group.bedroom
    data_template:
      brightness: >
        {% if is_state('group.bedroom', 'off') %}
        0
        {% else %}
        {% set suggested = states.light.dereks_lamp.attributes.brightness - 51 %}
        {% if suggested < 0 %}
        {{ suggested }}
        {% else %}
        0
        {% endif %}
        {% endif %}
3 Likes

Is this method available using Pico remotes in a radiora2 environment?

I don’t have the Pro bridge however when I start HA I see the following in the console

2018-01-27 22:27:30 DEBUG (MainThread) [pylutron_caseta.smartbridge] {‘ButtonGroups’: [{‘href’: ‘/buttongroup/9’}], ‘AssociatedArea’: {‘href’: ‘/area/5’}, ‘SerialNumber’: 30739643, ‘href’: ‘/device/16’, ‘ModelNumber’: ‘PJ2-3BRL-GXX-X01’, ‘Name’: ‘Pico 1’, ‘DeviceType’: ‘Pico3ButtonRaiseLower’, ‘FullyQualifiedName’: [‘Kitchen’, ‘Pico 1’], ‘Parent’: {‘href’: ‘/project’}}

Is this now showing up because the connection changed to using ssl? What I don’t see is any entity that matches sensor.Pico_1 and attempting to directly call it via the automation examples above does seem to work. when I press any buttons on it nothing shows up in the console.

Do I have to manually add the sensor under sensor:? if so what type is it?

That is just the output from the Lutron caseta component while it starts up and enumerates the devices. The non-Pro bridge does not send any events for Pico button presses and the component will not create any sensors for you. You need the Pro bridge for that and a custom component.

It’s really weird that the bridge will send the pico devices but not the events from them but yes I modified the existing smartbridge.py and I don’t see pico button pushes showing up to process. Fixing the components would be easy enough but if there is nothing coming in to process then we’re SOL.

@broox

Thanks for your code! You do have a typo though. In the “Dim the bedroom lights” part of your code you have the line {% if suggested < 0 %}. The comparator is switched. It should be {% if suggested > 0 %}.

Otherwise, this worked beautifully for me.

If we’re on the subject of improving the code… :wink:

This code works better for Brighten:
brightness: "{{ [255, state_attr('light.hue_color_lamp_1', 'brightness')|int(0) + 51]|min }}"

Use this for Dimming:
brightness: "{{ [0, state_attr('light.hue_color_lamp_1', 'brightness')|int(0) - 51]|max }}"

Makes it cleaner. Instead of an “IF, THEN” it uses a Min/Max checking to see if 0/255 is lower or higher than the specified value and uses the appropriate Min/Max.

6 Likes

Can anyone share an example of how the data template is used in the hassio GUI automation configuration?

I’ve looked all over google - but not found an example where the screen highlighted data template. Perhaps I’ve also overlooked something in the documentation, but I can’t find any examples there either, on a search in this community.

I couldn’t find an easy way to generalize using a pico remote for any non-lutron light, so I created a quick python_script for HA. This requires the PRO version of the lutron hub and the custom lutron component. Once setup, the below automation will work for any non-lutron light with very little boiler plate.

Example automation.yaml:

- id: foyer_light_by_pico
  alias: Foyer Light controlled by pico
  initial_state: True
  trigger:
    - platform: state
      from: 0
      entity_id: sensor.foyer_pico
  action:
  - data_template:
      entity_id: light.foyer_light
      new_state: "{{ trigger.to_state.state }}"
    service: python_script.pico_light_switch_std

In the above automation, simply change the pico and light entity IDs to add all standard Pico button automation.

The python_script to that handles the above is here: https://gist.github.com/catchdave/a6dc17be9a4f55559d12c1a094573707

Enjoy!

1 Like

Dave, been trying to thing of a way to handle the dimmer part for a few weeks now. Just rolled this out and working great.
I’m not a script guy, any way to make the favorite button toggle through some different colors?

1 Like

Yes. Something like the below (have not tested this at all).

  1. You would need to add a line to get the current color, near where I get current brightness.
    So:
cur_brightness = cur_entity_state.attributes['brightness']
cur_color = cur_entity_state.attributes['color']
  1. And then in the section for the favourite button, change it to:
color = cur_color + 30 # Or some other number you want to rotate colours by. 30 is arbitrary.
if color > 255: color = 0 # rgb color max is 255
  1. And finally, add the color to the payload:
if color is not None:
        action_data['rgb_color'] = color

Thank you Dave, this is awesome. Saves so much work and reduces the number of automations significantly! Just FYI for anyone, the zero in the trigger of the automation needs the apostrophe and should be ‘0’ instead of 0.

Thank you so much for that code! I love simplifying code what it makes it easier to follow.

I’ve been using this Python script with reasonable success, but is there any way to progressively dim the lighting while holding the pico brightness up or down?

I got the Pro Bridge (L-BDGPRO2-WH) and I can see the switches in HA, however, I don’t see any sensors created for any of the PICO remotes I added via the Lutron app.

Is there any special procedure to get access to these remotes in HA?

You need to use the Lutron Custom Component to get the Picos, it can be found here;

1 Like