Skip to content

Navigation Menu

Sign in
Sign up

Expose Skale details and controls in Scale settings - #75

Draft
MaxRink wants to merge 7 commits into
decentespresso:main from
MaxRink:feat/skale-device-details
Draft

Expose Skale details and controls in Scale settings #75
MaxRink wants to merge 7 commits into
decentespresso:main from
MaxRink:feat/skale-device-details

Conversation

@MaxRink

@MaxRink MaxRink commented Sep 6, 2026
edited
Loading

Copy link
Copy Markdown

What was missing

Streamline's Settings > Devices > Scale page needed to show metadata from the currently connected scale while keeping device-owned controls tied to the selected device.

Fix

  • Fetch metadata only from GET /api/v1/scale/info, which describes the current connected scale. The inventory /api/v1/devices response is used only for device identity and connection state.
  • Keep scale metadata keyed by device ID, but clear and generation-fence it across scale changes, disconnects, reconnects, and stale responses.
  • Prevent repeated renders from invalidating an existing in-flight request.
  • Show firmware and battery only for the connected scale with matching metadata. Unknown battery values remain unknown; there is no live-snapshot fallback that could belong to another scale.
  • Treat 404, 405, 501, and 503 scale-info responses as unavailable metadata without fabricating values for older hosts or disconnected scales.
  • Keep Preferred Scale, Skale Square Button, and Skale USB Power controls per-device, with legacy scalar-setting fallback where supported.

API contract

This follows decentespresso/decaid#743: a successful response is ScaleInfo with optional firmwareVersion and nullable batteryLevel; 503 means no scale is connected. No new WebSocket or inventory metadata dependency was added.

Validation

  • npm test — 574 passed.
  • node --input-type=module --check < src/modules/api.js — passed.
  • Executable focused tests cover API parsing and status propagation, repeated in-flight refreshes, A→B and A→B→A transitions, disconnects, stale completions, unavailable endpoints, disconnected cached metadata, and unknown battery values.

Screenshot note

The previous Scale-row screenshot was removed because it showed metadata from the inventory representation that this fix intentionally no longer uses. No replacement capture is included. The per-device controls popup screenshot remains:

Per-device Skale settings popup explaining the active-GHC restriction

MaxRink and others added 2 commits September 6, 2026 12:07
Surface firmware, battery, and USB power metadata where users already manage scales. Show the button-action and USB override toggles only when the connected Decaid version advertises those settings, preserving compatibility with older hosts.
This keeps device-specific controls on Streamline's dedicated Scale page instead of sending users through the general Decaid settings screen.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The scale snapshot can retain a stale battery value after the manual USB override suppresses battery reads. Prefer the explicit power-source metadata and omit the battery badge while USB power is active.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MaxRink and others added 5 commits September 6, 2026 15:17
The Scale page exposed Skale controls as global page-level toggles, obscuring which connected device they configured and preventing independent values for multiple scales.
Each scale row now opens a settings popup containing its preferred-device, square-button, and USB-power controls. Per-device maps are keyed by the selected device ID, while legacy scalar hosts remain usable through a compatibility fallback.
The popup uses data attributes rather than interpolated JavaScript identifiers and retains the existing staged Save behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
DE1 firmware does not permit a remote control to start espresso when the group-head controller is active; it only arms the white ready indication. The previous popup text incorrectly promised a start on every machine.\n\nState that square-button starts require a machine without an active GHC while stops remain available on all machines.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Device inventory no longer carries connection-scoped deviceInfo. Keep metadata rendering neutral for unavailable and switching devices until the connected-scale info endpoint is consumed by the shared scale state.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Render connected scale firmware and battery metadata from the dedicated API endpoint with connection-race protection.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /