home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.13k stars 31.11k forks source link

Lutron Caseta RA3 button events #105532

Closed silverbladeg closed 6 months ago

silverbladeg commented 11 months ago

The problem

Hi all, Recently got my RA3 processor. I am attempting to program various button presses off a Sunnata RF keypad within HA. The issue I'm running in to is that every button press on the keypad has a simultaneous press AND release event associated with it, for a total of 2 events. A long press generates 3 total events with the 3rd one being the "final release". Additionally, This is regardless of whether that button is defined as "Single Action" or "Scene Toggle" or "Zone Toggle" within lutron designer. This has created a lot extra complexity in trying to program the various button presses for me. I'm not certain this is intended behavior. If it is, could somebody point me in the right direction to defining short and long presses with such an event model? I can't get it to distinguish correctly no matter what permutation i try.

Thanks

What version of Home Assistant Core has the issue?

2023.8.4

What was the last working version of Home Assistant Core?

never worked

What type of installation are you running?

Home Assistant OS

Integration causing the issue

lutron_caseta

Link to integration documentation on our website

https://www.home-assistant.io/integrations/lutron_caseta/

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.8.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.4", "docker": true, "arch": "x86_64", "timezone": "America/Los_Angeles", "os_name": "Linux", "os_version": "6.1.45", "supervisor": "2023.11.6", "host_os": "Home Assistant OS 10.5", "docker_version": "23.0.6", "chassis": "vm", "run_as_root": true }, "custom_components": { "scrypted": { "version": "0.0.6", "requirements": [] }, "pirateweather": { "version": "1.2.3", "requirements": [ "python-forecastio==1.4.0" ] }, "flair": { "version": "0.1.10", "requirements": [ "flairaio==0.1.3" ] }, "meross_lan": { "version": "4.3.0", "requirements": [] }, "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "alarmo": { "version": "v1.9.10", "requirements": [] }, "dahua": { "version": "0.5.0", "requirements": [] }, "frigate": { "version": "4.0.0", "requirements": [ "pytz==2022.7" ] }, "adaptive_lighting": { "version": "1.18.3", "requirements": [ "ulid-transform" ] }, "lennoxs30": { "version": "2023.6.1", "requirements": [ "lennoxs30api==0.2.8" ] }, "mass": { "version": "2023.6.0b6", "requirements": [ "music-assistant==2.0.0b59" ] } }, "integration_manifest": { "domain": "lutron_caseta", "name": "Lutron Cas\u00e9ta", "codeowners": [ "@swails", "@bdraco", "@danaues" ], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/lutron_caseta", "homekit": { "models": [ "Smart Bridge" ] }, "iot_class": "local_push", "loggers": [ "pylutron_caseta" ], "requirements": [ "pylutron-caseta==0.18.1" ], "zeroconf": [ { "type": "_lutron._tcp.local.", "properties": { "SYSTYPE": "radiora3" } }, { "type": "_lutron._tcp.local.", "properties": { "SYSTYPE": "smartbridge" } }, { "type": "_lutron._tcp.local.", "properties": { "SYSTYPE": "ra2select*" } } ], "is_built_in": true }, "data": { "entry": { "title": "0584f742", "data": { "host": "192.168.0.209", "keyfile": "lutron_caseta-0584f742-key.pem", "certfile": "lutron_caseta-0584f742-cert.pem", "ca_certs": "lutron_caseta-0584f742-ca.pem" } }, "bridge_data": { "devices": { "1": { "device_id": "1", "current_state": -1, "fan_speed": null, "zone": "1", "name": "Equipment Room Processor 001", "button_groups": null, "type": "RadioRa3Processor", "model": "JanusProcRA3", "serial": 92600130, "area": "209", "device_name": "Processor 001" }, "696": { "device_id": "696", "current_state": -1, "fan_speed": null, "zone": null, "name": "Equipment Room_Device Location 001 Position 1 Keypad", "button_groups": [ "705" ], "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": 66218608, "control_station_name": "Device Location 001", "device_name": "Position 1", "area": "209" }, "701": { "device_id": "701", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 1 Keypad Button 1 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 1 LED", "parent_device": "696" }, "702": { "device_id": "702", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 1 Keypad Button 2 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 2 LED", "parent_device": "696" }, "703": { "device_id": "703", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 1 Keypad Button 3 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 3 LED", "parent_device": "696" }, "704": { "device_id": "704", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 1 Keypad Button 4 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 4 LED", "parent_device": "696" }, "732": { "device_id": "732", "current_state": -1, "fan_speed": null, "zone": null, "name": "Equipment Room_Device Location 001 Position 2 Keypad", "button_groups": [ "741" ], "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": null, "control_station_name": "Device Location 001", "device_name": "Position 2", "area": "209" }, "737": { "device_id": "737", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 2 Keypad Button 1 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 1 LED", "parent_device": "732" }, "738": { "device_id": "738", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 2 Keypad Button 2 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 2 LED", "parent_device": "732" }, "739": { "device_id": "739", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 2 Keypad Button 3 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 3 LED", "parent_device": "732" }, "740": { "device_id": "740", "current_state": 0, "fan_speed": null, "name": "Equipment Room_Device Location 001 Position 2 Keypad Button 4 LED", "type": "KeypadLED", "model": "KeypadLED", "serial": null, "zone": null, "device_name": "Button 4 LED", "parent_device": "732" } }, "buttons": { "706": { "device_id": "706", "current_state": "Release", "button_number": 1, "button_group": "705", "name": "Equipment Room_Device Location 001 Position 1 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": 66218608, "button_name": "Button 1", "button_led": "701", "device_name": "Button 1", "parent_device": "696" }, "710": { "device_id": "710", "current_state": "Release", "button_number": 2, "button_group": "705", "name": "Equipment Room_Device Location 001 Position 1 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": 66218608, "button_name": "Button 2", "button_led": "702", "device_name": "Button 2", "parent_device": "696" }, "714": { "device_id": "714", "current_state": "Release", "button_number": 3, "button_group": "705", "name": "Equipment Room_Device Location 001 Position 1 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": 66218608, "button_name": "Button 3", "button_led": "703", "device_name": "Button 3", "parent_device": "696" }, "718": { "device_id": "718", "current_state": "Release", "button_number": 4, "button_group": "705", "name": "Equipment Room_Device Location 001 Position 1 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": 66218608, "button_name": "Button 4", "button_led": "704", "device_name": "Button 4", "parent_device": "696" }, "742": { "device_id": "742", "current_state": "Release", "button_number": 1, "button_group": "741", "name": "Equipment Room_Device Location 001 Position 2 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": null, "button_name": "Button 1", "button_led": "737", "device_name": "Button 1", "parent_device": "732" }, "746": { "device_id": "746", "current_state": "Release", "button_number": 2, "button_group": "741", "name": "Equipment Room_Device Location 001 Position 2 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": null, "button_name": "Button 2", "button_led": "738", "device_name": "Button 2", "parent_device": "732" }, "750": { "device_id": "750", "current_state": "Release", "button_number": 3, "button_group": "741", "name": "Equipment Room_Device Location 001 Position 2 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": null, "button_name": "Button 3", "button_led": "739", "device_name": "Button 3", "parent_device": "732" }, "754": { "device_id": "754", "current_state": "Release", "button_number": 4, "button_group": "741", "name": "Equipment Room_Device Location 001 Position 2 Keypad", "type": "SunnataKeypad", "model": "RRST-W4B-XX", "serial": null, "button_name": "Button 4", "button_led": "740", "device_name": "Button 4", "parent_device": "732" } }, "scenes": {}, "occupancy_groups": {}, "areas": { "3": { "id": "3", "name": "Magnolia", "parent_id": null }, "209": { "id": "209", "name": "Equipment Room", "parent_id": "3" } } }, "integration_data": { "keypad_button_names_to_leap": { "696": { "Button 1": 1, "Button 2": 2, "Button 3": 3, "Button 4": 4 }, "732": { "Button 1": 1, "Button 2": 2, "Button 3": 3, "Button 4": 4 } }, "keypad_buttons": { "706": { "lutron_device_id": "706", "leap_button_number": 1, "button_name": "Button 1", "led_device_id": "701", "parent_keypad": "696" }, "710": { "lutron_device_id": "710", "leap_button_number": 2, "button_name": "Button 2", "led_device_id": "702", "parent_keypad": "696" }, "714": { "lutron_device_id": "714", "leap_button_number": 3, "button_name": "Button 3", "led_device_id": "703", "parent_keypad": "696" }, "718": { "lutron_device_id": "718", "leap_button_number": 4, "button_name": "Button 4", "led_device_id": "704", "parent_keypad": "696" }, "742": { "lutron_device_id": "742", "leap_button_number": 1, "button_name": "Button 1", "led_device_id": "737", "parent_keypad": "732" }, "746": { "lutron_device_id": "746", "leap_button_number": 2, "button_name": "Button 2", "led_device_id": "738", "parent_keypad": "732" }, "750": { "lutron_device_id": "750", "leap_button_number": 3, "button_name": "Button 3", "led_device_id": "739", "parent_keypad": "732" }, "754": { "lutron_device_id": "754", "leap_button_number": 4, "button_name": "Button 4", "led_device_id": "740", "parent_keypad": "732" } }, "keypads": { "696": { "lutron_device_id": "696", "dr_device_id": "f47bef001cb19f278368e8e1e31aa808", "area_id": "209", "area_name": "Equipment Room", "name": "Device Location 001 Position 1 Keypad", "serial": 66218608, "device_info": { "name": "Equipment Room Device Location 001 Position 1 Keypad", "manufacturer": "Lutron Electronics Co., Inc", "identifiers": [ [ "lutron_caseta", 66218608 ] ], "model": "RRST-W4B-XX (SunnataKeypad)", "via_device": [ "lutron_caseta", 92600130 ], "suggested_area": "Equipment Room" }, "model": "RRST-W4B-XX", "type": "SunnataKeypad", "buttons": [ "706", "710", "714", "718" ] }, "732": { "lutron_device_id": "732", "dr_device_id": "4e59067f8572f81b8dc8247662e3aaf6", "area_id": "209", "area_name": "Equipment Room", "name": "Device Location 001 Position 2 Keypad", "serial": "92600130_732", "device_info": { "name": "Equipment Room Device Location 001 Position 2 Keypad", "manufacturer": "Lutron Electronics Co., Inc", "identifiers": [ [ "lutron_caseta", "92600130_732" ] ], "model": "RRST-W4B-XX (SunnataKeypad)", "via_device": [ "lutron_caseta", 92600130 ], "suggested_area": "Equipment Room" }, "model": "RRST-W4B-XX", "type": "SunnataKeypad", "buttons": [ "742", "746", "750", "754" ] } } } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 11 months ago

Hey there @swails, @bdraco, @danaues, mind taking a look at this issue as it has been labeled with an integration (lutron_caseta) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `lutron_caseta` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign lutron_caseta` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


lutron_caseta documentation lutron_caseta source (message by IssueLinks)

altShiftDev commented 10 months ago

@silverbladeg sorry to hijack your thread but I'm considering purchasing an ra3 setup with sunnata keypads and wanted to know if you'd recommend them for use with HASS?

As for your question, this is similar to how javascript events are handled on websites. mouseup and mousedown events fire on button clicks and devs can decide to listen for either... but most go with mouseup as it usually implies the final action. In your case final release would be your equivalent and likely the one you want.

It's possible this level of granularity exists so a long press and hold event can be used to indicate a dimmer action. e.g. it triggers a function to continually increment the brightness until it detects the final release event and stops dimming. IIRC the sunnata keypads come in 2 flavors, one are binary scene buttons and others are scenes + dimming which might be your situation.

silverbladeg commented 10 months ago

Hey,

Regarding the events, the problem is that home assistant only sees press and release. So in the case of a long press it's press, release.... release. It doesn't separately label as "final release". So I'm stuck playing with some wonky wait logic. I have no idea how but I have a working solution lol. It took a lot of trial and error and it's just janky but it works without fail (only time it doesn't if you just keep holding the press button for "too long" based on my wait logic and then it trips up and executes the short press which is acceptable in my use case for now). I should probably post that here so someone can a) use it if needed b) improve it, I'm not a programmer.

Re sunnata. Yes. And if you don't care for long press etc then it's dead simple. I might even nix my long press use case. so far I've installed one and it's working perfectly. I've purchased several, since they're going every room. It's tied to a remodel we are doing so they'll get rolled out at the end but I have one in "production" so to speak and it's working great. You need to write a separate blueprint for the keypad LEDs to sync, I think that's worked almost 95-99% but I've have some quirks which are no doubt an issue on my end with the programming logic which I need to sort out. Imo they're the best keypads esp if your in a higher end house and want to maintain an aesthetic and don't mind the cost. If you don't think it matters, then caesta should work just fine. Btw, I'm paranoid enough about this given the large investment in all these keypads that I'm never updating that firmware and if there's compatibility issues in the future I'm just gonna run them on a as working HA instance separately, I just don't want to deal with this logic breaking ever again and it protects me from getting "Chamberlained" if they somehow break this integration and it can't be reversed.

altShiftDev commented 10 months ago

That makes sense. What color combo did you go with? I was thinking of doing the midnight with stainless steel covers as it looks quite stunning in their promo pics. That being said, it's quite an opinionated aesthetic and I'm likely to follow your strategy of getting the hub + 1 as a beta test before going all in to prod. I'd love a pic if you don't mind sharing your setup!

silverbladeg commented 10 months ago

Ha, I had the exact same initial thought as you on the colors etc, then common sense (aka wife) prevailed and were going with snow white to match the rest of our interior - it's keypads, you want it to blend in not standout as the main feature on the wall...or so I was educated 😂

altShiftDev commented 10 months ago

Hah, this issue is getting super derailed but you have no idea how much anxiety your last comment gave me... I'm the designer in our couple and I asked my partner if she was cool with this color combo and she told me "I trust you completely". Now after reading your comment I'm definitely stressed about this. 😂

I agree with your wife conceptually that light switches should be accent pieces drawing the eye... usually! But there's always that what if it's awesome voice in my head lol.

OOC did you go with prolighting.com? It seems to be one of the few online distributors willing to sell to the public that I could find but I'm open to other suggestions if you have any.

silverbladeg commented 10 months ago

Fwiw our interior designer overruled my initial selection as well, so that was 2:1 😂. Go on reddit, look for LutronMaster - he's amazing, very professional and above board and great prices.

atlflyer commented 9 months ago

I don't have an answer on if it's intended behavior or not (my guess is that the integration is just faithfully reporting what the Lutron devices send it), but for my Lutron Picos I have one automation that I add every single button "press" event to that sets a datetime helper to {{ now() }}. Then in my automations to react to specific buttons, if I care about short press or long press I check a template condition like {{ as_timestamp(now()) - as_timestamp(states(''input_datetime.last_pico_press'')) > 1.5 }}

That's a pretty long time to regard it as a long press, but I only use that for rare cases and I was sometimes getting false positives with lower values, so I wanted long presses to feel very distinct from short presses.

I only used one helper for every button for simplicity since it would be a very unusual in my use cases for 2 buttons to be pressed that quickly.

silverbladeg commented 9 months ago

Thanks @atlflyer , very interesting solution, I have a working solution that's using "wait", but it's quite janky. I'll test our yours this coming weekend and report back. - Thanks for sharing

issue-triage-workflows[bot] commented 6 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.