new
This commit is contained in:
28
src/RelayBox.js
Normal file
28
src/RelayBox.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
let mqtt = require('./mqttHandler');
|
||||||
|
let logger = require('./log');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Switch {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class RelayBox {
|
||||||
|
constructor(switches) {
|
||||||
|
this.switches = switches;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
mqtt.register(this.subscribeTopics, (topic, payload) => {
|
||||||
|
logger.info(`item ${this.itemId}: ${topic}, ${payload}`)
|
||||||
|
this.processMessage(topic, payload);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
RelayBox,
|
||||||
|
Switch
|
||||||
|
};
|
||||||
|
|
Reference in New Issue
Block a user