This commit is contained in:
Koen Kanters
2019-02-18 19:46:57 +01:00
parent cc45413e2d
commit 26bed2d998
+15
View File
@@ -14,6 +14,7 @@ class BridgeConfig {
// Bind functions
this.permitJoin = this.permitJoin.bind(this);
this.lastSeen = this.lastSeen.bind(this);
this.reset = this.reset.bind(this);
this.logLevel = this.logLevel.bind(this);
this.devices = this.devices.bind(this);
@@ -24,6 +25,7 @@ class BridgeConfig {
// Set supported options
this.supportedOptions = {
'permit_join': this.permitJoin,
'last_seen': this.lastSeen,
'reset': this.reset,
'log_level': this.logLevel,
'devices': this.devices,
@@ -47,6 +49,19 @@ class BridgeConfig {
});
}
lastSeen(topic, message) {
const allowed = ['disable', 'ISO_8601', 'epoch'];
message = message.toString();
if (!allowed.includes(message)) {
logger.error(`${message} is not an allowed value, possible: ${allowed}`);
return;
}
settings.set(['advanced', 'last_seen'], message);
logger.info(`Set last_seen to ${message}`);
}
logLevel(topic, message) {
const level = message.toString().toLowerCase();
if (allowedLogLevels.includes(level)) {