update
Took 32 minutes
This commit is contained in:
@ -23,6 +23,7 @@ router.ws('/', async (ws, req, next) => {
|
||||
WebSocketHandler.ws = ws;
|
||||
|
||||
await WebSocketHandler.sendRunningConfig();
|
||||
await WebSocketHandler.sendContainers();
|
||||
await WebSocketHandler.sendStatus();
|
||||
|
||||
async function sendWhenReady() {
|
||||
@ -64,20 +65,28 @@ router.ws('/', async (ws, req, next) => {
|
||||
}
|
||||
case WebSocketEvent.CONTAINERS: {
|
||||
let data = msg.data as { pumpPin: number; sensorType: SensorType; sensor1: number; sensor2: number; volume: number; }[];
|
||||
await Container.remove({});
|
||||
await Container.deleteMany({});
|
||||
|
||||
let i = 0;
|
||||
for (let c of data) {
|
||||
let container = new Container();
|
||||
container.slot = i;
|
||||
container.volume = c.volume;
|
||||
container.pumpPin = c.pumpPin;
|
||||
container.sensorType = c.sensorType;
|
||||
container.sensorPin1 = c.sensor1;
|
||||
container.sensorPin2 = c.sensor2;
|
||||
container.enabled = true;
|
||||
container.autoDisabled = true;
|
||||
await container.save();
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WebSocketEvent.CONFIG: {
|
||||
// ToDo
|
||||
// Danach setup modus aus
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user