add all existing items, homekit export
This commit is contained in:
11
dist/AItem.js
vendored
11
dist/AItem.js
vendored
@ -3,13 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const logger = require("./log");
|
||||
const MqttDispatcher_1 = require("./MqttDispatcher");
|
||||
class AItem {
|
||||
constructor(floor, room, item) {
|
||||
constructor(floor, room, item, label = '') {
|
||||
this.floor = floor;
|
||||
this.room = room;
|
||||
this.item = item;
|
||||
this.itemId = `${this.floor}.${this.room}.${this.item}`;
|
||||
if (label == '') {
|
||||
this.label = this.itemId;
|
||||
}
|
||||
else {
|
||||
this.label = label;
|
||||
}
|
||||
this.topicFirstPart = `dispatcher_ng/items/${this.floor}/${this.room}/${this.item}`;
|
||||
}
|
||||
exportHomekit() {
|
||||
return { 'id': this.itemId, 'object': null };
|
||||
}
|
||||
start() {
|
||||
MqttDispatcher_1.mqttHandler.register(this.subscribeTopics, (topic, payload) => {
|
||||
logger.info(`item ${this.itemId}: ${topic}, ${payload}`);
|
||||
|
Reference in New Issue
Block a user