"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const AItem_1 = require("./AItem"); const MqttDispatcher_1 = require("./MqttDispatcher"); class SwitchAdaptor extends AItem_1.AItem { constructor(floor, room, item) { super(floor, room, item); this.actionStateTopic = `${this.topicFirstPart}/state`; this.inTopic = `${this.topicFirstPart}/in`; this.subscribeTopics = [this.inTopic]; this.state = 'OFF'; } getInTopic() { return this.inTopic; } processMessage(topic, payload) { switch (topic) { case this.inTopic: switch (payload) { case 'SHORT': if (this.state == 'OFF') { this.state = 'ON'; } else { this.state = 'OFF'; } MqttDispatcher_1.mqttHandler.send(this.actionStateTopic, this.state, true); break; } break; } } } exports.SwitchAdaptor = SwitchAdaptor; //# sourceMappingURL=SwitchAdaptor.js.map