Skip to content

Ensure instance monitoring objects (alive/connected) exist - #640

Open
krobipd wants to merge 1 commit into
ioBroker:masterfrom
krobipd:fix/instance-monitoring-objects
Open

Ensure instance monitoring objects (alive/connected) exist#640
krobipd wants to merge 1 commit into
ioBroker:masterfrom
krobipd:fix/instance-monitoring-objects

Conversation

@krobipd

@krobipd krobipd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Symptom

The devices instance is shown red in the admin Instances tab for a few seconds every time the tab is opened (or after a browser refresh), then turns green. It happens only for devices, not for other adapters, and nothing is logged — even in debug. Reported in #603 and in the forum (topic 84587); the workaround users found was to delete and re-create the instance.

Root cause

On the affected installations the instance monitoring objects system.adapter.devices.<n>.alive and system.adapter.devices.<n>.connected are missing, while their state values still exist (js-controller keeps writing them via the heartbeat).

When the Instances tab loads, its object-based state snapshot (getForeignStates('system.adapter.*')) skips the object-less states, so alive/connected are briefly absent from the admin's cache and getInstanceStatus() evaluates !alive || !connectedred. The live state subscription then delivers a heartbeat and the row turns green.

This is specific to devices: other connectionType: none daemon adapters (e.g. javascript) still have both objects. The current code neither deletes nor recreates them, so once they are gone (older version / upgrade) the situation persists.

Fix

Recreate the two objects idempotently on start with setForeignObjectNotExistsAsync, modeled on the standard instance-state objects (boolean, role indicator.state). Healthy instances are left untouched; affected instances self-heal on the next start — no data loss, unlike delete-and-recreate.

How it was verified

On a live system with the objects missing (red confirmed in Safari and Firefox):

  • Creating the two objects → the instance turns green immediately and stays green across tab switches and force-refresh.
  • The objects survive an adapter restart — nothing removes them again.
  • getForeignStates('system.adapter.devices.0.*') returned the states again once the objects existed (it was empty before).

npm run build:backend and eslint pass.

Addresses #603.

On some upgraded installations the `system.adapter.<instance>.alive` and
`.connected` objects are missing while their state values persist. The admin
"Instances" tab then shows the instance red for a few seconds whenever the tab is
opened, because its object-based state snapshot skips object-less states (ioBroker#603).

Recreate the two objects idempotently on start via `setForeignObjectNotExistsAsync`,
so healthy instances stay untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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