rework thermostat

This commit is contained in:
2018-04-06 23:00:41 +02:00
parent 9db2aebf09
commit 37acc620d5
9 changed files with 134 additions and 50 deletions

View File

@ -2,8 +2,9 @@ import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AHomegearItem } from './AHomegearItem'
import { ContactExport, ExportType } from './Export'
import { Disabler } from './Disabler'
export class MaxWindowContact extends AHomegearItem {
export class MaxWindowContact extends AHomegearItem implements Disabler {
private deviceFeedbackTopic: string
private stateFeedbackTopic: string
private stateTopic: string
@ -13,6 +14,18 @@ export class MaxWindowContact extends AHomegearItem {
return this.stateFeedbackTopic
}
transform(payload: string) : string {
let res: string
if (payload == 'OPEN') {
res = 'DISABLE'
} else if (payload == 'CLOSED') {
res = 'ENABLE'
} else {
res = 'UNKNOWN'
}
return res
}
constructor(floor: string, room: string, item: string, label: string, hmId: number) {
super(floor, room, item, label, hmId)
this.stateTopic = `${this.topicFirstPart}/state`