Update main.js

master
钟进 6 years ago
parent 815904ef41
commit b6f44cc454

@ -301,6 +301,54 @@ function parseConfig(callback) {
checkObjects(adapter.config, 'door', 'door', 'Door', tasks, newObjects);
tasks.push({
id: 'info',
name: 'add',
obj: {
type: 'channel',
common: {
name: 'info'
},
native: {}
}
});
adapter.getObject('info.connection', function (err, obj) {
if (!obj) {
obj = {
type: 'state',
common: {
name: 'Number of connected partners',
role: 'indicator.connected',
write: false,
read: true,
type: 'boolean'
},
native: {}
};
adapter.setObjectNotExists('info.connection', obj);
}
});
newObjects.push(adapter.namespace + '.info.connection');
// clear unused states
for (let id_ in oldObjects) {
if (oldObjects.hasOwnProperty(id_) && newObjects.indexOf(id_) === -1) {
tasks.push({
id: id_,
name: 'del'
});
}
}
processTasks(tasks, function () {
oldObjects = [];
newObjects = [];
adapter.subscribeStates('*');
callback(options);
});
});

Loading…
Cancel
Save