create static objets not in code
Closed this issue · 0 comments
chaozmc commented
create this objects and info-channel in io-package.json instead of creating them in code
Lines 34 to 79 in 861e620
//create the connection-state variable | |
this.log.debug("[onReady] create connection datapoint"); | |
await this.setObjectNotExistsAsync("info.connection", { | |
type: "state", | |
common: { | |
name: "connection", | |
type: "boolean", | |
role: "indicator", | |
desc: "Test", | |
read: true, | |
write: false, | |
}, | |
native: {}, | |
}); | |
//create a rescan state which will trigger a complete rescan of all datapoints, like it's done on adapter load | |
this.log.debug("[onReady] create rescan datapoint"); | |
await this.setObjectNotExistsAsync("info.rescan", { | |
type: "state", | |
common: { | |
name: "rescan", | |
type: "boolean", | |
role: "button", | |
desc: "Rescan JSON and create (missing) datapoints", | |
read: true, | |
write: true, | |
}, | |
native: {}, | |
}); | |
//create an update state, which will trigger an update of all datapoints | |
this.log.debug("[onReady] create update datapoint"); | |
await this.setObjectNotExistsAsync("info.update", { | |
type: "state", | |
common: { | |
name: "update", | |
type: "boolean", | |
role: "button", | |
desc: "Trigger an update of all states now", | |
read: true, | |
write: true, | |
}, | |
native: {}, | |
}); |