Move lockAlarm configuration to do_configure#2763
Conversation
Signed-off-by: HunsupJung <[email protected]>
|
Invitation URL: |
Test Results 72 files 489 suites 0s ⏱️ Results for commit 3706fb2. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 3706fb2 |
| device.thread:call_with_delay(5, function() | ||
| device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true})) | ||
| device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory | ||
| end) |
There was a problem hiding this comment.
I don't think the call_with_delay should be required here. We could put an if device:supports_capability(capabilities.lockAlarm) then gate if we are trying to ensure the device has this before emitting an event.
There was a problem hiding this comment.
When I tested it without call_with_delay, I could see the following log.
2026-03-06_05:36:55.892 | W | broker | <Matter Lock (c32ca1d6)> Attempted to generate event for d079b3f0-a761-4e01-886a-24fc0fd34154.main but it does not support capability lockAlarm
it seems to take time to change the profile after device:try_update_metadata({profile = profile_name})
There was a problem hiding this comment.
Yes, it does take a little while to update (and when it does, this will trigger infoChanged). I would suggest we create the if conditional:
if device:supports_capability(capabilities.lockAlarm) then
device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = true}))
device:emit_event(capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) -- lockJammed is mandatory
end
This accounts for the case where a device supports lockAlarm already, before a profile update, and then it never updates for whatever reason. To me it is safer. What do you think?
There was a problem hiding this comment.
If that occurs, then the capability should still be emitted in the info_changed handler following the profile update right? Or, does that not always work properly due to the bug from #2812 @hcarter-775 ?
Edit: sent this before refreshing so I didn't see your comment
There was a problem hiding this comment.
@hcarter-775
DoorLockAlarm is mendatory event, so all profile should include lockAlarm capability.
There is no profile except lockAlarm capability.
There was a problem hiding this comment.
I agree, but like you stated, this can happen:
2026-03-06_05:36:55.892 | W | broker | <Matter Lock (c32ca1d6)> Attempted to generate event for d079b3f0-a761-4e01-886a-24fc0fd34154.main but it does not support capability lockAlarm
meaning at this point the profile may not support it. And if it does later, the infoChanged event will trigger this. Therefore, we do not need to wait 5 seconds. Depending on the situation, in 5 seconds it is possible that a profile update still hasn't occurred.
Signed-off-by: HunsupJung <[email protected]>
Type of Change
Checklist
Description of Change
Summary of Completed Tests