Skip to content

Commit 0471c31

Browse files
luethelclaude
andcommitted
Clear alarm state when the alarm list is empty (upstream PR TKnpl#22)
When the v2 alarms endpoint returns success but no active (non-archived) alarm, reset the 'alarm' state to false and clear the internal tracking so a previously triggered alarm does not stay stuck. Also warn when the API responds with success=false. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3e3c9ad commit 0471c31

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ class Divera247 extends utils.Adapter {
365365
this.log.debug('alarm is closed');
366366
internalAlarmData.alarmClosed = alarmContent.closed;
367367
}
368+
} else if (content.success) {
369+
// API call succeeded but there is no active (non-archived) alarm -> clear a previously set alarm (see upstream PR #22)
370+
if (internalAlarmData.alarmID !== 0) {
371+
this.setState('alarm', { val: false, ack: true });
372+
internalAlarmData.alarmID = 0;
373+
internalAlarmData.alarmClosed = true;
374+
this.log.debug('alarm list is empty - alarm cleared');
375+
}
376+
} else {
377+
this.log.warn('api content retrieval not successful');
368378
}
369379
}
370380
).catch(

0 commit comments

Comments
 (0)