-
Notifications
You must be signed in to change notification settings - Fork 524
Move lockAlarm configuration to do_configure #2763
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
Signed-off-by: HunsupJung <hunsup.jung@samsung.com>
|
Invitation URL: |
Test Results 71 files 485 suites 0s ⏱️ For more details on these failures, see this check. Results for commit c5127c3. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against c5127c3 |
| end | ||
| end | ||
| device:subscribe() | ||
| device:emit_event(capabilities.lockAlarm.alarm.clear({state_change = 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.
I think we should leave this here, since the call_with_delay may have some unforeseen race-y conditions.
To avoid double emitting events, we could add an
if device:get_latest_state("main", capabilities.lockAlarm.ID, capabilities.lockAlarm.supportedAlarmValues.NAME) == nil then
check to ensure the same call wasn't done earlier? However, double calling these events in this context doesn't seem like a big issue to me
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Type of Change
Checklist
Description of Change
Summary of Completed Tests