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

@ -1,19 +1,27 @@
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem } from './AItem'
import { AItem, HasStateAndFeedbackTopic } from './AItem'
import { SwitchExport, ExportType } from './Export'
export class M433SwitchItem extends AItem {
export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopic {
private offCode: string
private onCode: string
private oldState: string|undefined
private state: string
private actionTopic: string
private stateFeedbackTopic: string
public stateTopic: string
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, onCode: string, offCode: string, type: string = 'bulb') {
super(floor, room, item, label)
this.stateTopic = `${this.topicFirstPart}/state`