Skip to content

feat: add Beep On Touch to device settings - #928

Merged
tavdog merged 1 commit into
tronbyt:mainfrom
mattiacolombomc:touch-beep-setting
Sep 22, 2026
Merged

tavdog merged 1 commit into
tronbyt:mainfrom
mattiacolombomc:touch-beep-setting

Conversation

@mattiacolombomc

@mattiacolombomc mattiacolombomc commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds the new firmware setting touch_beep ("Beep On Touch", Tidbyt Gen2 only) to the server, so it can be toggled from the device edit page and the API instead of only through the WiFi config portal.

Firmware side: tronbyt/firmware-esp32#159. The firmware reports "touch_beep" in client_info and accepts {"touch_beep": true|false} as a WebSocket setting, exactly like disable_touch. Unlike disable_touch it takes effect immediately, no reboot needed.

How

This mirrors #903 (disable_touch) field for field:

  • ClientInfo / data.DeviceInfo: new TouchBeep *bool, stored when the device reports it (Info is JSON, so no migration)
  • update_firmware_settings (web form): touch_beep added to the boolean fields
  • API: touchBeep in the device payload and in FirmwareSettingsUpdate, forwarded to the device as touch_beep
  • Device edit page: "Beep On Touch" checkbox right after "Disable Touch Button", inside the same tidbyt_gen2 block
  • English and German strings, API.md

One difference from disable_touch: the checkbox is only rendered once the device has reported touch_beep. Firmware that predates the setting never reports it, so those devices do not get a control that does nothing. I used the reported value rather than a SupportsColorOrder-style version gate because the firmware PR is not released yet; happy to switch to a version check once there is a version to compare against.

Testing

  • go build ./..., go vet ./..., go test ./... pass; gofmt and djlint --profile=golang (check + lint) are clean
  • New/extended tests: client_info with touch_beep is persisted; touchBeep is returned by GET /v0/devices/{id} and forwarded by the API settings update; the web form sends touch_beep true and false to the device; the checkbox is shown for a Gen2 only after the field was reported (and is checked accordingly), and never for other device types

Not tested: end to end against a device (I run the firmware PR on a Gen2, but against the released server), and golangci-lint was not run locally. The German wording is mine, corrections welcome.

This only makes sense once tronbyt/firmware-esp32#159 is merged, so feel free to leave it open until then.

Summary by CodeRabbit

  • New Features

    • Added a “Beep On Touch” setting for Tidbyt Gen2 devices.
    • Users can enable or disable a short tone when the touch button is pressed, with changes taking effect immediately.
    • The setting is available through the device manager and firmware settings API.
    • Device information now reports whether touch beep is supported and enabled.
  • Documentation

    • Updated API documentation and localized interface text in English and German.

Expose the firmware touch_beep setting (Tidbyt Gen2) the same way as
disable_touch: store the value reported in client_info, send it through
update_firmware_settings (web form and API), return it as touchBeep in
the device API, and add a checkbox under Live Firmware Settings.

The checkbox is only shown once the device has reported touch_beep, so
older firmware that does not know the setting does not get a control
that does nothing.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 09b568e9-a193-4119-928c-3c6b6ff6bf92

📥 Commits

Reviewing files that changed from the base of the PR and between e644f6b and 5aa1aa1.

📒 Files selected for processing (11)
  • API.md
  • internal/data/models.go
  • internal/server/handlers_api.go
  • internal/server/handlers_api_test.go
  • internal/server/handlers_device.go
  • internal/server/handlers_device_test.go
  • internal/server/websockets.go
  • internal/server/websockets_test.go
  • web/i18n/de.json
  • web/i18n/en.json
  • web/templates/manager/update.html

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

Touch beep firmware setting

Layer / File(s) Summary
Device state and client reporting
internal/data/models.go, internal/server/websockets.go, internal/server/websockets_test.go
Device and client information now carry TouchBeep. WebSocket processing stores reported values in device information.
API and device command handling
internal/server/handlers_api.go, internal/server/handlers_device.go, internal/server/*_test.go
The API exposes and accepts touchBeep. Form and API updates forward touch_beep to device commands. Tests cover state, API payloads, and boolean updates.
Management UI and documentation
web/templates/manager/update.html, web/i18n/*.json, API.md
The Gen2 page displays a conditional checkbox with localized text. API documentation describes the request field and firmware requirements.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Firmware
  participant WebSocket
  participant Server
  participant ManagementUI
  Firmware->>WebSocket: Report touch_beep
  WebSocket->>Server: Store TouchBeep in device info
  Server->>ManagementUI: Render supported setting
  ManagementUI->>Server: Submit touch_beep update
  Server->>Firmware: Send firmware settings command
Loading

Suggested reviewers: ahaghgoo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 7 files. (4 skipped: 4… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding the Beep On Touch setting to device settings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 7 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI

Comment @coderabbitai help to get the list of available commands.

@tavdog
tavdog merged commit a728746 into tronbyt:main Sep 22, 2026
7 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.

2 participants