- src/commands/index.js: description now lists the actual schema modes (`optimalControl`, `priorityControl`, `maintenance`); was generic "auto / manual" which never matched the schema. - CONTRACT.md: same fix — old list included `dynamiccontrol` (doesn't exist) and used lowercase names that don't match the canonical schema enum. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
'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,
|
|
},
|
|
];
|