github RinDevJunior/matterbridge-roborock-vacuum-plugin 1.1.1-rc14

one day ago

Improved robustness for Roborock IoT REST calls — Summary

Overview

Improved resilience and error handling for Roborock IoT REST interactions, tightened test typings, and ensured lint/tests pass.

Key fixes

  • Resilience: Implemented an axios instance with timeout, keep-alive agent, and retry/backoff via axios-retry to handle transient network errors (including ECONNRESET, ETIMEDOUT).
  • Error handling: Wrapped REST calls and scheduled async handlers with try/catch so transient failures return undefined instead of causing unhandled rejections.
  • Typing: Removed any usages in tests and replaced them with explicit mock interfaces and unknown-based casts.
  • Lint/tests: Fixed ESLint issues and updated tests; full suite and lint now pass locally.

Files changed (notable)

  • roborockIoTApi.ts — axios config, retry logic, try/catch on API methods.
  • module.ts — wrapped periodic/initial requestHomeData() calls with try/catch.
  • package.json — added axios-retry dependency.
  • roborockIoTApi.test.ts — new/updated unit tests for retry/exception behavior.
  • roborockService4.test.ts — removed any, added mock interfaces, adjusted expectations.
  • eslint.config.js — minor config updates to avoid parser issues.

Behavior notes / migration

  • API methods may now return undefined on transient failure where previously they could throw — callers should handle undefined (tests were updated).
  • Retries/backoff are enabled (3 attempts, exponential backoff). Monitor behavior in production and tune counts/delays if needed.

Test & lint status

  • All tests pass locally: 30 suites, 249 tests.
  • ESLint passes.

Don't miss a new matterbridge-roborock-vacuum-plugin release

NewReleases is sending notifications on new releases.