-
Notifications
You must be signed in to change notification settings - Fork 491
Matter Switch: Update find default endpoint #2155
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
base: profile-energy-child-plugs
Are you sure you want to change the base?
Matter Switch: Update find default endpoint #2155
Conversation
Invitation URL: |
Minimum allowed coverage is Generated by 🐒 cobertura-action against fd2bb89 |
Wouldn't the default endpoint always be the first switch (or button if there are no switches) endpoint? Child devices would be created for any additional endpoints that implement OnOff |
Not sure exactly what you're asking @nickolas-deboom, sorry. The default endpoint shouldn't have to be the first endpoint that implements onOff in all cases, but as it stands that's basically how it is, which in general is not correct. For now, it works, but it may not work in all cases. |
-- Return the first switch endpoint as the default endpoint if no button endpoints are present | ||
if #button_eps == 0 and #switch_eps > 0 then | ||
return get_first_non_zero_endpoint(switch_eps) | ||
if #switch_eps then |
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.
if #switch_eps then | |
if #switch_eps > 0 then |
You might need > 0
since 0 would evaluate to true
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.
true, thanks!
Description of Change
This PR aims to expand and clarify the use of find_default_endpoint in the matter switch driver. At the moment, nothing should change as far as logic, but this will create a more extensible system moving forward.
This builds on top of the plug-energy PR, but technically does not need to.
Summary of Completed Tests