-
Notifications
You must be signed in to change notification settings - Fork 99
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
add support for pico button events #81
Conversation
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.
Some minor comments here, and I notice Black complains that a couple lines are too long. The continuous integration service on this repository doesn't seem to be working anymore, but if you can open the code in Visual Studio Code with the development container option and run tox
it should give the same results.
Can you update the tests? The existing tests are failing because Bridge._accept_connection
in test_smartbridge.py
expects a certain sequence of requests. If you update it to expect requests related to buttons and return some basic button information then the existing tests should start passing again. There should be a test that verifies when a button press event is received the event handler gets called.
Co-authored-by: Matthew Donoughe <mdonoughe@gmail.com>
Co-authored-by: Matthew Donoughe <mdonoughe@gmail.com>
Co-authored-by: Matthew Donoughe <mdonoughe@gmail.com>
I'll setup VS Code & run tox / work on the tests. |
I've made the requested changes. Can you please review? |
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.
LGTM
Awesome! As soon as this gets released we can update Home Assistant to support picos without a pro bridge 👍 |
- Button presses are now monitored via LEAP - Telnet support is no longer required and lip usage has been removed - Requires gurumitts/pylutron-caseta#81 - Changelog: gurumitts/pylutron-caseta@v0.11.0...v0.12.0
Tested this with home-assistant/core#61032 and it works great @mdonoughe Would you mind pushing a new release ? Thanks! |
I was already making the commit. :) https://pypi.org/project/pylutron-caseta/0.12.0/ |
- Button presses are now monitored via LEAP - Telnet support is no longer required and lip usage has been removed - Requires gurumitts/pylutron-caseta#81 - Changelog: gurumitts/pylutron-caseta@v0.11.0...v0.12.0
- Button presses are now monitored via LEAP - Telnet support is no longer required and lip usage has been removed - Requires gurumitts/pylutron-caseta#81 - Changelog: gurumitts/pylutron-caseta@v0.11.0...v0.12.0
- Button presses are now monitored via LEAP - Telnet support is no longer required and lip usage has been removed - Requires gurumitts/pylutron-caseta#81 - Changelog: gurumitts/pylutron-caseta@v0.11.0...v0.12.0
Oh super cool. I wonder when they added this feature to the bridge. |
This code adds the ability to subscribe to Pico button events using LEAP.
A ReadRequest to /device will have some Pico devices. Each Pico will have a ButtonGroups tag with a buttongroup href and ID.
A ReadRequest to /button will return a series of Buttons tag linked to the above button group. Each of these is a button on the Pico.
As an example, a Pico device can have buttongroup 2, and that buttongroup can have buttons 103-107.
To subscribe to event notifications, send a SubscribeRequest for each button ID. For 103, for example, you’d send the SubscribeRequest with the URL /button/103/status/event
Whenever you press or release that Pico button, you’ll get a ButtonStatus body with a ButtonEvent, and the EventType of “Press” or “Release”.
This code finds any devices with buttongroups, gets the list of buttons, and subscribes to events from those buttons. Some new objects are added to retrieve buttons, subscribe to events from those buttons, and to handle response messages.