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) };
|
'openhab': RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) };
|
||||||
}
|
}
|
||||||
exports.RelayBoxExport = RelayBoxExport;
|
exports.RelayBoxExport = RelayBoxExport;
|
||||||
function SummerSwitchExport(summerSwitchTopic) {
|
function HeatingMainSwitchExport(topic) {
|
||||||
return { 'homekit': { 'id': '', 'object': {} },
|
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) {
|
function RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||||
return { 'id': '', 'object': {} };
|
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 {
|
class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||||
constructor(floor, room, item, label, hmId, hardDisablers) {
|
constructor(floor, room, item, label, hmId, hardDisablers) {
|
||||||
super(floor, room, item, label, hmId);
|
super(floor, room, item, label, hmId);
|
||||||
this.summerFlag = false;
|
this.heatingMainFlag = false;
|
||||||
this.temperatureTopic = `${this.topicFirstPart}/temperature`;
|
this.temperatureTopic = `${this.topicFirstPart}/temperature`;
|
||||||
this.temperatureFeedbackTopic = `${this.topicFirstPart}/temperature/feedback`;
|
this.temperatureFeedbackTopic = `${this.topicFirstPart}/temperature/feedback`;
|
||||||
this.presetTemperatureTopic = `${this.topicFirstPart}/presetTemperature`;
|
this.presetTemperatureTopic = `${this.topicFirstPart}/presetTemperature`;
|
||||||
@ -22,7 +22,7 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
this.presetTemperatureTopic,
|
this.presetTemperatureTopic,
|
||||||
this.deviceFeedbackTopic,
|
this.deviceFeedbackTopic,
|
||||||
this.commandTopic,
|
this.commandTopic,
|
||||||
MaxThermostat.summerSwitchTopic
|
MaxThermostat.heatingMainSwitchTopic
|
||||||
];
|
];
|
||||||
this.hardDisabled = false;
|
this.hardDisabled = false;
|
||||||
this.hardDisablerMap = {};
|
this.hardDisablerMap = {};
|
||||||
@ -38,8 +38,8 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
exportItem() {
|
exportItem() {
|
||||||
return Export_1.ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic);
|
return Export_1.ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic);
|
||||||
}
|
}
|
||||||
static exportSummerSwitchItem() {
|
static exportHeatingMainSwitchItem() {
|
||||||
return Export_1.SummerSwitchExport(MaxThermostat.summerSwitchTopic);
|
return Export_1.HeatingMainSwitchExport(MaxThermostat.heatingMainSwitchTopic);
|
||||||
}
|
}
|
||||||
setPresetTemperature(presetTemperature) {
|
setPresetTemperature(presetTemperature) {
|
||||||
this.presetTemperature = presetTemperature;
|
this.presetTemperature = presetTemperature;
|
||||||
@ -54,7 +54,7 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
setTemperature = true;
|
setTemperature = true;
|
||||||
}
|
}
|
||||||
else if (topic == this.commandTopic) {
|
else if (topic == this.commandTopic) {
|
||||||
if (!this.summerFlag) {
|
if (this.heatingMainFlag) {
|
||||||
if (payload == 'ON') {
|
if (payload == 'ON') {
|
||||||
this.temperature = this.presetTemperature;
|
this.temperature = this.presetTemperature;
|
||||||
}
|
}
|
||||||
@ -64,9 +64,13 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
setTemperature = true;
|
setTemperature = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (topic == MaxThermostat.summerSwitchTopic) {
|
else if (topic == MaxThermostat.heatingMainSwitchTopic) {
|
||||||
this.summerFlag = (payload == 'ON');
|
this.heatingMainFlag = (payload == 'ON');
|
||||||
logger.info(`${this.itemId} switched to ${this.summerFlag ? 'Summer' : 'Winter'} mode`);
|
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) {
|
else if (topic == this.presetTemperatureTopic) {
|
||||||
this.presetTemperature = parseFloat(payload);
|
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;
|
exports.MaxThermostat = MaxThermostat;
|
||||||
//# sourceMappingURL=MaxThermostat.js.map
|
//# 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))
|
// logger.info(JSON.stringify(openhabList))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let summerSwitchExport = MaxThermostat_1.MaxThermostat.exportSummerSwitchItem();
|
let heatingMainSwitchExport = MaxThermostat_1.MaxThermostat.exportHeatingMainSwitchItem();
|
||||||
if (summerSwitchExport != null) {
|
if (heatingMainSwitchExport != null) {
|
||||||
let da = summerSwitchExport['openhab'];
|
let da = heatingMainSwitchExport['openhab'];
|
||||||
openhabList.push(da);
|
openhabList.push(da);
|
||||||
}
|
}
|
||||||
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4));
|
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4));
|
||||||
|
@ -50,4 +50,4 @@ Switch base_labor_relaybox1 "Herd" {mqtt=">[localbroker:dispatcher_ng/items/base
|
|||||||
String base_labor_relaybox1Conflict "Herd [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/1:state:default]"}
|
String base_labor_relaybox1Conflict "Herd [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/1:state:default]"}
|
||||||
Switch base_labor_relaybox2 "Waschküche" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/2:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/2:state:default]"}
|
Switch base_labor_relaybox2 "Waschküche" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/2:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/2:state:default]"}
|
||||||
String base_labor_relaybox2Conflict "Waschküche [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/2:state:default]"}
|
String base_labor_relaybox2Conflict "Waschküche [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/2:state:default]"}
|
||||||
Switch SummerSwitch "Winter?" {mqtt=">[localbroker:dispatcher_ng/items/summerSwitch:command:*:default],<[localbroker:dispatcher_ng/items/summerSwitch:state:default]"}
|
Switch HeatingMainSwitch "Heizung Hauptschalter" {mqtt=">[localbroker:dispatcher_ng/items/heatingMainSwitch:command:*:default],<[localbroker:dispatcher_ng/items/heatingMainSwitch:state:default]"}
|
@ -51,9 +51,9 @@ export function RelayBoxExport(itemId: string, stateTopicPre: string, feedbackTo
|
|||||||
'openhab': RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames)}
|
'openhab': RelayBoxOpenHABExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames)}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SummerSwitchExport(summerSwitchTopic: string) : ExportType {
|
export function HeatingMainSwitchExport(topic: string) : ExportType {
|
||||||
return {'homekit': {'id':'', 'object': {}},
|
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]"}`}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RelayBoxHomekitExport(itemId: string, stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : HomekitExportType{
|
function RelayBoxHomekitExport(itemId: string, stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : HomekitExportType{
|
||||||
|
@ -3,7 +3,7 @@ import { mqttHandler } from './MqttDispatcher'
|
|||||||
import { HasInTopic } from './AItem'
|
import { HasInTopic } from './AItem'
|
||||||
import { AHomegearItem } from './AHomegearItem'
|
import { AHomegearItem } from './AHomegearItem'
|
||||||
// import { MaxWindowContact } from './MaxWindowContact';
|
// import { MaxWindowContact } from './MaxWindowContact';
|
||||||
import { ThermostatExport, SummerSwitchExport, ExportType } from './Export'
|
import { ThermostatExport, HeatingMainSwitchExport, ExportType } from './Export'
|
||||||
import { Disabler } from './Disabler'
|
import { Disabler } from './Disabler'
|
||||||
|
|
||||||
const DISABLED_TEMPERATURE: number = 5.0
|
const DISABLED_TEMPERATURE: number = 5.0
|
||||||
@ -26,8 +26,8 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
|||||||
private hardDisabled: boolean
|
private hardDisabled: boolean
|
||||||
private commandTopic: string
|
private commandTopic: string
|
||||||
|
|
||||||
static summerSwitchTopic : string = 'dispatcher_ng/items/summerSwitch'
|
static heatingMainSwitchTopic : string = 'dispatcher_ng/items/heatingMainSwitch'
|
||||||
private summerFlag: boolean = false
|
private heatingMainFlag: boolean = false
|
||||||
|
|
||||||
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
// 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)
|
return ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
static exportSummerSwitchItem() : ExportType|null {
|
static exportHeatingMainSwitchItem() : ExportType|null {
|
||||||
return SummerSwitchExport(MaxThermostat.summerSwitchTopic)
|
return HeatingMainSwitchExport(MaxThermostat.heatingMainSwitchTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(floor: string, room: string, item: string, label: string, hmId: number, hardDisablers: Disabler[]) {
|
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.presetTemperatureTopic,
|
||||||
this.deviceFeedbackTopic,
|
this.deviceFeedbackTopic,
|
||||||
this.commandTopic,
|
this.commandTopic,
|
||||||
MaxThermostat.summerSwitchTopic
|
MaxThermostat.heatingMainSwitchTopic
|
||||||
]
|
]
|
||||||
this.hardDisabled = false
|
this.hardDisabled = false
|
||||||
this.hardDisablerMap = {}
|
this.hardDisablerMap = {}
|
||||||
@ -81,7 +81,7 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
|||||||
this.temperature = parseFloat(payload)
|
this.temperature = parseFloat(payload)
|
||||||
setTemperature = true
|
setTemperature = true
|
||||||
} else if (topic == this.commandTopic) {
|
} else if (topic == this.commandTopic) {
|
||||||
if (! this.summerFlag) {
|
if (this.heatingMainFlag) {
|
||||||
if (payload == 'ON') {
|
if (payload == 'ON') {
|
||||||
this.temperature = this.presetTemperature
|
this.temperature = this.presetTemperature
|
||||||
} else if (payload == 'OFF') {
|
} else if (payload == 'OFF') {
|
||||||
@ -89,9 +89,13 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
|||||||
}
|
}
|
||||||
setTemperature = true
|
setTemperature = true
|
||||||
}
|
}
|
||||||
} else if (topic == MaxThermostat.summerSwitchTopic) {
|
} else if (topic == MaxThermostat.heatingMainSwitchTopic) {
|
||||||
this.summerFlag = (payload == 'ON')
|
this.heatingMainFlag = (payload == 'ON')
|
||||||
logger.info(`${this.itemId} switched to ${this.summerFlag ? 'Summer' : 'Winter'} mode`)
|
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) {
|
} else if (topic == this.presetTemperatureTopic) {
|
||||||
this.presetTemperature = parseFloat(payload)
|
this.presetTemperature = parseFloat(payload)
|
||||||
mqttHandler.send(this.presetTemperatureFeedbackTopic, `${this.presetTemperature}`)
|
mqttHandler.send(this.presetTemperatureFeedbackTopic, `${this.presetTemperature}`)
|
||||||
|
@ -401,9 +401,9 @@ allLabeledItems.forEach((item: AItem) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let summerSwitchExport : ExportType|null = MaxThermostat.exportSummerSwitchItem()
|
let heatingMainSwitchExport : ExportType|null = MaxThermostat.exportHeatingMainSwitchItem()
|
||||||
if (summerSwitchExport != null) {
|
if (heatingMainSwitchExport != null) {
|
||||||
let da : string = summerSwitchExport['openhab'] as string
|
let da : string = heatingMainSwitchExport['openhab'] as string
|
||||||
openhabList.push(da)
|
openhabList.push(da)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user