introduce interfaces for state/feedback topics

This commit is contained in:
Wolfgang Hottgenroth
2018-01-11 13:52:09 +01:00
parent c7834fefb1
commit 28eec19e53
7 changed files with 92 additions and 54 deletions

View File

@ -2,8 +2,9 @@ import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AHomematicItem } from './AHomematicItem'
import { SwitchExport, ExportType } from './Export'
import { HasStateAndFeedbackTopic } from './AItem';
export class HomematicSwitchItem extends AHomematicItem {
export class HomematicSwitchItem extends AHomematicItem implements HasStateAndFeedbackTopic {
private oldState: string|undefined
private state: string
private actionTopic: string
@ -12,6 +13,14 @@ export class HomematicSwitchItem extends AHomematicItem {
private stateTopic: string
private type: string
getStateTopic() : string {
return this.stateTopic
}
getStateFeedbackTopic() : string {
return this.stateFeedbackTopic
}
constructor(floor: string, room: string, item: string, label: string, hmId: number, type: string = 'bulb') {
super(floor, room, item, label, hmId)
this.stateTopic = `${this.topicFirstPart}/state`