mode buttons removed from thermostat
This commit is contained in:
@@ -407,40 +407,7 @@
|
|||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-controls {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(3, 1fr);
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-button {
|
|
||||||
padding: 0.75rem;
|
|
||||||
border: 2px solid #ddd;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s;
|
|
||||||
background: white;
|
|
||||||
color: #666;
|
|
||||||
min-height: 44px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-button:hover {
|
|
||||||
border-color: #667eea;
|
|
||||||
color: #667eea;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-button.active {
|
|
||||||
background: #667eea;
|
|
||||||
border-color: #667eea;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-button:active {
|
|
||||||
transform: scale(0.95);
|
|
||||||
}
|
|
||||||
|
|
||||||
.events {
|
.events {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
@@ -614,27 +581,6 @@
|
|||||||
+0.5
|
+0.5
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mode-controls">
|
|
||||||
<button
|
|
||||||
class="mode-button"
|
|
||||||
id="mode-{{ device.device_id }}-off"
|
|
||||||
onclick="setMode('{{ device.device_id }}', 'off')">
|
|
||||||
Off
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="mode-button"
|
|
||||||
id="mode-{{ device.device_id }}-heat"
|
|
||||||
onclick="setMode('{{ device.device_id }}', 'heat')">
|
|
||||||
Heat
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="mode-button"
|
|
||||||
id="mode-{{ device.device_id }}-auto"
|
|
||||||
onclick="setMode('{{ device.device_id }}', 'auto')">
|
|
||||||
Auto
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -877,38 +823,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set thermostat mode
|
|
||||||
async function setMode(deviceId, mode) {
|
|
||||||
const currentTarget = thermostatTargets[deviceId] || 21.0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(api(`/devices/${deviceId}/set`), {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
type: 'thermostat',
|
|
||||||
payload: {
|
|
||||||
mode: mode,
|
|
||||||
target: currentTarget
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
console.log(`Sent mode ${mode} to ${deviceId}`);
|
|
||||||
addEvent({
|
|
||||||
action: 'mode_set',
|
|
||||||
device_id: deviceId,
|
|
||||||
mode: mode
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to set mode:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update device UI
|
// Update device UI
|
||||||
function updateDeviceUI(deviceId, power, brightness) {
|
function updateDeviceUI(deviceId, power, brightness) {
|
||||||
currentState[deviceId] = power;
|
currentState[deviceId] = power;
|
||||||
@@ -973,18 +887,6 @@
|
|||||||
modeSpan.textContent = mode.toUpperCase();
|
modeSpan.textContent = mode.toUpperCase();
|
||||||
}
|
}
|
||||||
thermostatModes[deviceId] = mode;
|
thermostatModes[deviceId] = mode;
|
||||||
|
|
||||||
// Update mode button states
|
|
||||||
['off', 'heat', 'auto'].forEach(m => {
|
|
||||||
const btn = document.getElementById(`mode-${deviceId}-${m}`);
|
|
||||||
if (btn) {
|
|
||||||
if (m === mode.toLowerCase()) {
|
|
||||||
btn.classList.add('active');
|
|
||||||
} else {
|
|
||||||
btn.classList.remove('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user