add all existing items, homekit export
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import * as logger from './log'
|
||||
import { mqttHandler } from './MqttDispatcher'
|
||||
import { AHomematicItem } from './AHomematicItem'
|
||||
|
||||
import { SwitchHomekitExport, HomekitExportType } from './Export'
|
||||
|
||||
export class HomematicSwitchItem extends AHomematicItem {
|
||||
private oldState: string|undefined
|
||||
@ -10,9 +10,10 @@ export class HomematicSwitchItem extends AHomematicItem {
|
||||
private deviceFeedbackTopic: string
|
||||
private stateFeedbackTopic: string
|
||||
private stateTopic: string
|
||||
private type: string
|
||||
|
||||
constructor(floor: string, room: string, item: string, hmId: number) {
|
||||
super(floor, room, item, hmId)
|
||||
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`
|
||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`
|
||||
this.deviceFeedbackTopic = `${this.deviceTopicPre}/1/STATE`
|
||||
@ -23,8 +24,12 @@ export class HomematicSwitchItem extends AHomematicItem {
|
||||
]
|
||||
this.state = 'OFF'
|
||||
this.oldState = undefined
|
||||
this.type = type
|
||||
}
|
||||
|
||||
exportHomekit() : HomekitExportType {
|
||||
return SwitchHomekitExport(this.itemId, this.label, this.stateTopic, this.stateFeedbackTopic, this.type)
|
||||
}
|
||||
|
||||
processMessage(topic: string, payload: string) : void {
|
||||
switch (topic) {
|
||||
|
Reference in New Issue
Block a user