fix 5
This commit is contained in:
@@ -1649,6 +1649,21 @@
|
||||
<div class="group-card-title">${group.name}</div>
|
||||
<div class="group-card-subtitle">${group.device_count} ${group.device_count === 1 ? 'Gerät' : 'Geräte'}</div>
|
||||
</div>
|
||||
${group.capabilities.brightness ? `
|
||||
<div class="brightness-control">
|
||||
<label class="brightness-label">
|
||||
<span>🔆 Helligkeit</span>
|
||||
<span class="brightness-value" id="group-brightness-${group.id}">50%</span>
|
||||
</label>
|
||||
<input type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
value="50"
|
||||
class="brightness-slider"
|
||||
id="slider-group-${group.id}"
|
||||
oninput="updateGroupBrightnessDisplay('${group.id}', this.value)">
|
||||
</div>
|
||||
` : ''}
|
||||
<div class="group-card-actions">
|
||||
<button class="group-button on" onclick="setGroup('${group.id}', 'on', this)">
|
||||
Alle An
|
||||
@@ -1669,6 +1684,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Update group brightness display value
|
||||
function updateGroupBrightnessDisplay(groupId, value) {
|
||||
const display = document.getElementById(`group-brightness-${groupId}`);
|
||||
if (display) {
|
||||
display.textContent = `${value}%`;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute group action
|
||||
async function setGroup(groupId, power, buttonElement) {
|
||||
const allButtons = buttonElement.parentElement.querySelectorAll('button');
|
||||
@@ -1677,14 +1700,23 @@
|
||||
const originalHTML = buttonElement.innerHTML;
|
||||
buttonElement.innerHTML = '<span class="spinner"></span>';
|
||||
|
||||
// Get brightness value if slider exists
|
||||
const slider = document.getElementById(`slider-group-${groupId}`);
|
||||
const brightness = slider ? parseInt(slider.value) : null;
|
||||
|
||||
try {
|
||||
const payload = { power };
|
||||
if (brightness !== null && power === 'on') {
|
||||
payload.brightness = brightness;
|
||||
}
|
||||
|
||||
const response = await fetch(api(`/groups/${groupId}/set`), {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
action: {
|
||||
type: 'power',
|
||||
payload: { power }
|
||||
payload: payload
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user