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 {
|
||||
if ((topic == this.temperatureTopic) || (topic == this.deviceFeedbackTopic)) {
|
||||
let setTemperature : boolean = false
|
||||
if (topic == this.temperatureTopic) {
|
||||
this.temperature = parseFloat(payload)
|
||||
setTemperature = true
|
||||
} else if (topic == this.deviceFeedbackTopic) {
|
||||
this.temperature = parseFloat(payload)
|
||||
setTemperature = false
|
||||
} else if (topic in this.windowContactMap) {
|
||||
this.windowContactMap[topic].state = payload
|
||||
this.windowOpen = false
|
||||
@ -56,14 +61,17 @@ export class MaxThermostat extends AHomematicItem implements HasInTopic {
|
||||
this.windowOpen = true
|
||||
}
|
||||
})
|
||||
setTemperature = true
|
||||
}
|
||||
|
||||
if (! this.windowOpen) {
|
||||
mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`)
|
||||
mqttHandler.send(this.actionTopic, `${this.temperature}`)
|
||||
} else {
|
||||
mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||
mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||
if (setTemperature) {
|
||||
if (! this.windowOpen) {
|
||||
mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`)
|
||||
mqttHandler.send(this.actionTopic, `${this.temperature}`)
|
||||
} else {
|
||||
mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||
mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user