adjust main

This commit is contained in:
2018-04-06 23:09:51 +02:00
parent 37acc620d5
commit c503e31ee5
4 changed files with 79 additions and 62 deletions

View File

@ -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

View File

@ -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()