Fix availability passive device timeout config. https://github.com/Koenkk/zigbee2mqtt/pull/10437

This commit is contained in:
Koen Kanters 2022-01-31 17:27:17 +01:00
parent 04290274b8
commit 912360c1f0
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ export default class Availability extends Extension {
const key = this.isActiveDevice(device) ? 'active' : 'passive'; const key = this.isActiveDevice(device) ? 'active' : 'passive';
const value = settings.get().availability[key]?.timeout; const value = settings.get().availability[key]?.timeout;
return key === 'active' ? utils.minutes(value) : utils.hours(value); return utils.minutes(value);
} }
private isActiveDevice(device: Device): boolean { private isActiveDevice(device: Device): boolean {

View File

@ -138,7 +138,7 @@ function loadSettingsWithDefaults(): void {
} }
if (_settingsWithDefaults.availability || _settingsWithDefaults.advanced?.availability_timeout) { if (_settingsWithDefaults.availability || _settingsWithDefaults.advanced?.availability_timeout) {
const defaults = {active: {timeout: 10}, passive: {timeout: 25}}; const defaults = {active: {timeout: 10}, passive: {timeout: 1500}};
const s = typeof _settingsWithDefaults.availability === 'object' ? _settingsWithDefaults.availability : {}; const s = typeof _settingsWithDefaults.availability === 'object' ? _settingsWithDefaults.availability : {};
// @ts-ignore // @ts-ignore
_settingsWithDefaults.availability = {}; _settingsWithDefaults.availability = {};