some changes
This commit is contained in:
3
dist/M433SwitchItem.js
vendored
3
dist/M433SwitchItem.js
vendored
@ -7,6 +7,9 @@ class M433SwitchItem extends AItem_1.AItem {
|
||||
getStateTopic() {
|
||||
return this.stateTopic;
|
||||
}
|
||||
getInTopic() {
|
||||
return this.stateTopic;
|
||||
}
|
||||
getStateFeedbackTopic() {
|
||||
return this.stateFeedbackTopic;
|
||||
}
|
||||
|
25
dist/MaxThermostat.js
vendored
25
dist/MaxThermostat.js
vendored
@ -27,8 +27,14 @@ class MaxThermostat extends AHomematicItem_1.AHomematicItem {
|
||||
});
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
if ((topic == this.temperatureTopic) || (topic == this.deviceFeedbackTopic)) {
|
||||
let setTemperature = false;
|
||||
if (topic == this.temperatureTopic) {
|
||||
this.temperature = parseFloat(payload);
|
||||
setTemperature = true;
|
||||
}
|
||||
else if (topic == this.deviceFeedbackTopic) {
|
||||
// this.temperature = parseFloat(payload)
|
||||
setTemperature = false;
|
||||
}
|
||||
else if (topic in this.windowContactMap) {
|
||||
this.windowContactMap[topic].state = payload;
|
||||
@ -38,14 +44,17 @@ class MaxThermostat extends AHomematicItem_1.AHomematicItem {
|
||||
this.windowOpen = true;
|
||||
}
|
||||
});
|
||||
setTemperature = true;
|
||||
}
|
||||
if (!this.windowOpen) {
|
||||
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${this.temperature}`);
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`);
|
||||
if (setTemperature) {
|
||||
if (!this.windowOpen) {
|
||||
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${this.temperature}`);
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`);
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
dist/MaxWindowContact.js
vendored
7
dist/MaxWindowContact.js
vendored
@ -18,7 +18,12 @@ class MaxWindowContact extends AHomematicItem_1.AHomematicItem {
|
||||
];
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
this.state = payload;
|
||||
if (payload == 'true') {
|
||||
this.state = 'OPEN';
|
||||
}
|
||||
else {
|
||||
this.state = 'CLOSED';
|
||||
}
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
}
|
||||
}
|
||||
|
12
dist/main.js
vendored
12
dist/main.js
vendored
@ -23,6 +23,14 @@ let allLabeledItems = new Array();
|
||||
let aquariumLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquariumlicht', '14665044 24 1', '14665041 24 1');
|
||||
aquariumLight.start();
|
||||
allLabeledItems.push(aquariumLight);
|
||||
let aquariumLightCron = new Cron_1.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_1.M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1');
|
||||
annaBedLight.start();
|
||||
@ -147,9 +155,9 @@ let thermostatBathroomGndCron = new Cron_1.Cron('thermostatBathroomGndCron', the
|
||||
{ cronTime: '00 00 23 * * *', output: '5.0' }
|
||||
]);
|
||||
thermostatBathroomGndCron.start();
|
||||
let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 7);
|
||||
let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2);
|
||||
windowContactBathroom1st.start();
|
||||
let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 4, [windowContactBathroom1st]);
|
||||
let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]);
|
||||
thermostatBathroom1st.start();
|
||||
let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
|
||||
{ cronTime: '00 00 06 * * 1-5', output: '21.0' },
|
||||
|
@ -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