From 6061567871a3e5c9f4032ccd85b6a34e989b2658 Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Sun, 18 Jan 2026 20:11:45 -0500 Subject: [PATCH] feat: Capture `ctx.updateStatus` to correctly reflect timer completion status. --- rules/waterButtonLearnAndCall.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rules/waterButtonLearnAndCall.js b/rules/waterButtonLearnAndCall.js index 24eae54..d6516c0 100644 --- a/rules/waterButtonLearnAndCall.js +++ b/rules/waterButtonLearnAndCall.js @@ -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); } }