Double click on lutron pico remotes

i’m happily running upsert’s code on my lutron pro. whilst its easily enough to change the sensor code to pick up single clicks, what i would like to do is to pick up double taps on the pico remote. does anyone have any examples of this?

I’m looking for the same thing. Following…

I would like to know the same, but for long pushes for dimming. I have some of the two button picos, working with my newly purchased Lutron Pro Hub.

just a quick update: i ended up creating a timer that gets activated on the first sensor button press. it’s a short timer of 1 sec. then i have another automation that has a condition that the timer is active in order to trigger the double tap. eg:

    - alias: Double Tap Start
      trigger:
      - platform: state
        entity_id:
        - sensor.hallway_remote
        - sensor.mudroom_great_room_remote
        - sensor.mudroom_hallway_remote
      action:
      - service: timer.start
        entity_id: timer.button_double_tap
    
    - alias: Hallway Remote Double Tap Catch On
      trigger:
      - platform: state
        entity_id:
        - sensor.hallway_remote
        - sensor.mudroom_great_room_remote
        - sensor.mudroom_hallway_remote
        to: "1"
      condition:
        condition: and
        conditions:
        - condition: template
          value_template: "{{ is_state('timer.button_double_tap', 'active') }}"
      action:
      - service: light.turn_on
        entity_id: light.great_room
      - service: timer.cancel
        entity_id: timer.button_double_tap
1 Like

Thanks for sharing. Do you have an action defined for a single press? How do you stop that from running if you double-press?

Hi @bjvanst, I realise I’m answering a pretty old post but if you haven’t found a solution yet, maybe this can help.

My suggestion would be to set a duration (like 1s) on your double-press timer. Then, for your single press action that you’d like to run, rather than running it on the first press, create an automation that triggers on timer.finished on the double-press timer. It wouldn’t run the action instantly, but would only run when your double-press timer has finished (without a double-press taking place). You could probably adjust the timer to minimize the delay while still ensuring it always catches your double-presses.

So you’d have 3 automations in total:

  1. Trigger on button press, timer=idle, start the timer
  2. Trigger on button press, timer=active, cancel the timer and run your double-press action.
  3. Trigger on timer.finished, run your single-press action

I’m pretty new to home assistant, so I’m still exploring how to do all this in a more elegant fashion (e.g. in a single automation using if/else template statements, and maybe using these new blueprints to abstract away all the double-press logic so I can just specify the button and the double-press action). Otherwise right now, I have separate timers and 2 automations for every double-press action I’ve implemented.

Replying to myself to note that you don’t need to use templates to get the if/else behaviour I suggested. (Not sure if you could even do it with templates).

The Choose action does exactly what I was looking for:

I recommend python script for this. I replied to the thread on gihub with some thoughts!

Because a python script can be triggered from an automation with parameters, can read/Wright state more easily using entity attributes (metadata), has more powerful syntax for complex logic, and lastly can create and trigger events/entities directly in HomeAssistant.

Initially though one of the main problems is that any automation tied to the single press would trigger twice, unless the script handled both single and double presses…but one thing python script isn’t good at doing is waiting. And you’d loose the responsiveness of the single press if it waited for 2 seconds to see if another press would come; I fear 500ms would be too fast for reliability of far away from the hub.

So there are some complex details to work out… I suppose an AppDaemon script could work best because it supports async waits but is much more complex to develop.

Alternatively rather than a double press, a long press may simplify it and I already shared a solution I have used for long press support via python script here:

I forgot to share this but I ended up solving my double-press issue using the wait_for_trigger action:

trigger:
- entity_id: sensor.pico_remte
  platform: numeric_state
  above: 0

mode: single

action:
- wait_for_trigger:
  - platform: template
    value_template: "{{ is_state(trigger.entity_id, (trigger.to_state).state) }}"
  timeout:
    milliseconds: 250
  continue_on_timeout: true

The timeout can be modified to suit your preference. Too short and you’ll miss a lot of double-presses. Too long and it’ll ruin the user experience by causing a lag between the button press and the automation running. 250 to 500 ms works best in my experience, erring towards the low end.

I forked the original project to support double and long press. check this post: Double and long press support for lutron-caseta-pro

1 Like

I just wanted to say “thanks!” This is great, I had moved away from the custom component since the standard integration now supports the pico remotes, but adding double and long press is a game changer. I’d love for this to be intergrated into the standard component. Again, great job. Love it

Glad you found it useful. Long press (or hold) is the one of first few things I was looking at when i moved from Hubitat to HA platform. Since original author (upsert) was reluctant to add double/long press support I decided to fork and do it myself and it was a great learning experience (to design custom component).

Just updated the github for bug fix and new feature:

  1. fix a bug that treats two press (from different button) as a single double press (if both were pressed within double_press_time)
  2. Add press combination feature. You can pre-program a series of button press in configuration.yaml. If all matched it will generate one state change (also pre-programmed). I plan to use this function to open my garage door with a pico remote in my car.

Just a heads up that the latest HA 2022.4.0 has an issue with the fan component.

2022-04-06 11:38:20 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform lutron_caseta_pro.fan: Platform not found (cannot import name ‘SPEED_HIGH’ from ‘homeassistant.components.fan’ (/usr/src/homeassistant/homeassistant/components/fan/init.py)).

@Dalong - Thanks again for this custom integration. I see the one that this is forked from made some changes to the Fan entity a couple of months ago, to change to speed percentages. I suspect it’s a easy merge to fix. Thanks again for this, I use the double tap quite a bit in my home.

I merged the changes to my branch. Works on my device with latest HA core update.