Skip to content

fix(ota): register the plugin handlers once - #3060

Merged
asgothian merged 1 commit into
ioBroker:masterfrom
MikeFTV:fix/ota-duplicate-handlers
Nov 21, 2026
Merged

asgothian merged 1 commit into
ioBroker:masterfrom
MikeFTV:fix/ota-duplicate-handlers

Conversation

@MikeFTV

@MikeFTV MikeFTV commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Why

Fixes #3059. The OTA plugin registered its message and stateChange handlers twice: once in the constructor and once in start(). One write to info.ota therefore started two availability scans, and one write to info.ota_available started two update attempts per device, the second failing with OTA already in progress. The constructor registrations were also never removed by stop().

What changes

  • lib/pluginOta.js: remove the two this.adapter.on(...) calls from the constructor. start() already registers both handlers through registerHandler(), which stop() unregisters. The handlers need zbController, which only exists after start(), so nothing is lost.
  • test/otaHandlers.test.js: new regression test against a stubbed adapter (no hardware).
  • README.md: changelog line under WORK IN PROGRESS.

Tests

  • node --test test/otaHandlers.test.js: 3 passed. Without the fix to lib/pluginOta.js, all 3 fail (2 listeners instead of 1 after start(), 2 scans for one write, 1 listener left after stop()).

The constructor and start() both registered the message and stateChange
handlers, so one write to info.ota started two scans and one write to
info.ota_available started two updates per device. Drop the constructor
registrations; start() registers them through registerHandler(), which
stop() removes again.
@asgothian

Copy link
Copy Markdown
Collaborator

Thanks.. guess i missed that when adding the registerHandler method to the plugin structure.

@asgothian
asgothian merged commit 1be3e2d into ioBroker:master Nov 21, 2026
11 checks passed
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.

OTA checks and bulk firmware updates run twice in 3.6.1

2 participants