diff --git a/src/commands/handlers.js b/src/commands/handlers.js index 32a3ee9..c803948 100644 --- a/src/commands/handlers.js +++ b/src/commands/handlers.js @@ -88,9 +88,14 @@ exports.setOutflow = (source, msg) => { exports.setDemand = (source, msg, ctx) => { const log = _logger(source, ctx); - const demand = Number(msg.payload); + // generalFunctions/commandRegistry's _normaliseUnits has already converted + // msg.payload to m3/h (the descriptor's units.default — see + // commands/index.js). Accepts {value, unit} objects upstream; we just read + // the normalized number here. _manualDemand is stored in m3/h, no further + // conversion needed. + const demand = Number(msg?.payload); if (!Number.isFinite(demand)) { - log?.warn?.(`set.demand: invalid Qd value '${msg.payload}'`); + log?.warn?.(`set.demand: invalid Qd value '${JSON.stringify(msg?.payload)}'`); return; } if (source.mode !== 'manual') {