add all existing items, homekit export
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user