rename summer/winter switch to heatingMainSwitch
This commit is contained in:
@ -3,7 +3,7 @@ import { mqttHandler } from './MqttDispatcher'
|
||||
import { HasInTopic } from './AItem'
|
||||
import { AHomegearItem } from './AHomegearItem'
|
||||
// import { MaxWindowContact } from './MaxWindowContact';
|
||||
import { ThermostatExport, SummerSwitchExport, ExportType } from './Export'
|
||||
import { ThermostatExport, HeatingMainSwitchExport, ExportType } from './Export'
|
||||
import { Disabler } from './Disabler'
|
||||
|
||||
const DISABLED_TEMPERATURE: number = 5.0
|
||||
@ -26,8 +26,8 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
private hardDisabled: boolean
|
||||
private commandTopic: string
|
||||
|
||||
static summerSwitchTopic : string = 'dispatcher_ng/items/summerSwitch'
|
||||
private summerFlag: boolean = false
|
||||
static heatingMainSwitchTopic : string = 'dispatcher_ng/items/heatingMainSwitch'
|
||||
private heatingMainFlag: boolean = false
|
||||
|
||||
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
||||
|
||||
@ -39,8 +39,8 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
return ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic)
|
||||
}
|
||||
|
||||
static exportSummerSwitchItem() : ExportType|null {
|
||||
return SummerSwitchExport(MaxThermostat.summerSwitchTopic)
|
||||
static exportHeatingMainSwitchItem() : ExportType|null {
|
||||
return HeatingMainSwitchExport(MaxThermostat.heatingMainSwitchTopic)
|
||||
}
|
||||
|
||||
constructor(floor: string, room: string, item: string, label: string, hmId: number, hardDisablers: Disabler[]) {
|
||||
@ -57,7 +57,7 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
this.presetTemperatureTopic,
|
||||
this.deviceFeedbackTopic,
|
||||
this.commandTopic,
|
||||
MaxThermostat.summerSwitchTopic
|
||||
MaxThermostat.heatingMainSwitchTopic
|
||||
]
|
||||
this.hardDisabled = false
|
||||
this.hardDisablerMap = {}
|
||||
@ -81,7 +81,7 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
this.temperature = parseFloat(payload)
|
||||
setTemperature = true
|
||||
} else if (topic == this.commandTopic) {
|
||||
if (! this.summerFlag) {
|
||||
if (this.heatingMainFlag) {
|
||||
if (payload == 'ON') {
|
||||
this.temperature = this.presetTemperature
|
||||
} else if (payload == 'OFF') {
|
||||
@ -89,9 +89,13 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
}
|
||||
setTemperature = true
|
||||
}
|
||||
} else if (topic == MaxThermostat.summerSwitchTopic) {
|
||||
this.summerFlag = (payload == 'ON')
|
||||
logger.info(`${this.itemId} switched to ${this.summerFlag ? 'Summer' : 'Winter'} mode`)
|
||||
} else if (topic == MaxThermostat.heatingMainSwitchTopic) {
|
||||
this.heatingMainFlag = (payload == 'ON')
|
||||
logger.info(`${this.itemId} heating main: ${this.heatingMainFlag}`)
|
||||
if (! this.heatingMainFlag) {
|
||||
mqttHandler.send(this.temperatureFeedbackTopic, `${DISABLED_TEMPERATURE}`)
|
||||
mqttHandler.send(this.actionTopic, `${DISABLED_TEMPERATURE}`)
|
||||
}
|
||||
} else if (topic == this.presetTemperatureTopic) {
|
||||
this.presetTemperature = parseFloat(payload)
|
||||
mqttHandler.send(this.presetTemperatureFeedbackTopic, `${this.presetTemperature}`)
|
||||
|
Reference in New Issue
Block a user