some changes, not yet done with WindowContact, too cold in Q-West to complete
This commit is contained in:
32
src/MaxWindowContact.ts
Normal file
32
src/MaxWindowContact.ts
Normal 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)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user