preset fix
This commit is contained in:
4
dist/AItem.js
vendored
4
dist/AItem.js
vendored
@ -15,6 +15,8 @@ class AItem {
|
||||
}
|
||||
this.topicFirstPart = `dispatcher_ng/items/${this.floor}/${this.room}/${this.item}`;
|
||||
}
|
||||
startFunc() {
|
||||
}
|
||||
exportItem() {
|
||||
return null;
|
||||
}
|
||||
@ -22,7 +24,7 @@ class AItem {
|
||||
MqttDispatcher_1.mqttHandler.register(this.subscribeTopics, (topic, payload) => {
|
||||
// logger.info(`item ${this.itemId}: ${topic}, ${payload}`)
|
||||
this.processMessage(topic, payload);
|
||||
});
|
||||
}, () => { this.startFunc(); });
|
||||
}
|
||||
}
|
||||
exports.AItem = AItem;
|
||||
|
5
dist/MaxThermostat.js
vendored
5
dist/MaxThermostat.js
vendored
@ -36,7 +36,10 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
|
||||
});
|
||||
}
|
||||
setPresetTemperature(presetTemperature) {
|
||||
this.processMessage(this.presetTemperatureTopic, `${presetTemperature}`);
|
||||
this.presetTemperature = presetTemperature;
|
||||
}
|
||||
startFunc() {
|
||||
MqttDispatcher_1.mqttHandler.send(this.presetTemperatureTopic, `${this.presetTemperature}`);
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
let setTemperature = false;
|
||||
|
8
dist/MqttDispatcher.js
vendored
8
dist/MqttDispatcher.js
vendored
@ -17,13 +17,15 @@ class MqttHandler {
|
||||
this.mqttOptions.rejectUnauthorized = true;
|
||||
}
|
||||
this.topicHandlers = [];
|
||||
this.startCallbacks = [];
|
||||
logger.info("MqttHandler constructed");
|
||||
}
|
||||
register(topics, cb) {
|
||||
register(topics, cb, startCb) {
|
||||
topics.forEach((topic) => {
|
||||
this.topicHandlers.push({ topic: topic, callback: cb });
|
||||
logger.info(`Callback registered for ${topic}`);
|
||||
});
|
||||
this.startCallbacks.push(startCb);
|
||||
}
|
||||
exec() {
|
||||
logger.info(`Connecting to ${this.mqttBrokerUrl}`);
|
||||
@ -39,6 +41,10 @@ class MqttHandler {
|
||||
logger.info(`${topicHandler.topic} subscribed`);
|
||||
});
|
||||
logger.info('MQTT connection established');
|
||||
this.startCallbacks.forEach((cb) => {
|
||||
cb();
|
||||
logger.info("started");
|
||||
});
|
||||
});
|
||||
this.mqttClient.on('message', (topic, payload, packet) => {
|
||||
if (!packet.retain) {
|
||||
|
2
dist/main.js
vendored
2
dist/main.js
vendored
@ -221,7 +221,7 @@ 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);
|
||||
thermostatBathroom1st.setPresetTemperature(20.0);
|
||||
allLabeledItems.push(thermostatBathroom1st);
|
||||
let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
|
||||
{ cronTime: '00 00 06 * * 1-5', output: 'ON' },
|
||||
|
Reference in New Issue
Block a user