Skip to content

Releases: jandado/smartbox

2.7.0

Choose a tag to compare

@jandado jandado released this 03 Oct 20:10

2.7.0

Highlights

  • New per-user websocket transport (ws_user): WsUserSocketSession — one connection serves every device of the account, replacing the N per-device socket_io sessions that suffer the backend's missing pings (the Server has stopped communicating 85-second cycle). Server-side proxy PINGs supervise the session; the server cuts the socket exactly at the access token's 4 h expiry (close code 1006) and the reconnect with a fresh token is mandatory and part of the steady state.
  • check_ws_user_support() probe + WsUserUnsupportedError and the fallback doctrine: only deterministic handshake rejections signal "endpoint unsupported"; transient trouble is retried and never demotes. UpdateManager gains a ws_user_socket= kwarg so availability tracking and writes route through whichever transport is active.
  • Shared retry/backoff helpers for the REST side.
  • CLI: authentication options resolve from SMARTBOX_* environment variables and a .env file (searched upward from the working directory; precedence command line > shell > .env).
  • README rewritten: library usage, every CLI command documented, .env section, websocket transports section.

Fixes

  • .env parsing follows python-dotenv semantics: an inline # starts a comment only when it is preceded by whitespace and lies outside quotes, and quoted values unquote cleanly even when a trailing comment follows. Previously inline comments silently became part of the value (corrupting credentials written in the conventional quoted style).

Breaking

  • UpdateManager.socket_session returns None in ws_user mode (previously always a SocketSession); use the new ws_user_socket accessor to distinguish modes.

Internal

  • UpdateManager: the four identical subscribe_to_node_* bodies share one _subscribe_to_node_key implementation; public API unchanged (contract tests).
  • Socket tests for namespace callbacks, websocket cleanup, SIGINT handling and cancellation during connect; coverage floor raised to 95% (socket.py no longer excluded); ruff and mypy run over tests/ in CI.

2.6.2

Choose a tag to compare

@jandado jandado released this 01 Oct 09:49

smartbox v2.6.2

Port round of upstream PR #64 (improvements/fix_bugs, 19 commits). Every commit was audited intent-level against this tree — full per-commit verdicts and evidence in ajtudela-pr-64-audit.md. Ten commits were independently fixed by the 2.6.x round; of the remainder, seven were ported, one declined by decision, one is upstream-only.

Bug fixes

  • set_node_setup can no longer wipe undeclared setup keys on the device (upstream 5618aa3). The setup endpoint requires the whole configuration to be re-posted; the read-modify-write GET is now always raw, so keys the setup models do not declare (e.g. counter_offset on pmo nodes) survive every write. Completed with extra="allow" on DefaultNodeSetup/PmoSetup: typed (raw_response=False) reads keep unknown keys and round-trip losslessly.
  • Common exception root (upstream 62efcf8): InvalidAuthError, APIUnavailableError and ResellerNotExistError now derive from SmartboxError — one except SmartboxError catches every library failure. APIUnavailableError keeps its aiohttp.ClientConnectionError base for backwards compatibility; the data-path 403 → SmartboxError mapping is kept deliberately.
  • CLI: unknown -d/-n values raise click.BadParameter with a param_hint (exit code 2, usage line rendered, offending option named) instead of a generic error; malformed wire node payloads stay runtime errors (upstream 6ad2014).

Build & docs

  • Core dependencies bounded to their current major: aiohttp>=3,<4, pydantic>=2,<3, python-socketio>=5,<6 (upstream da3bb9c).
  • .vscode/settings.json: pylint/flake8 editor settings replaced with the ruff formatter/code-actions setup (upstream a78bc3a).
  • CODEOWNERS co-owner and README badge reflow adopted from upstream (upstream 2ec1ef0).
  • README staleness fixes: duplicate empty Installation heading removed, --basic-auth-creds long option corrected, Python floor >=3.14.2, tox -e py314, basic-auth pointer moved to api-notes.md.

Tests

  • test_all_resellers (real HTTP calls to twelve reseller servers) moved behind a network marker, deselected by default; run on demand with pytest -m network. Sessions in it are closed (upstream 0bef64c).

Deliberately not ported

  • The catch-all DefaultNodeStatus fallback (upstream 6d592bf): typed mode (raw_response=False) keeps rejecting sparse payloads with SmartboxValidationError and the offending wire payload attached — the documented bare {"sync_status": "lost"} dead-node frame is first-class in that design, and silently-None fields would hide firmware drift. Rationale in the audit doc.

Full changes since 2.6.1: see the 2.6.2 section of the CHANGELOG.

2.6.1

Choose a tag to compare

@jandado jandado released this 30 Sep 22:44

Release notes 2.6.1

Features

  • Node availability tracking on UpdateManager: subscribe_to_node_availability / get_node_availability report each node as Available/Unavailable from its status/setup frames. A bare {"sync_status": "lost"} frame arms a uniform 6 s grace timer (configurable via unavailable_delay, matching the vendor app's unreachable window); any ok frame reports Available again.
  • Write-confirmation tracking: expect_write_confirmation (knob write_confirm_timeout, 6 s) opens a window after each accepted write. If no ok frame arrives, a one-shot discriminating GET decides whether the write was applied (node alive) or silently dropped (node unreachable) — writes to unreachable nodes are ACKed OK with no device ack. Frame taps register lazily and are shared by both features; each enables them independently.

Improvements

  • SmartboxValidationError now carries the offending wire payload as .payload, so callers can inspect the actual shape (e.g. distinguish a documented dead-node status frame from other drift).

Both features are backed by live probes from 2026-09-26/30 (api-notes.md, "Node reachability").

2.6.0

Choose a tag to compare

@jandado jandado released this 27 Sep 20:24
v2.6.0

docs and live-capture tooling for 2.6.0