Update main.js
This commit is contained in:
48
main.js
48
main.js
@@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user