Skip to content

Commit d57f24a

Browse files
fhirschmannclaude
andcommitted
feat: Bluetooth-mode dropdown in the control tab
Adds a dropdown (like the sleep-timer one) to switch operation mode between Normal, Bluetooth speaker (sink) and Bluetooth headphones (source) right from the control tab. Reuses setOperationMode()/the /mode endpoint, so selecting a mode restarts the device into it; the button highlights the active BT mode. New control.bt* locale keys in all langs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 082a2ea commit d57f24a

5 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ neon logo that doubles as the SVG favicon ([`8d9725c`](../../commit/8d9725c)):
8686
| Bluetooth modes can be stopped from the web interface; commands 143/144 switch modes directly via buttons | [`0c3edd0`](../../commit/0c3edd0) |
8787
| Button lock (Kindersicherung) toggle directly in the control tab of the web interface with visual lock status indicator | [`ae83116`](../../commit/ae83116) |
8888
| Control buttons (single-track Repeat toggle, Sleep-Timer with dropdown and live remaining countdown, Night Mode/Dimming) directly in the control tab of the web interface | [`6918d36`](../../commit/6918d36) |
89+
| Bluetooth-mode dropdown in the control tab (Normal / Speaker / Headphones), mirroring the sleep-timer dropdown; selecting a mode restarts the device into it and the button highlights the active BT mode | [`b9f1e5c`](../../commit/b9f1e5c) |
8990

9091
#### Feature highlights
9192

‎html/locales/de.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@
160160
"command": "Modifikation ausführen",
161161
"locked": "Gesperrt",
162162
"unlocked": "Entsperrt",
163+
"btMode": "Bluetooth",
164+
"btNormal": "Normal",
165+
"btSpeaker": "Lautsprecher",
166+
"btHeadphones": "Kopfhörer",
163167
"nightOn": "Nacht An",
164168
"nightOff": "Nacht Aus",
165169
"repeatOff": "Aus",

‎html/locales/en.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@
161161
"command": "Execute Modification",
162162
"locked": "Locked",
163163
"unlocked": "Unlocked",
164+
"btMode": "Bluetooth",
165+
"btNormal": "Normal",
166+
"btSpeaker": "Speaker",
167+
"btHeadphones": "Headphones",
164168
"nightOn": "Night On",
165169
"nightOff": "Night Off",
166170
"repeatOff": "Off",

‎html/locales/fr.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
"command": "Exécuter la modification",
154154
"locked": "Verrouillé",
155155
"unlocked": "Déverrouillé",
156+
"btMode": "Bluetooth",
157+
"btNormal": "Normal",
158+
"btSpeaker": "Enceinte",
159+
"btHeadphones": "Casque",
156160
"nightOn": "Nuit On",
157161
"nightOff": "Nuit Off",
158162
"repeatOff": "Off",

‎html/management.html‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,18 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
17521752
<span id="ico-night-mode" class="fas fa-moon"></span>
17531753
<span id="lbl-night-mode" class="d-none d-sm-inline" data-i18n="control.nightOff">Night Off</span>
17541754
</button>
1755+
<!-- Bluetooth Mode Dropdown -->
1756+
<div class="dropdown d-inline-flex align-items-center">
1757+
<button type="button" class="btn btn-sm cp-control-button dropdown-toggle" id="btn-bt-mode" data-bs-toggle="dropdown" aria-expanded="false">
1758+
<span class="fab fa-bluetooth-b"></span>
1759+
<span id="lbl-bt-mode" class="d-none d-sm-inline" data-i18n="control.btMode">Bluetooth</span>
1760+
</button>
1761+
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end" aria-labelledby="btn-bt-mode" style="border: 1px solid var(--cp-border); background: var(--cp-panel); margin-top: 5px;">
1762+
<li><a class="dropdown-item" href="#" onclick="setOperationMode(0)" data-i18n="control.btNormal">Normal</a></li>
1763+
<li><a class="dropdown-item" href="#" onclick="setOperationMode(1)" data-i18n="control.btSpeaker">Speaker</a></li>
1764+
<li><a class="dropdown-item" href="#" onclick="setOperationMode(2)" data-i18n="control.btHeadphones">Headphones</a></li>
1765+
</ul>
1766+
</div>
17551767
<!-- Key Lock Button -->
17561768
<button type="button" class="btn btn-sm cp-lock-button unlocked" id="btn-lock-controls" onclick="sendControl(100)">
17571769
<span id="ico-lock-controls" class="fas fa-lock-open"></span>
@@ -3825,6 +3837,25 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
38253837
if (btTab) {
38263838
btTab.classList.toggle('bt-active', opmode === 1 || opmode === 2);
38273839
}
3840+
3841+
// Control-tab Bluetooth-mode dropdown button
3842+
const btBtn = document.getElementById('btn-bt-mode');
3843+
const btLbl = document.getElementById('lbl-bt-mode');
3844+
if (btBtn && btLbl) {
3845+
if (opmode === 1) {
3846+
btBtn.className = "btn btn-sm cp-control-button active-magenta dropdown-toggle";
3847+
btLbl.setAttribute('data-i18n', 'control.btSpeaker');
3848+
btLbl.innerHTML = i18next.t("control.btSpeaker", "Speaker");
3849+
} else if (opmode === 2) {
3850+
btBtn.className = "btn btn-sm cp-control-button active-magenta dropdown-toggle";
3851+
btLbl.setAttribute('data-i18n', 'control.btHeadphones');
3852+
btLbl.innerHTML = i18next.t("control.btHeadphones", "Headphones");
3853+
} else {
3854+
btBtn.className = "btn btn-sm cp-control-button dropdown-toggle";
3855+
btLbl.setAttribute('data-i18n', 'control.btMode');
3856+
btLbl.innerHTML = i18next.t("control.btMode", "Bluetooth");
3857+
}
3858+
}
38283859
} function connect() {
38293860
socket = new WebSocket("ws://" + host + "/ws");
38303861
socket.onopen = function () {

0 commit comments

Comments
 (0)