fix in setting temperature, avoid feedback loop
This commit is contained in:
@ -46,8 +46,13 @@ export class MaxThermostat extends AHomematicItem implements HasInTopic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processMessage(topic: string, payload: string) : void {
|
processMessage(topic: string, payload: string) : void {
|
||||||
if ((topic == this.temperatureTopic) || (topic == this.deviceFeedbackTopic)) {
|
let setTemperature : boolean = false
|
||||||
|
if (topic == this.temperatureTopic) {
|
||||||
this.temperature = parseFloat(payload)
|
this.temperature = parseFloat(payload)
|
||||||
|
setTemperature = true
|
||||||
|
} else if (topic == this.deviceFeedbackTopic) {
|
||||||
|
this.temperature = parseFloat(payload)
|
||||||
|
setTemperature = false
|
||||||
} else if (topic in this.windowContactMap) {
|
} else if (topic in this.windowContactMap) {
|
||||||
this.windowContactMap[topic].state = payload
|
this.windowContactMap[topic].state = payload
|
||||||
this.windowOpen = false
|
this.windowOpen = false
|
||||||
@ -56,14 +61,17 @@ export class MaxThermostat extends AHomematicItem implements HasInTopic {
|
|||||||
this.windowOpen = true
|
this.windowOpen = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setTemperature = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! this.windowOpen) {
|
if (setTemperature) {
|
||||||
mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`)
|
if (! this.windowOpen) {
|
||||||
mqttHandler.send(this.actionTopic, `${this.temperature}`)
|
mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`)
|
||||||
} else {
|
mqttHandler.send(this.actionTopic, `${this.temperature}`)
|
||||||
mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
} else {
|
||||||
mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||||
|
mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user