Skip to content

Metadata.File: implement generateUpdateMetadataCacheNotification (fix backend-edge with file metadata) - #3865

Open
schlabsch wants to merge 1 commit into
OpenEMS:developfrom
schlabsch:fix/file-metadata-edge-cache
Open

Metadata.File: implement generateUpdateMetadataCacheNotification (fix backend-edge with file metadata)#3865
schlabsch wants to merge 1 commit into
OpenEMS:developfrom
schlabsch:fix/file-metadata-edge-cache

Conversation

@schlabsch

@schlabsch schlabsch commented Aug 4, 2026

Copy link
Copy Markdown

Problem

In the split backend / backend-edge topology (introduced 2026.2), Backend.Edge.App only starts its edge-facing websocket server after its cache is initialized from the Edge Manager's UpdateMetadataCache notification (BackendEdgeServerApp.evaluateServerStart() requires cache.isInitialized(), which requires a non-empty apikey→edgeId map).

Metadata.generateUpdateMetadataCacheNotification() has a default implementation returning UpdateMetadataCache.Notification.empty(), and only the Odoo metadata provides a real implementation. As a result, deployments using Metadata.File can never accept Edge connections on any post-2026.1 backend: the backend-edge connects to the Edge Manager, receives an empty cache notification, and its edge websocket server (port 8081) never starts.

Reproduced on 2026.4.0 and 2026.8.0 with the official docker images (openems/backend + openems/backend-edge) and a standard metadata.json.

Fix

Override generateUpdateMetadataCacheNotification() in MetadataFile: refresh the parsed file and publish the apikey→edgeId map for all configured edges — mirroring what the Odoo metadata does.

Verified on a live deployment (backend 2026.8.0 + backend-edge 2026.8.0, file metadata, 6 edges): after this patch the backend-edge cache initializes, its edge server starts, edges authenticate by apikey and stream data end-to-end (websocket UI + InfluxDB timedata).

The Backend.Edge.App (backend-edge) only starts its edge-facing websocket
server once its cache is initialized from the Edge Manager's
UpdateMetadataCache notification. The default
Metadata.generateUpdateMetadataCacheNotification() returns an empty
notification and is only overridden by the Odoo metadata, so deployments
using file-based metadata can never accept Edge connections in the split
backend / backend-edge topology.

Publish the apikey-to-edgeId map from metadata.json so file-based
deployments work with the backend-edge process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant