feat: Capture ctx.updateStatus to correctly reflect timer completion status.

This commit is contained in:
sebseb7
2026-01-18 20:11:45 -05:00
parent e226032d0b
commit 6061567871

View File

@@ -185,8 +185,11 @@ export default {
// Normal mode - schedule light to turn on after stored duration
ctx.log(`Light off. Will turn on in ${state.storedDuration}ms`);
// Capture updateStatus for use in timer callback
const updateStatus = ctx.updateStatus;
// Push status update to dashboard
ctx.updateStatus({
updateStatus({
storedDuration: state.storedDuration,
countMode: false,
timerActive: true,
@@ -198,8 +201,13 @@ export default {
await setLight(ctx, mac, true, 20);
state.timer = null;
// Can't use ctx.updateStatus here since ctx is out of scope
// The timer completing will be reflected in next getStatus() call
// Push timer completed status
updateStatus({
storedDuration: state.storedDuration,
countMode: false,
timerActive: false,
lastAction: 'Timer completed'
});
}, state.storedDuration);
}
}