"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const MqttDispatcher_1 = require("./MqttDispatcher"); const AHomegearItem_1 = require("./AHomegearItem"); const Export_1 = require("./Export"); class MaxWindowContact extends AHomegearItem_1.AHomegearItem { getStateFeedbackTopic() { return this.stateFeedbackTopic; } getLabel() { return this.label; } transform(payload) { let res; if (payload == 'OPEN') { res = 'DISABLE'; } else if (payload == 'CLOSED') { res = 'ENABLE'; } else { res = 'UNKNOWN'; } return res; } constructor(floor, room, item, label, hmId) { super(floor, room, item, label, hmId); this.stateTopic = `${this.topicFirstPart}/state`; this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`; this.deviceFeedbackTopic = `${this.deviceTopicPre}/1/STATE`; this.subscribeTopics = [ this.stateTopic, this.deviceFeedbackTopic ]; } exportItem() { return Export_1.ContactExport(this.itemId, this.label, this.stateFeedbackTopic); } processMessage(topic, payload) { if (payload == 'true') { this.state = 'OPEN'; } else { this.state = 'CLOSED'; } MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state); } } exports.MaxWindowContact = MaxWindowContact; //# sourceMappingURL=MaxWindowContact.js.map