Skip to content

Commit 2e8e399

Browse files
committed
fix ping expectation in controller saveConfiguration method
1 parent 921375c commit 2e8e399

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

dist/kobold-alarm-clock-card.js

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/kobold-alarm-clock-card.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/alarm-controller.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,16 @@ export class AlarmController {
278278
replace_attributes: true
279279
};
280280

281-
if (this.alarmClockPingEntity?.state === 'on' || !this.alarmClockPingEntity) {
282-
this._hass.callService('variable', 'update_sensor', param);
283-
this._controllersAlarmConfig = Object.assign(new AlarmConfiguration, configurationWithLastUpdated);
284-
} else {
285-
if (this._config.debug) {
286-
this._hass.callService('system_log', 'write', { 'message': '*** Save attempted while clock disconnected from Home Assistant', 'level': 'info' });
281+
if (this.alarmClockPingEntity) {
282+
if (this.alarmClockPingEntity?.state === 'on' || !this.alarmClockPingEntity) {
283+
this._hass.callService('variable', 'update_sensor', param);
284+
this._controllersAlarmConfig = Object.assign(new AlarmConfiguration, configurationWithLastUpdated);
285+
} else {
286+
if (this._config.debug) {
287+
this._hass.callService('system_log', 'write', { 'message': '*** Save attempted while clock disconnected from Home Assistant', 'level': 'info' });
288+
}
289+
alert('Save failed. No connection to Home Assistant.');
287290
}
288-
alert('Save failed. No connection to Home Assistant.');
289291
}
290292
}
291293
}

0 commit comments

Comments
 (0)