-
Notifications
You must be signed in to change notification settings - Fork 523
Matter Thermostat: Set supportedThermostatOperatingStates if applicable #2723
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: main
Are you sure you want to change the base?
Conversation
|
Invitation URL: |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 3b325e9 |
d6c5e1b to
fb4330e
Compare
| device:subscribe() | ||
| device:set_component_to_endpoint_fn(thermostat_utils.component_to_endpoint) | ||
| device:set_endpoint_to_component_fn(thermostat_utils.endpoint_to_component) | ||
| thermostat_utils.handle_thermostat_operating_state_info(device) |
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 think that this running in init could falsely cause an offline device to be marked online since it emits a capability. doConfigure might be a better spot for this call (infoChanged as well in case to update the capability if the profile changes)?
Edit: thinking about it again, I'm not sure if this is true for a driver-scoped lifecycle event.
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 did add it to info_changed. I also put it in init because I want already existing devices to be udpated. Finally, I believe the {visibility = {displayed = false}} option should fix the issue you're describing? Or am I misremembering what that does?
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.
Edit 2: I confirmed that this does indeed cause offline devices to be marked online
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 edited the conditional to only set this if it has not been set before. Effectively, that will only do the setting once, on startup. Else, it will do this once for existing devices (and may make offline devices appear online in-app, once)
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.
Perfect, thanks!
Description of Change
Set the
supportedThermostatOperatingStates, if applicable, based on the feature map of the device.Summary of Completed Tests
Unit tests updated.