add nozzle, bed, fan, light controls

This commit is contained in:
Stewart Allen 2025-02-02 14:07:59 -05:00
commit 3921bad804
3 changed files with 163 additions and 28 deletions

View file

@ -40,7 +40,7 @@ module.exports = async (server) => {
util.log('mqtt sub', this.#serial, err || "ok");
onready(this);
this.keepalive();
this.keepconn();
// this.keepconn();
});
});
@ -277,7 +277,7 @@ module.exports = async (server) => {
util.log('ws open', req.url, wsopen.length);
ws.on('message', msg => {
msg = JSON.parse(msg);
let { cmd, host, code, serial, path, amsmap } = msg;
let { cmd, host, code, serial, path, amsmap, direct } = msg;
switch (cmd) {
case "monitor":
get_mqtt(host, code, serial, message => {
@ -344,6 +344,9 @@ module.exports = async (server) => {
case "cancel":
if_mqtt(serial, { print: { command: "stop", sequence_id: "0", param: "" } });
break;
case "direct":
if_mqtt(serial, direct);
break;
case "keepalive":
// util.log({ keepalive: serial });
mcache[serial]?.keepalive();