rename summer/winter switch to heatingMainSwitch
This commit is contained in:
6
dist/Export.js
vendored
6
dist/Export.js
vendored
@ -33,11 +33,11 @@ function RelayBoxExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPr
|
||||
'openhab': RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) };
|
||||
}
|
||||
exports.RelayBoxExport = RelayBoxExport;
|
||||
function SummerSwitchExport(summerSwitchTopic) {
|
||||
function HeatingMainSwitchExport(topic) {
|
||||
return { 'homekit': { 'id': '', 'object': {} },
|
||||
'openhab': `Switch SummerSwitch "Winter?" {mqtt=">[localbroker:${summerSwitchTopic}:command:*:default],<[localbroker:${summerSwitchTopic}:state:default]"}` };
|
||||
'openhab': `Switch HeatingMainSwitch "Heizung Hauptschalter" {mqtt=">[localbroker:${topic}:command:*:default],<[localbroker:${topic}:state:default]"}` };
|
||||
}
|
||||
exports.SummerSwitchExport = SummerSwitchExport;
|
||||
exports.HeatingMainSwitchExport = HeatingMainSwitchExport;
|
||||
function RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||
return { 'id': '', 'object': {} };
|
||||
}
|
||||
|
22
dist/MaxThermostat.js
vendored
22
dist/MaxThermostat.js
vendored
@ -9,7 +9,7 @@ const DISABLED_TEMPERATURE = 5.0;
|
||||
class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
constructor(floor, room, item, label, hmId, hardDisablers) {
|
||||
super(floor, room, item, label, hmId);
|
||||
this.summerFlag = false;
|
||||
this.heatingMainFlag = false;
|
||||
this.temperatureTopic = `${this.topicFirstPart}/temperature`;
|
||||
this.temperatureFeedbackTopic = `${this.topicFirstPart}/temperature/feedback`;
|
||||
this.presetTemperatureTopic = `${this.topicFirstPart}/presetTemperature`;
|
||||
@ -22,7 +22,7 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
this.presetTemperatureTopic,
|
||||
this.deviceFeedbackTopic,
|
||||
this.commandTopic,
|
||||
MaxThermostat.summerSwitchTopic
|
||||
MaxThermostat.heatingMainSwitchTopic
|
||||
];
|
||||
this.hardDisabled = false;
|
||||
this.hardDisablerMap = {};
|
||||
@ -38,8 +38,8 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
exportItem() {
|
||||
return Export_1.ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic);
|
||||
}
|
||||
static exportSummerSwitchItem() {
|
||||
return Export_1.SummerSwitchExport(MaxThermostat.summerSwitchTopic);
|
||||
static exportHeatingMainSwitchItem() {
|
||||
return Export_1.HeatingMainSwitchExport(MaxThermostat.heatingMainSwitchTopic);
|
||||
}
|
||||
setPresetTemperature(presetTemperature) {
|
||||
this.presetTemperature = presetTemperature;
|
||||
@ -54,7 +54,7 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
setTemperature = true;
|
||||
}
|
||||
else if (topic == this.commandTopic) {
|
||||
if (!this.summerFlag) {
|
||||
if (this.heatingMainFlag) {
|
||||
if (payload == 'ON') {
|
||||
this.temperature = this.presetTemperature;
|
||||
}
|
||||
@ -64,9 +64,13 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
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) {
|
||||
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${DISABLED_TEMPERATURE}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${DISABLED_TEMPERATURE}`);
|
||||
}
|
||||
}
|
||||
else if (topic == this.presetTemperatureTopic) {
|
||||
this.presetTemperature = parseFloat(payload);
|
||||
@ -98,6 +102,6 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
MaxThermostat.summerSwitchTopic = 'dispatcher_ng/items/summerSwitch';
|
||||
MaxThermostat.heatingMainSwitchTopic = 'dispatcher_ng/items/heatingMainSwitch';
|
||||
exports.MaxThermostat = MaxThermostat;
|
||||
//# sourceMappingURL=MaxThermostat.js.map
|
6
dist/main.js
vendored
6
dist/main.js
vendored
@ -310,9 +310,9 @@ allLabeledItems.forEach((item) => {
|
||||
// logger.info(JSON.stringify(openhabList))
|
||||
}
|
||||
});
|
||||
let summerSwitchExport = MaxThermostat_1.MaxThermostat.exportSummerSwitchItem();
|
||||
if (summerSwitchExport != null) {
|
||||
let da = summerSwitchExport['openhab'];
|
||||
let heatingMainSwitchExport = MaxThermostat_1.MaxThermostat.exportHeatingMainSwitchItem();
|
||||
if (heatingMainSwitchExport != null) {
|
||||
let da = heatingMainSwitchExport['openhab'];
|
||||
openhabList.push(da);
|
||||
}
|
||||
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4));
|
||||
|
Reference in New Issue
Block a user