'use strict'; // machineGroupControl command registry. Consumed by BaseNodeAdapter via // `static commands = require('./commands')`. Each descriptor maps a // canonical msg.topic to its handler; legacy names are listed under // `aliases` and emit a one-time deprecation warning at runtime. const handlers = require('./handlers'); module.exports = [ { topic: 'set.mode', aliases: ['setMode'], payloadSchema: { type: 'string' }, description: 'Switch the operating mode. Allowed: `optimalControl`, `priorityControl`, `maintenance` (schema-validated in `machineGroupControl.json` → `mode.current`).', handler: handlers.setMode, }, { topic: 'child.register', aliases: ['registerChild'], // payload is the Node-RED id (string) of the child node. payloadSchema: { type: 'string' }, description: 'Register a child machine with this group.', handler: handlers.registerChild, }, { topic: 'set.demand', aliases: ['Qd'], // payload is either a bare number (interpreted as %) or // { value: number, unit: '%' | 'm3/h' | 'l/s' | 'm3/s' | ... }. // No `units` descriptor — the handler resolves the unit explicitly so // commandRegistry._normaliseUnits doesn't pre-convert a percentage into // a flow rate. Negative value is the operator stop-all signal. payloadSchema: { type: 'any' }, description: 'Operator demand setpoint. Bare number = %; {value, unit} for absolute flow units. Negative = stop all.', handler: handlers.setDemand, }, ];