fix SimpleTopic and remove homekit and openhab stuff
This commit is contained in:
@ -57,9 +57,9 @@ export class SimpleTopicSwitchItem extends AItem implements HasStateAndFeedbackT
|
||||
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
||||
if (this.state != this.oldState) {
|
||||
if (this.state == 'ON') {
|
||||
mqttHandler.send(this.actionTopic, 'true')
|
||||
mqttHandler.send(this.actionTopic, 'ON')
|
||||
} else {
|
||||
mqttHandler.send(this.actionTopic, 'false')
|
||||
mqttHandler.send(this.actionTopic, 'OFF')
|
||||
}
|
||||
this.oldState = this.state
|
||||
}
|
||||
|
34
src/main.ts
34
src/main.ts
@ -598,40 +598,6 @@ let watchdogTimer = setInterval(() => {
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
// Homekit export
|
||||
let homekitObject : { [key:string]:{} } = {}
|
||||
let openhabList : string[] = []
|
||||
|
||||
// logger.info("allLabeledItems")
|
||||
// logger.info(JSON.stringify(allLabeledItems))
|
||||
|
||||
allLabeledItems.forEach((item: AItem) => {
|
||||
let exportData : ExportType|null = item.exportItem()
|
||||
if (exportData != null) {
|
||||
if ('id' in exportData['homekit']) {
|
||||
homekitObject[exportData['homekit']['id']] = exportData['homekit']['object']
|
||||
}
|
||||
if (exportData['openhab'] instanceof Array) {
|
||||
let da : string[] = exportData['openhab'] as string[]
|
||||
da.forEach((o: string) => openhabList.push(o))
|
||||
} else {
|
||||
let da : string = exportData['openhab'] as string
|
||||
openhabList.push(da)
|
||||
}
|
||||
// logger.info("openHabList")
|
||||
// logger.info(JSON.stringify(openhabList))
|
||||
}
|
||||
})
|
||||
|
||||
let heatingMainSwitchExport : ExportType|null = MaxThermostat.exportHeatingMainSwitchItem()
|
||||
if (heatingMainSwitchExport != null) {
|
||||
let da : string = heatingMainSwitchExport['openhab'] as string
|
||||
openhabList.push(da)
|
||||
}
|
||||
|
||||
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4))
|
||||
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
|
||||
|
||||
|
||||
let roomSwitches: any = {}
|
||||
allLights.forEach((item: HasStateAndFeedbackTopicAndLabelAndRoom) => {
|
||||
|
Reference in New Issue
Block a user