some changes
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import * as logger from './log'
|
||||
import { mqttHandler } from './MqttDispatcher'
|
||||
import { AItem, HasStateAndFeedbackTopic } from './AItem'
|
||||
import { AItem, HasStateAndFeedbackTopic, HasInTopic } from './AItem'
|
||||
import { SwitchExport, ExportType } from './Export'
|
||||
|
||||
|
||||
@ -18,6 +18,10 @@ export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopic {
|
||||
return this.stateTopic
|
||||
}
|
||||
|
||||
getInTopic() : string {
|
||||
return this.stateTopic
|
||||
}
|
||||
|
||||
getStateFeedbackTopic() : string {
|
||||
return this.stateFeedbackTopic
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export class MaxThermostat extends AHomematicItem implements HasInTopic {
|
||||
this.temperature = parseFloat(payload)
|
||||
setTemperature = true
|
||||
} else if (topic == this.deviceFeedbackTopic) {
|
||||
this.temperature = parseFloat(payload)
|
||||
// this.temperature = parseFloat(payload)
|
||||
setTemperature = false
|
||||
} else if (topic in this.windowContactMap) {
|
||||
this.windowContactMap[topic].state = payload
|
||||
@ -76,4 +76,4 @@ export class MaxThermostat extends AHomematicItem implements HasInTopic {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,12 @@ export class MaxWindowContact extends AHomematicItem {
|
||||
}
|
||||
|
||||
processMessage(topic: string, payload: string) : void {
|
||||
this.state = payload
|
||||
if (payload == 'true') {
|
||||
this.state = 'OPEN'
|
||||
} else {
|
||||
this.state = 'CLOSED'
|
||||
}
|
||||
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
14
src/main.ts
14
src/main.ts
@ -30,6 +30,16 @@ let aquariumLight = new M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquarium
|
||||
aquariumLight.start()
|
||||
allLabeledItems.push(aquariumLight)
|
||||
|
||||
let aquariumLightCron = new Cron('aquariumLightCron', aquariumLight, [
|
||||
{cronTime: '00 00 07 * * 1-5', output: 'ON'},
|
||||
{cronTime: '00 00 09 * * 6-7', output: 'ON'},
|
||||
{cronTime: '00 00 13 * * *', output: 'OFF'},
|
||||
{cronTime: '00 00 14 * * *', output: 'ON'},
|
||||
{cronTime: '00 00 22 * * *', output: 'OFF'}
|
||||
])
|
||||
aquariumLightCron.start()
|
||||
|
||||
|
||||
// Anna Bett 14668116 24 1 14668113 24 1
|
||||
let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1')
|
||||
annaBedLight.start()
|
||||
@ -195,10 +205,10 @@ let thermostatBathroomGndCron = new Cron('thermostatBathroomGndCron', thermostat
|
||||
thermostatBathroomGndCron.start()
|
||||
|
||||
|
||||
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 7)
|
||||
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2)
|
||||
windowContactBathroom1st.start()
|
||||
|
||||
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 4, [windowContactBathroom1st])
|
||||
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st])
|
||||
thermostatBathroom1st.start()
|
||||
|
||||
let thermostatBathroom1stCron = new Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
|
||||
|
Reference in New Issue
Block a user