add summer/winter switch
This commit is contained in:
5
dist/Export.js
vendored
5
dist/Export.js
vendored
@ -33,6 +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) {
|
||||||
|
return { 'homekit': { 'id': '', 'object': {} },
|
||||||
|
'openhab': `Switch SummerSwitch "Winter?" {mqtt=">[localbroker:${summerSwitchTopic}:command:*:default],<[localbroker:${summerSwitchTopic}:state:default]"}` };
|
||||||
|
}
|
||||||
|
exports.SummerSwitchExport = SummerSwitchExport;
|
||||||
function RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
function RelayBoxHomekitExport(itemId, stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames) {
|
||||||
return { 'id': '', 'object': {} };
|
return { 'id': '', 'object': {} };
|
||||||
}
|
}
|
||||||
|
39
dist/MaxThermostat.js
vendored
39
dist/MaxThermostat.js
vendored
@ -6,15 +6,9 @@ const AHomegearItem_1 = require("./AHomegearItem");
|
|||||||
const Export_1 = require("./Export");
|
const Export_1 = require("./Export");
|
||||||
const DISABLED_TEMPERATURE = 5.0;
|
const DISABLED_TEMPERATURE = 5.0;
|
||||||
class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||||
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
|
||||||
getInTopic() {
|
|
||||||
return this.commandTopic;
|
|
||||||
}
|
|
||||||
exportItem() {
|
|
||||||
return Export_1.ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic, this.presetTemperatureTopic, this.presetTemperatureFeedbackTopic);
|
|
||||||
}
|
|
||||||
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.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`;
|
||||||
@ -26,7 +20,8 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
this.temperatureTopic,
|
this.temperatureTopic,
|
||||||
this.presetTemperatureTopic,
|
this.presetTemperatureTopic,
|
||||||
this.deviceFeedbackTopic,
|
this.deviceFeedbackTopic,
|
||||||
this.commandTopic
|
this.commandTopic,
|
||||||
|
MaxThermostat.summerSwitchTopic
|
||||||
];
|
];
|
||||||
this.hardDisabled = false;
|
this.hardDisabled = false;
|
||||||
this.hardDisablerMap = {};
|
this.hardDisablerMap = {};
|
||||||
@ -35,6 +30,16 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
this.hardDisablerMap[hardDisabler.getStateFeedbackTopic()] = { disabler: hardDisabler, state: 'unknown' };
|
this.hardDisablerMap[hardDisabler.getStateFeedbackTopic()] = { disabler: hardDisabler, state: 'unknown' };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
||||||
|
getInTopic() {
|
||||||
|
return this.commandTopic;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
setPresetTemperature(presetTemperature) {
|
setPresetTemperature(presetTemperature) {
|
||||||
this.presetTemperature = presetTemperature;
|
this.presetTemperature = presetTemperature;
|
||||||
}
|
}
|
||||||
@ -48,13 +53,18 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
setTemperature = true;
|
setTemperature = true;
|
||||||
}
|
}
|
||||||
else if (topic == this.commandTopic) {
|
else if (topic == this.commandTopic) {
|
||||||
if (payload == 'ON') {
|
if (!this.summerFlag) {
|
||||||
this.temperature = this.presetTemperature;
|
if (payload == 'ON') {
|
||||||
|
this.temperature = this.presetTemperature;
|
||||||
|
}
|
||||||
|
else if (payload == 'OFF') {
|
||||||
|
this.temperature = DISABLED_TEMPERATURE;
|
||||||
|
}
|
||||||
|
setTemperature = true;
|
||||||
}
|
}
|
||||||
else if (payload == 'OFF') {
|
}
|
||||||
this.temperature = DISABLED_TEMPERATURE;
|
else if (topic == MaxThermostat.summerSwitchTopic) {
|
||||||
}
|
this.summerFlag = (payload == 'ON');
|
||||||
setTemperature = true;
|
|
||||||
}
|
}
|
||||||
else if (topic == this.presetTemperatureTopic) {
|
else if (topic == this.presetTemperatureTopic) {
|
||||||
this.presetTemperature = parseFloat(payload);
|
this.presetTemperature = parseFloat(payload);
|
||||||
@ -86,5 +96,6 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MaxThermostat.summerSwitchTopic = 'dispatcher_ng/items/summerSwitch';
|
||||||
exports.MaxThermostat = MaxThermostat;
|
exports.MaxThermostat = MaxThermostat;
|
||||||
//# sourceMappingURL=MaxThermostat.js.map
|
//# sourceMappingURL=MaxThermostat.js.map
|
5
dist/main.js
vendored
5
dist/main.js
vendored
@ -310,6 +310,11 @@ allLabeledItems.forEach((item) => {
|
|||||||
// logger.info(JSON.stringify(openhabList))
|
// logger.info(JSON.stringify(openhabList))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let summerSwitchExport = MaxThermostat_1.MaxThermostat.exportSummerSwitchItem();
|
||||||
|
if (summerSwitchExport != null) {
|
||||||
|
let da = summerSwitchExport['openhab'];
|
||||||
|
openhabList.push(da);
|
||||||
|
}
|
||||||
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4));
|
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4));
|
||||||
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'));
|
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'));
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Switch 1st_Anna_AquariumLight "Aquariumlicht"{mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/AquariumLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/AquariumLight/state/feedback:state:default]"}
|
Switch 1st_Anna_AquariumLight "Aquariumlicht"{mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/AquariumLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/AquariumLight/state/feedback:state:default]"}
|
||||||
Switch 1st_Anna_BedLight "Bettlicht Anna"{mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/BedLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/BedLight/state/feedback:state:default]"}
|
Switch 1st_Anna_BedLight "Bettlicht Anna"{mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/BedLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/BedLight/state/feedback:state:default]"}
|
||||||
Contact 1st_Anna_WindowContact "Fenster Anna" {mqtt="<[localbroker:dispatcher_ng/items/1st/Anna/WindowContact/state/feedback:state:default]"}
|
Contact 1st_Anna_WindowContact "Fenster Anna" {mqtt="<[localbroker:dispatcher_ng/items/1st/Anna/WindowContact/state/feedback:state:default]"}
|
||||||
Number 1st_Anna_Thermostat "Thermostat Anna" {mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/temperature/feedback:state:default]"}
|
Number 1st_Anna_Thermostat "Thermostat Anna [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/temperature/feedback:state:default]"}
|
||||||
Number Preset-1st_Anna_Thermostat "Preset-Thermostat Anna" {mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/presetTemperature/feedback:state:default]"}
|
Number Preset_1st_Anna_Thermostat "Preset_Thermostat Anna [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Anna/Thermostat/presetTemperature/feedback:state:default]"}
|
||||||
Switch 1st_Matthias_StandLight "Stehlampen Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state/feedback:state:default]"}
|
Switch 1st_Matthias_StandLight "Stehlampen Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state/feedback:state:default]"}
|
||||||
Switch 1st_Matthias_BedLight "Bettlicht Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state/feedback:state:default]"}
|
Switch 1st_Matthias_BedLight "Bettlicht Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state/feedback:state:default]"}
|
||||||
Switch 1st_Matthias_Speaker "Lautsprecher Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state/feedback:state:default]"}
|
Switch 1st_Matthias_Speaker "Lautsprecher Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state/feedback:state:default]"}
|
||||||
@ -27,26 +27,27 @@ Switch 1st_BedRoom_WindowLight "Fensterbanklicht Schlafzimmer"{mqtt=">[localbrok
|
|||||||
Contact 1st_Bedroom_WindowContactStreet "Fenster Schlafzimmer Strasse" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContactStreet/state/feedback:state:default]"}
|
Contact 1st_Bedroom_WindowContactStreet "Fenster Schlafzimmer Strasse" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContactStreet/state/feedback:state:default]"}
|
||||||
Contact 1st_Bedroom_WindowContact1Garden "Fenster Schlafzimmer 1 Garten" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContact1Garden/state/feedback:state:default]"}
|
Contact 1st_Bedroom_WindowContact1Garden "Fenster Schlafzimmer 1 Garten" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContact1Garden/state/feedback:state:default]"}
|
||||||
Contact 1st_Bedroom_WindowContact2Garden "Fenster Schlafzimmer 2 Garten" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContact2Garden/state/feedback:state:default]"}
|
Contact 1st_Bedroom_WindowContact2Garden "Fenster Schlafzimmer 2 Garten" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bedroom/WindowContact2Garden/state/feedback:state:default]"}
|
||||||
Number 1st_Bedroom_Thermostat "Thermostat Schlafzimmer" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/temperature/feedback:state:default]"}
|
Number 1st_Bedroom_Thermostat "Thermostat Schlafzimmer [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/temperature/feedback:state:default]"}
|
||||||
Number Preset-1st_Bedroom_Thermostat "Preset-Thermostat Schlafzimmer" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/presetTemperature/feedback:state:default]"}
|
Number Preset_1st_Bedroom_Thermostat "Preset_Thermostat Schlafzimmer [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bedroom/Thermostat/presetTemperature/feedback:state:default]"}
|
||||||
Switch Gnd_Hallway_DayLight "DayLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state/feedback:state:default]"}
|
Switch Gnd_Hallway_DayLight "DayLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/DayLight/state/feedback:state:default]"}
|
||||||
Switch Gnd_Hallway_EcoLight "EcoLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/EcoLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/EcoLight/state/feedback:state:default]"}
|
Switch Gnd_Hallway_EcoLight "EcoLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/EcoLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/EcoLight/state/feedback:state:default]"}
|
||||||
Switch Gnd_Hallway_MorningLight "MorningLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/MorningLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/MorningLight/state/feedback:state:default]"}
|
Switch Gnd_Hallway_MorningLight "MorningLight"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/Hallway/MorningLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Hallway/MorningLight/state/feedback:state:default]"}
|
||||||
Contact Gnd_Bathroom_WindowContact "Fenster Bad unten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Bathroom/WindowContact/state/feedback:state:default]"}
|
Contact Gnd_Bathroom_WindowContact "Fenster Bad unten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Bathroom/WindowContact/state/feedback:state:default]"}
|
||||||
Number Gnd_Bathroom_Thermostat "Thermostat Bad unten" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/temperature/feedback:state:default]"}
|
Number Gnd_Bathroom_Thermostat "Thermostat Bad unten [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/temperature/feedback:state:default]"}
|
||||||
Number Preset-Gnd_Bathroom_Thermostat "Preset-Thermostat Bad unten" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/presetTemperature/feedback:state:default]"}
|
Number Preset_Gnd_Bathroom_Thermostat "Preset_Thermostat Bad unten [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Bathroom/Thermostat/presetTemperature/feedback:state:default]"}
|
||||||
Contact 1st_Bathroom_WindowContact "Fenster Bad oben" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bathroom/WindowContact/state/feedback:state:default]"}
|
Contact 1st_Bathroom_WindowContact "Fenster Bad oben" {mqtt="<[localbroker:dispatcher_ng/items/1st/Bathroom/WindowContact/state/feedback:state:default]"}
|
||||||
Number 1st_Bathroom_Thermostat "Thermostat Bad oben" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/temperature/feedback:state:default]"}
|
Number 1st_Bathroom_Thermostat "Thermostat Bad oben [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/temperature/feedback:state:default]"}
|
||||||
Number Preset-1st_Bathroom_Thermostat "Preset-Thermostat Bad oben" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/presetTemperature/feedback:state:default]"}
|
Number Preset_1st_Bathroom_Thermostat "Preset_Thermostat Bad oben [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/1st/Bathroom/Thermostat/presetTemperature/feedback:state:default]"}
|
||||||
Contact Gnd_Kitchen_WindowContact1 "Fenster Küche Garten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact1/state/feedback:state:default]"}
|
Contact Gnd_Kitchen_WindowContact1 "Fenster Küche Garten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact1/state/feedback:state:default]"}
|
||||||
Contact Gnd_Kitchen_WindowContact2 "Fenster Küche Terassentür Garten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact2/state/feedback:state:default]"}
|
Contact Gnd_Kitchen_WindowContact2 "Fenster Küche Terassentür Garten" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact2/state/feedback:state:default]"}
|
||||||
Contact Gnd_Kitchen_WindowContact3 "Fenster Küche Straße 1" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact3/state/feedback:state:default]"}
|
Contact Gnd_Kitchen_WindowContact3 "Fenster Küche Straße 1" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact3/state/feedback:state:default]"}
|
||||||
Contact Gnd_Kitchen_WindowContact4 "Fenster Küche Straße 2" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact4/state/feedback:state:default]"}
|
Contact Gnd_Kitchen_WindowContact4 "Fenster Küche Straße 2" {mqtt="<[localbroker:dispatcher_ng/items/Gnd/Kitchen/WindowContact4/state/feedback:state:default]"}
|
||||||
Number Gnd_Kitchen_Thermostat "Thermostat Küche" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/temperature/feedback:state:default]"}
|
Number Gnd_Kitchen_Thermostat "Thermostat Küche [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/temperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/temperature/feedback:state:default]"}
|
||||||
Number Preset-Gnd_Kitchen_Thermostat "Preset-Thermostat Küche" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/presetTemperature/feedback:state:default]"}
|
Number Preset_Gnd_Kitchen_Thermostat "Preset_Thermostat Küche [%.1f °C]" {mqtt=">[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/presetTemperature:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/Kitchen/Thermostat/presetTemperature/feedback:state:default]"}
|
||||||
Switch base_labor_relaybox0 "Küche" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/0:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/0:state:default]"}
|
Switch base_labor_relaybox0 "Küche" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/0:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/0:state:default]"}
|
||||||
Switch base_labor_relaybox0Conflict "Küche [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/0:state:default]"}
|
String base_labor_relaybox0Conflict "Küche [%s]" {mqtt="<[localbroker:dispatcher_ng/items/base/labor/relaybox/conflict/0:state:default]"}
|
||||||
Switch base_labor_relaybox1 "Herd" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/1:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/1:state:default]"}
|
Switch base_labor_relaybox1 "Herd" {mqtt=">[localbroker:dispatcher_ng/items/base/labor/relaybox/state/1:command:*:default],<[localbroker:dispatcher_ng/items/base/labor/relaybox/feedback/1:state:default]"}
|
||||||
Switch 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]"}
|
||||||
Switch 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]"}
|
@ -51,6 +51,11 @@ 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 {
|
||||||
|
return {'homekit': {'id':'', 'object': {}},
|
||||||
|
'openhab': `Switch SummerSwitch "Winter?" {mqtt=">[localbroker:${summerSwitchTopic}:command:*:default],<[localbroker:${summerSwitchTopic}: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{
|
||||||
return {'id': '', 'object': {}}
|
return {'id': '', 'object': {}}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,10 @@ 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, ExportType } from './Export'
|
import { ThermostatExport, SummerSwitchExport, ExportType } from './Export'
|
||||||
import { Disabler } from './Disabler'
|
import { Disabler } from './Disabler'
|
||||||
|
|
||||||
const DISABLED_TEMPERATURE = 5.0
|
const DISABLED_TEMPERATURE: number = 5.0
|
||||||
|
|
||||||
|
|
||||||
type DisabledHolder = {
|
type DisabledHolder = {
|
||||||
disabler : Disabler
|
disabler : Disabler
|
||||||
@ -27,6 +26,9 @@ 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'
|
||||||
|
private summerFlag: boolean = false
|
||||||
|
|
||||||
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
// Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE
|
||||||
|
|
||||||
getInTopic() : string {
|
getInTopic() : string {
|
||||||
@ -37,6 +39,10 @@ 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 {
|
||||||
|
return SummerSwitchExport(MaxThermostat.summerSwitchTopic)
|
||||||
|
}
|
||||||
|
|
||||||
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[]) {
|
||||||
super(floor, room, item, label, hmId)
|
super(floor, room, item, label, hmId)
|
||||||
this.temperatureTopic = `${this.topicFirstPart}/temperature`
|
this.temperatureTopic = `${this.topicFirstPart}/temperature`
|
||||||
@ -50,7 +56,8 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
|||||||
this.temperatureTopic,
|
this.temperatureTopic,
|
||||||
this.presetTemperatureTopic,
|
this.presetTemperatureTopic,
|
||||||
this.deviceFeedbackTopic,
|
this.deviceFeedbackTopic,
|
||||||
this.commandTopic
|
this.commandTopic,
|
||||||
|
MaxThermostat.summerSwitchTopic
|
||||||
]
|
]
|
||||||
this.hardDisabled = false
|
this.hardDisabled = false
|
||||||
this.hardDisablerMap = {}
|
this.hardDisablerMap = {}
|
||||||
@ -74,12 +81,16 @@ 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 (payload == 'ON') {
|
if (! this.summerFlag) {
|
||||||
this.temperature = this.presetTemperature
|
if (payload == 'ON') {
|
||||||
} else if (payload == 'OFF') {
|
this.temperature = this.presetTemperature
|
||||||
this.temperature = DISABLED_TEMPERATURE
|
} else if (payload == 'OFF') {
|
||||||
|
this.temperature = DISABLED_TEMPERATURE
|
||||||
|
}
|
||||||
|
setTemperature = true
|
||||||
}
|
}
|
||||||
setTemperature = true
|
} else if (topic == MaxThermostat.summerSwitchTopic) {
|
||||||
|
this.summerFlag = (payload == 'ON')
|
||||||
} 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}`)
|
||||||
|
@ -337,6 +337,8 @@ let relayBox = new RelayBoxThing('base', 'labor', 'relaybox', 'IoT/Command/Relay
|
|||||||
relayBox.start()
|
relayBox.start()
|
||||||
allLabeledItems.push(relayBox)
|
allLabeledItems.push(relayBox)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [
|
let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [
|
||||||
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
|
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
|
||||||
@ -398,6 +400,13 @@ allLabeledItems.forEach((item: AItem) => {
|
|||||||
// logger.info(JSON.stringify(openhabList))
|
// logger.info(JSON.stringify(openhabList))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let summerSwitchExport : ExportType|null = MaxThermostat.exportSummerSwitchItem()
|
||||||
|
if (summerSwitchExport != null) {
|
||||||
|
let da : string = summerSwitchExport['openhab'] as string
|
||||||
|
openhabList.push(da)
|
||||||
|
}
|
||||||
|
|
||||||
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4))
|
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4))
|
||||||
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
|
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user