New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix lutron caseta triggers when device fails to setup before startup finishes #82714
Conversation
Hey there @swails, @danaues, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
c42ba11
to
3542218
Compare
class LutronButton(TypedDict): | ||
"""A lutron_caseta button.""" | ||
|
||
lutron_device_id: int | ||
leap_button_number: int | ||
button_name: str | ||
led_device_id: int | ||
led_device_id: str | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typing on this was wrong
) -> LutronKeypadData: | ||
"""Register keypad devices (Keypads and Pico Remotes) in the device registry.""" | ||
|
||
device_registry = dr.async_get(hass) | ||
|
||
bridge_devices = bridge.get_devices() | ||
bridge_buttons = bridge.buttons | ||
bridge_devices: dict[str, dict[str, str | int]] = bridge.get_devices() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had so much trouble following this code so I added some more typing to make sure I didn't screw it up
3542218
to
6cd7510
Compare
…finishes Refactor the trigger attach so its not dependant on the intergration being already setup fixes home-assistant#82495 & fixes home-assistant#81999
6cd7510
to
d45d057
Compare
@@ -298,6 +302,8 @@ async def test_if_fires_on_button_event_without_lip(hass, calls, device_reg): | |||
ATTR_DEVICE_NAME: device["Name"], | |||
ATTR_AREA_NAME: device.get("Area", {}).get("Name"), | |||
ATTR_ACTION: "press", | |||
ATTR_DEVICE_ID: device_id, | |||
ATTR_BUTTON_TYPE: "Kitchen Pendants", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been a button type and not a name since it is unstable if the name is changed on the lutron device.
I can't fix this in this PR as it would require a redesign and a breaking change
@danaues This should avoid the revert but I can't fix the instability with the name changing in this PR since it would be a breaking change. Can you test this on your system? |
I’m away from my system right now, but I’ll give it a full test tomorrow afternoon when I’m back. |
@danaues did you have time to test it? |
Just finished testing. Looks good! |
Thanks. I tested the other systems |
Proposed change
Refactor the trigger attach so its not dependent on the integration being already setup
Alternative to #82605 which avoids reverting #80797 which is where this regressed
fixes #82495 & fixes #81999 & closes #82605 & fixes https://community.home-assistant.io/t/lutron-caseta-pico-not-firing-automations-in-11-2/487552 & fixes https://community.home-assistant.io/t/lutron-caseta-pico-core-integration-only/280419/75?u=bdraco
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: