adjust main
This commit is contained in:
7
dist/MaxThermostat.js
vendored
7
dist/MaxThermostat.js
vendored
@ -35,6 +35,9 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
this.hardDisablerMap[hardDisabler.getStateFeedbackTopic()] = { disabler: hardDisabler, state: 'unknown' };
|
||||
});
|
||||
}
|
||||
setPresetTemperature(presetTemperature) {
|
||||
this.processMessage(this.presetTemperatureTopic, `${presetTemperature}`);
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
let setTemperature = false;
|
||||
if (topic == this.temperatureTopic) {
|
||||
@ -42,10 +45,10 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
setTemperature = true;
|
||||
}
|
||||
else if (topic == this.commandTopic) {
|
||||
if (payload == 'START') {
|
||||
if (payload == 'ON') {
|
||||
this.temperature = this.presetTemperature;
|
||||
}
|
||||
else {
|
||||
else if (payload == 'OFF') {
|
||||
this.temperature = DISABLED_TEMPERATURE;
|
||||
}
|
||||
setTemperature = true;
|
||||
|
63
dist/main.js
vendored
63
dist/main.js
vendored
@ -44,16 +44,17 @@ windowContactAnna1st.start();
|
||||
allLabeledItems.push(windowContactAnna1st);
|
||||
let thermostatAnna1st = new MaxThermostat_1.MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st]);
|
||||
thermostatAnna1st.start();
|
||||
thermostatAnna1st.setPresetTemperature(21.0);
|
||||
allLabeledItems.push(thermostatAnna1st);
|
||||
let thermostatAnna1stCron = new Cron_1.Cron('thermostatAnna1stCron', thermostatAnna1st, [
|
||||
{ cronTime: '00 05 06 * * *', output: '23.0' },
|
||||
{ cronTime: '00 05 08 * * 1-5', output: '5.0' },
|
||||
{ cronTime: '00 05 16 * * 1', output: '23.0' },
|
||||
{ cronTime: '00 05 14 * * 2', output: '23.0' },
|
||||
{ cronTime: '00 05 14 * * 3', output: '23.0' },
|
||||
{ cronTime: '00 05 16 * * 4', output: '23.0' },
|
||||
{ cronTime: '00 05 14 * * 5', output: '23.0' },
|
||||
{ cronTime: '00 58 23 * * *', output: '5.0' }
|
||||
{ cronTime: '00 05 06 * * *', output: 'ON' },
|
||||
{ cronTime: '00 05 08 * * 1-5', output: 'OFF' },
|
||||
{ cronTime: '00 05 16 * * 1', output: 'ON' },
|
||||
{ cronTime: '00 05 14 * * 2', output: 'ON' },
|
||||
{ cronTime: '00 05 14 * * 3', output: 'ON' },
|
||||
{ cronTime: '00 05 16 * * 4', output: 'ON' },
|
||||
{ cronTime: '00 05 14 * * 5', output: 'ON' },
|
||||
{ cronTime: '00 58 23 * * *', output: 'OFF' }
|
||||
]);
|
||||
thermostatAnna1stCron.start();
|
||||
// Matthias -------------------------------------------------------------------------------------------------
|
||||
@ -159,14 +160,15 @@ windowContact2BedroomGarden1st.start();
|
||||
allLabeledItems.push(windowContact2BedroomGarden1st);
|
||||
let thermostatBedroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st]);
|
||||
thermostatBedroom1st.start();
|
||||
thermostatBedroom1st.setPresetTemperature(20.0);
|
||||
allLabeledItems.push(thermostatBedroom1st);
|
||||
let thermostatBedroom1stCron = new Cron_1.Cron('thermostatBedroom1stCron', thermostatBedroom1st, [
|
||||
{ cronTime: '00 01 06 * * 1-5', output: '19.0' },
|
||||
{ cronTime: '00 01 09 * * 1-5', output: '5.0' },
|
||||
{ cronTime: '00 01 08 * * 6,0', output: '19.0' },
|
||||
{ cronTime: '00 01 11 * * 6,0', output: '5.0' },
|
||||
{ cronTime: '00 00 17 * * *', output: '20.0' },
|
||||
{ cronTime: '00 59 23 * * *', output: '5.0' }
|
||||
{ cronTime: '00 01 06 * * 1-5', output: 'ON' },
|
||||
{ cronTime: '00 01 09 * * 1-5', output: 'OFF' },
|
||||
{ cronTime: '00 01 08 * * 6,0', output: 'ON' },
|
||||
{ cronTime: '00 01 11 * * 6,0', output: 'OFF' },
|
||||
{ cronTime: '00 00 17 * * *', output: 'ON' },
|
||||
{ cronTime: '00 59 23 * * *', output: 'OFF' }
|
||||
]);
|
||||
thermostatBedroom1stCron.start();
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
@ -204,13 +206,14 @@ windowContactBathroomGnd.start();
|
||||
allLabeledItems.push(windowContactBathroomGnd);
|
||||
let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd]);
|
||||
thermostatBathroomGnd.start();
|
||||
thermostatBathroomGnd.setPresetTemperature(20.0);
|
||||
allLabeledItems.push(thermostatBathroomGnd);
|
||||
let thermostatBathroomGndCron = new Cron_1.Cron('thermostatBathroomGndCron', thermostatBathroomGnd, [
|
||||
{ cronTime: '00 02 06 * * 1-5', output: '21.0' },
|
||||
{ cronTime: '00 02 08 * * 6,0', output: '21.0' },
|
||||
{ cronTime: '00 02 11 * * *', output: '5.0' },
|
||||
{ cronTime: '00 02 19 * * *', output: '21.0' },
|
||||
{ cronTime: '00 00 23 * * *', output: '5.0' }
|
||||
{ cronTime: '00 02 06 * * 1-5', output: 'ON' },
|
||||
{ cronTime: '00 02 08 * * 6,0', output: 'ON' },
|
||||
{ cronTime: '00 02 11 * * *', output: 'OFF' },
|
||||
{ cronTime: '00 02 19 * * *', output: 'ON' },
|
||||
{ cronTime: '00 00 23 * * *', output: 'OFF' }
|
||||
]);
|
||||
thermostatBathroomGndCron.start();
|
||||
let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2);
|
||||
@ -218,13 +221,14 @@ windowContactBathroom1st.start();
|
||||
allLabeledItems.push(windowContactBathroom1st);
|
||||
let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]);
|
||||
thermostatBathroom1st.start();
|
||||
thermostatBedroom1st.setPresetTemperature(20.0);
|
||||
allLabeledItems.push(thermostatBathroom1st);
|
||||
let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
|
||||
{ cronTime: '00 00 06 * * 1-5', output: '21.0' },
|
||||
{ cronTime: '00 00 08 * * 6,0', output: '21.0' },
|
||||
{ cronTime: '00 00 11 * * *', output: '5.0' },
|
||||
{ cronTime: '00 00 19 * * *', output: '21.0' },
|
||||
{ cronTime: '00 00 23 * * *', output: '5.0' }
|
||||
{ cronTime: '00 00 06 * * 1-5', output: 'ON' },
|
||||
{ cronTime: '00 00 08 * * 6,0', output: 'ON' },
|
||||
{ cronTime: '00 00 11 * * *', output: 'OFF' },
|
||||
{ cronTime: '00 00 19 * * *', output: 'ON' },
|
||||
{ cronTime: '00 00 23 * * *', output: 'OFF' }
|
||||
]);
|
||||
thermostatBathroom1stCron.start();
|
||||
let windowContactKitchen1 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11);
|
||||
@ -243,13 +247,14 @@ let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'The
|
||||
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4
|
||||
]);
|
||||
thermostatKitchen.start();
|
||||
thermostatKitchen.setPresetTemperature(20.0);
|
||||
allLabeledItems.push(thermostatKitchen);
|
||||
let thermostatKitchenCron = new Cron_1.Cron('thermostatKitchenCron', thermostatKitchen, [
|
||||
{ cronTime: '00 00 06 * * 1-5', output: '19.0' },
|
||||
{ cronTime: '00 00 08 * * 6,0', output: '19.0' },
|
||||
{ cronTime: '00 00 10 * * 1-3', output: '5.0' },
|
||||
{ cronTime: '00 30 13 * * 1-3', output: '19.0' },
|
||||
{ cronTime: '00 00 23 * * *', output: '5.0' }
|
||||
{ cronTime: '00 00 06 * * 1-5', output: 'ON' },
|
||||
{ cronTime: '00 00 08 * * 6,0', output: 'ON' },
|
||||
{ cronTime: '00 00 10 * * 1-3', output: 'OFF' },
|
||||
{ cronTime: '00 30 13 * * 1-3', output: 'ON' },
|
||||
{ cronTime: '00 00 23 * * *', output: 'OFF' }
|
||||
]);
|
||||
thermostatKitchenCron.start();
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
|
@ -60,15 +60,19 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
|
||||
})
|
||||
}
|
||||
|
||||
setPresetTemperature(presetTemperature: number) {
|
||||
this.processMessage(this.presetTemperatureTopic, `${presetTemperature}`)
|
||||
}
|
||||
|
||||
processMessage(topic: string, payload: string) : void {
|
||||
let setTemperature : boolean = false
|
||||
if (topic == this.temperatureTopic) {
|
||||
this.temperature = parseFloat(payload)
|
||||
setTemperature = true
|
||||
} else if (topic == this.commandTopic) {
|
||||
if (payload == 'START') {
|
||||
if (payload == 'ON') {
|
||||
this.temperature = this.presetTemperature
|
||||
} else {
|
||||
} else if (payload == 'OFF') {
|
||||
this.temperature = DISABLED_TEMPERATURE
|
||||
}
|
||||
setTemperature = true
|
||||
|
63
src/main.ts
63
src/main.ts
@ -58,17 +58,18 @@ allLabeledItems.push(windowContactAnna1st)
|
||||
|
||||
let thermostatAnna1st = new MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st])
|
||||
thermostatAnna1st.start()
|
||||
thermostatAnna1st.setPresetTemperature(21.0)
|
||||
allLabeledItems.push(thermostatAnna1st)
|
||||
|
||||
let thermostatAnna1stCron = new Cron('thermostatAnna1stCron', thermostatAnna1st, [
|
||||
{cronTime: '00 05 06 * * *', output: '23.0'},
|
||||
{cronTime: '00 05 08 * * 1-5', output: '5.0'},
|
||||
{cronTime: '00 05 16 * * 1', output: '23.0'},
|
||||
{cronTime: '00 05 14 * * 2', output: '23.0'},
|
||||
{cronTime: '00 05 14 * * 3', output: '23.0'},
|
||||
{cronTime: '00 05 16 * * 4', output: '23.0'},
|
||||
{cronTime: '00 05 14 * * 5', output: '23.0'},
|
||||
{cronTime: '00 58 23 * * *', output: '5.0'}
|
||||
{cronTime: '00 05 06 * * *', output: 'ON'},
|
||||
{cronTime: '00 05 08 * * 1-5', output: 'OFF'},
|
||||
{cronTime: '00 05 16 * * 1', output: 'ON'},
|
||||
{cronTime: '00 05 14 * * 2', output: 'ON'},
|
||||
{cronTime: '00 05 14 * * 3', output: 'ON'},
|
||||
{cronTime: '00 05 16 * * 4', output: 'ON'},
|
||||
{cronTime: '00 05 14 * * 5', output: 'ON'},
|
||||
{cronTime: '00 58 23 * * *', output: 'OFF'}
|
||||
])
|
||||
thermostatAnna1stCron.start()
|
||||
|
||||
@ -205,15 +206,16 @@ allLabeledItems.push(windowContact2BedroomGarden1st)
|
||||
|
||||
let thermostatBedroom1st = new MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st])
|
||||
thermostatBedroom1st.start()
|
||||
thermostatBedroom1st.setPresetTemperature(20.0)
|
||||
allLabeledItems.push(thermostatBedroom1st)
|
||||
|
||||
let thermostatBedroom1stCron = new Cron('thermostatBedroom1stCron', thermostatBedroom1st, [
|
||||
{cronTime: '00 01 06 * * 1-5', output: '19.0'},
|
||||
{cronTime: '00 01 09 * * 1-5', output: '5.0'},
|
||||
{cronTime: '00 01 08 * * 6,0', output: '19.0'},
|
||||
{cronTime: '00 01 11 * * 6,0', output: '5.0'},
|
||||
{cronTime: '00 00 17 * * *', output: '20.0'},
|
||||
{cronTime: '00 59 23 * * *', output: '5.0'}
|
||||
{cronTime: '00 01 06 * * 1-5', output: 'ON'},
|
||||
{cronTime: '00 01 09 * * 1-5', output: 'OFF'},
|
||||
{cronTime: '00 01 08 * * 6,0', output: 'ON'},
|
||||
{cronTime: '00 01 11 * * 6,0', output: 'OFF'},
|
||||
{cronTime: '00 00 17 * * *', output: 'ON'},
|
||||
{cronTime: '00 59 23 * * *', output: 'OFF'}
|
||||
])
|
||||
thermostatBedroom1stCron.start()
|
||||
|
||||
@ -267,14 +269,15 @@ allLabeledItems.push(windowContactBathroomGnd)
|
||||
|
||||
let thermostatBathroomGnd = new MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd])
|
||||
thermostatBathroomGnd.start()
|
||||
thermostatBathroomGnd.setPresetTemperature(20.0)
|
||||
allLabeledItems.push(thermostatBathroomGnd)
|
||||
|
||||
let thermostatBathroomGndCron = new Cron('thermostatBathroomGndCron', thermostatBathroomGnd, [
|
||||
{cronTime: '00 02 06 * * 1-5', output: '21.0'},
|
||||
{cronTime: '00 02 08 * * 6,0', output: '21.0'},
|
||||
{cronTime: '00 02 11 * * *', output: '5.0'},
|
||||
{cronTime: '00 02 19 * * *', output: '21.0'},
|
||||
{cronTime: '00 00 23 * * *', output: '5.0'}
|
||||
{cronTime: '00 02 06 * * 1-5', output: 'ON'},
|
||||
{cronTime: '00 02 08 * * 6,0', output: 'ON'},
|
||||
{cronTime: '00 02 11 * * *', output: 'OFF'},
|
||||
{cronTime: '00 02 19 * * *', output: 'ON'},
|
||||
{cronTime: '00 00 23 * * *', output: 'OFF'}
|
||||
])
|
||||
thermostatBathroomGndCron.start()
|
||||
|
||||
@ -285,14 +288,15 @@ allLabeledItems.push(windowContactBathroom1st)
|
||||
|
||||
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st])
|
||||
thermostatBathroom1st.start()
|
||||
thermostatBedroom1st.setPresetTemperature(20.0)
|
||||
allLabeledItems.push(thermostatBathroom1st)
|
||||
|
||||
let thermostatBathroom1stCron = new Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
|
||||
{cronTime: '00 00 06 * * 1-5', output: '21.0'},
|
||||
{cronTime: '00 00 08 * * 6,0', output: '21.0'},
|
||||
{cronTime: '00 00 11 * * *', output: '5.0'},
|
||||
{cronTime: '00 00 19 * * *', output: '21.0'},
|
||||
{cronTime: '00 00 23 * * *', output: '5.0'}
|
||||
{cronTime: '00 00 06 * * 1-5', output: 'ON'},
|
||||
{cronTime: '00 00 08 * * 6,0', output: 'ON'},
|
||||
{cronTime: '00 00 11 * * *', output: 'OFF'},
|
||||
{cronTime: '00 00 19 * * *', output: 'ON'},
|
||||
{cronTime: '00 00 23 * * *', output: 'OFF'}
|
||||
])
|
||||
thermostatBathroom1stCron.start()
|
||||
|
||||
@ -314,14 +318,15 @@ allLabeledItems.push(windowContactKitchen4)
|
||||
let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
|
||||
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4])
|
||||
thermostatKitchen.start()
|
||||
thermostatKitchen.setPresetTemperature(20.0)
|
||||
allLabeledItems.push(thermostatKitchen)
|
||||
|
||||
let thermostatKitchenCron = new Cron('thermostatKitchenCron', thermostatKitchen, [
|
||||
{cronTime: '00 00 06 * * 1-5', output: '19.0'},
|
||||
{cronTime: '00 00 08 * * 6,0', output: '19.0'},
|
||||
{cronTime: '00 00 10 * * 1-3', output: '5.0'},
|
||||
{cronTime: '00 30 13 * * 1-3', output: '19.0'},
|
||||
{cronTime: '00 00 23 * * *', output: '5.0'}
|
||||
{cronTime: '00 00 06 * * 1-5', output: 'ON'},
|
||||
{cronTime: '00 00 08 * * 6,0', output: 'ON'},
|
||||
{cronTime: '00 00 10 * * 1-3', output: 'OFF'},
|
||||
{cronTime: '00 30 13 * * 1-3', output: 'ON'},
|
||||
{cronTime: '00 00 23 * * *', output: 'OFF'}
|
||||
])
|
||||
thermostatKitchenCron.start()
|
||||
|
||||
|
Reference in New Issue
Block a user