add all existing items, homekit export

This commit is contained in:
Wolfgang Hottgenroth
2018-01-10 14:15:43 +01:00
parent 153b8570e4
commit 8a6547ff91
20 changed files with 746 additions and 42 deletions

View File

@ -1,6 +1,7 @@
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem } from './AItem'
import { SwitchHomekitExport, HomekitExportType } from './Export'
export class M433SwitchItem extends AItem {
@ -11,9 +12,10 @@ export class M433SwitchItem extends AItem {
private actionTopic: string
private stateFeedbackTopic: string
private stateTopic: string
private type: string
constructor(floor: string, room: string, item: string, onCode: string, offCode: string) {
super(floor, room, item)
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`
this.subscribeTopics = [this.stateTopic]
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`
@ -22,6 +24,11 @@ export class M433SwitchItem extends AItem {
this.oldState = undefined
this.onCode = onCode
this.offCode = offCode
this.type = type
}
exportHomekit() : HomekitExportType {
return SwitchHomekitExport(this.itemId, this.label, this.stateTopic, this.stateFeedbackTopic, this.type)
}
processMessage(topic: string, payload: string) {