From 2aa7f88f03e4a5392bbb75e136fc753bb85fc021 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Mon, 11 May 2026 16:04:29 +0200 Subject: [PATCH] fix(commands): restore child.register handler (alias registerChild) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The P6.3 refactor dropped the case 'registerChild' branch from the nodeClass switch. Restored as a canonical child.register descriptor with the legacy registerChild alias. Monster accepts measurement children — without this, inbound Port 2 handshakes from a child were silently ignored. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/commands/handlers.js | 12 ++++++++++++ src/commands/index.js | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/commands/handlers.js b/src/commands/handlers.js index 5391b11..cf7781e 100644 --- a/src/commands/handlers.js +++ b/src/commands/handlers.js @@ -40,3 +40,15 @@ exports.setMode = (source, msg) => { exports.setModelPrediction = (source, msg) => { if (typeof source.setModelPrediction === 'function') source.setModelPrediction(msg.payload); }; + +// Inbound child registration from a measurement (or other) child node. +// Ported from the legacy `case 'registerChild'` branch in nodeClass. +exports.childRegister = (source, msg, ctx) => { + const childId = msg.payload; + const childObj = ctx?.RED?.nodes?.getNode?.(childId); + if (!childObj?.source) { + (ctx?.logger || source.logger)?.warn?.(`child.register skipped: missing child/source for id=${childId}`); + return; + } + source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent, msg.distance); +}; diff --git a/src/commands/index.js b/src/commands/index.js index 6e264eb..3fdea33 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -44,4 +44,10 @@ module.exports = [ payloadSchema: { type: 'any' }, handler: handlers.setModelPrediction, }, + { + topic: 'child.register', + aliases: ['registerChild'], + payloadSchema: { type: 'string' }, + handler: handlers.childRegister, + }, ];