Skip to content
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

Working RA3 Support for Pairing, Switches/Dimmers, Sunnata Keypads and PICOs #101

Merged
merged 27 commits into from Aug 13, 2022

Conversation

danaues
Copy link
Contributor

@danaues danaues commented Jun 30, 2022

This PR adds support for Pairing the RA3 Processor, as well as supporting Switches, Dimmers Sunnata Keypads and PICOs.

Tested pairing and operating on a Caseta Pro bridge, and an RA3 Processor through HA.

Tested devices on RA3:
Sunnata LED+ Dimmer
Sunnata Keypad - 3 Button Raise Lower
Sunnata Keypad - 4 Button
Masetro Pro LED+ Dimmer
Pico 3 Button Raise Lower

Tested devices on Caseta Pro:
Caseta ELV+ Dimmers
Caseta Switch

The vast majority of this work was completed by @johninaustin , and I've just carried the torch the last few miles to get it working.

I've attempted to fix the issues identified in the original RA3 Initial support PR, based on the comments within that thread.

This does not yet support scenes, occupancy sensors, or LEDs.

@danaues
Copy link
Contributor Author

danaues commented Jun 30, 2022

Also, support for the Sunnata Keypads depends on changes to the lutron_caseta HA integration. I've made the changes and issued a PR to get them implemented.

pylutron_caseta/__init__.py Show resolved Hide resolved
pylutron_caseta/pairing.py Outdated Show resolved Hide resolved
pylutron_caseta/smartbridge.py Outdated Show resolved Hide resolved
pylutron_caseta/smartbridge.py Outdated Show resolved Hide resolved
pylutron_caseta/smartbridge.py Outdated Show resolved Hide resolved
pylutron_caseta/smartbridge.py Outdated Show resolved Hide resolved
pylutron_caseta/smartbridge.py Outdated Show resolved Hide resolved
communique_type="ReadRequest",
url=f"/area/{area_id}/associatedcontrolstation",
)
station_result = response_from_json_file(f"ra3-area{area_id}cs.json")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to use folders? ra3/area/{area_id}/station.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've revised the responses into a directory structure like you've suggested

@@ -154,7 +157,7 @@ async def fake_connect():

self.target = smartbridge.Smartbridge(fake_connect)

async def initialize(self):
async def initialize(self, processor="Caseta"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use constants or something instead of the string literal "Caseta"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I"ll need a bit of help here. I didn't edit or use this test_smartbridge.py file. How do I use/invoke it to evaluate any changes I make? These edits were made by @johninaustin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've defined a constant DEFAULT_PROCESSOR and assigned it the string "Caseta"

@pytest.fixture(name="ra3_bridge")
async def fixture_bridge_ra3() -> AsyncGenerator[Bridge, None]:
"""Create a RA3 bridge attached to a fake reader and writer."""
harness = Bridge()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should probably use bridge_uninit like the Caseta version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i've updated to match the bridge_uninit like the Caseta version

@mdonoughe
Copy link
Collaborator

I made some minor changes at https://github.com/danaues/pylutron-caseta/compare/ra3...mdonoughe:pylutron-caseta:ra3?expand=1 . I don't have access to update this branch.

The tests don't work. During the initialization of the fake bridge, SmartBridge tries to read /device?where=IsThisDevice:true but there is no response for that so the test aborts.

The quickest way to run the tests is to type pytest.

@mdonoughe mdonoughe mentioned this pull request Aug 9, 2022
@danaues
Copy link
Contributor Author

danaues commented Aug 9, 2022

ok thanks @mdonoughe . I'll check it out. I've invited you as a collaborator to my branch if you want to be able to make changes there too.

@danaues
Copy link
Contributor Author

danaues commented Aug 9, 2022

Ok I figured out how to merge your changes into my branch. I'll do some testing and find a way to fix the failing test. Thanks!

@danaues
Copy link
Contributor Author

danaues commented Aug 9, 2022

I've revised the test and now pytest is no longer failing

@danaues
Copy link
Contributor Author

danaues commented Aug 9, 2022

@mdonoughe Would you mind checking out my commit when you have time? I think I've managed to satisfy all the outstanding issues with the tests.

@danaues
Copy link
Contributor Author

danaues commented Aug 13, 2022

@mdonoughe Thanks for all your help on this. I really appreciate it.
Cheer!

@mdonoughe
Copy link
Collaborator

Is there more that needs to be done? I deployed this to my Home Assistant and it seems okay so far, but I have Caseta so it should be working exactly the same as before in my case.

@danaues
Copy link
Contributor Author

danaues commented Aug 13, 2022

I have 2 PRs for the lutron_caseta HA integration that need to be merged to make it all work.

This PR is required to manage the "None" serial we're passing to HA for RA3 light zones.
home-assistant/core#75323
I have to figure out how to make a test file for this, this is my biggest challenge so far.

This PR is required to map the "SunnataKeypad" DeviceType for event handling.
home-assistant/core#75324

I've also got preliminary occupation sensing in my pylutron-caseta ra3-occupancy branch, but I want to do some more work on it before submitting a PR.

@peterxrock
Copy link

I have Home Assistant and a full RA3 system. Haven't installed anything outside HA before, but with a little instruction, I volunteer to test anything needed.

@johninaustin
Copy link
Contributor

@danaues Thank you for getting this done! You're awesome!

I finally closed on my house and am starting to actually install RA3 hardware. Prior to that I'd just been playing with the processor and 1 physical Pico - the rest were just virtual devices created in Designer.

I'm anxious to get started working on all this again.

@danaues
Copy link
Contributor Author

danaues commented Aug 18, 2022

@peterxrock , come join us here, I'd appreciate some testing help
danaues#7

@achecchia
Copy link

achecchia commented Feb 10, 2023

Any control over the keypad LED? I'm holding back from upgrading my ra2 over to ra3. So far, everything I have in my house is supported. If SeeTouch Keypad LED control is implemented, I'll bring a Ra3 repeater home tomorrow.

@danaues
Copy link
Contributor Author

danaues commented Feb 10, 2023

@achecchia , yes keypad LEDs are fully implemented.

@achecchia
Copy link

how about press and hold on picos? i have a test HA on a VM in my office with a small Ra3 system, and all i get are the actual button presses. Any way to have double tap or hold?

I only ask because currently i have my ra2 system at my house attached to hubitat, and i exposed the Lutron devices from hubitat to home assistant which gives me those features.

thanks for everything! you are a legend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants