some changes, not yet done with WindowContact, too cold in Q-West to complete

This commit is contained in:
Wolfgang Hottgenroth
2018-01-15 16:20:59 +01:00
parent 677f9c807d
commit f88cf5ee0d
4 changed files with 104 additions and 11 deletions

32
src/MaxWindowContact.ts Normal file
View File

@ -0,0 +1,32 @@
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AHomematicItem } from './AHomematicItem'
// import { SwitchExport, ExportType } from './Export'
export class MaxWindowContact extends AHomematicItem {
private deviceFeedbackTopic: string
private stateFeedbackTopic: string
private stateTopic: string
private state: string
getStateFeedbackTopic(): string {
return this.stateFeedbackTopic
}
constructor(floor: string, room: string, item: string, label: string, hmId: number) {
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
]
}
processMessage(topic: string, payload: string) : void {
this.state = payload
mqttHandler.send(this.stateFeedbackTopic, this.state)
}
}