Compare commits

...

1 Commits

Author SHA1 Message Date
Rene De Ren
3ff76228eb fix: guard demo IIFE with require.main check
Prevents demo code from executing when module is required by Node-RED,
which caused crashes due to missing measurement data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:38:08 +01:00

View File

@@ -613,7 +613,8 @@ function pushSample(measurement, type, value, unit) { // eslint-disable-line no-
}
/** Demo *********************************************************************/
(async function demoStationWithPump() {
// Only run the demo when this file is executed directly (not when required as a module)
if (require.main === module) (async function demoStationWithPump() {
const station = new PumpingStation(createPumpingStationConfig("PumpingStationDemo"));
const pump = new RotatingMachine(createMachineConfig("Pump1"), createMachineStateConfig());