feat: add Sync Time button to Device page in web UI
Adds a 'Sync Time' button in the Device Actions section that calls POST /api/action/sync-time to trigger NTP sync and RTC write. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -237,6 +237,7 @@ async function renderDevice(el) {
|
||||
<div class="card">
|
||||
<h2>Device Actions</h2>
|
||||
<div class="btn-group">
|
||||
<button class="btn" id="syncTime">Sync Time</button>
|
||||
<button class="btn btn-danger" onclick="if(confirm('Enter deep sleep?'))api('/api/action/sleep',{method:'POST'})">Deep Sleep</button>
|
||||
<button class="btn btn-danger" onclick="if(confirm('Reboot device?'))fetch('/api/action/reboot',{method:'POST'})">Reboot</button>
|
||||
</div>
|
||||
@@ -263,6 +264,12 @@ async function renderDevice(el) {
|
||||
status.style.color = '#c62828';
|
||||
}
|
||||
};
|
||||
|
||||
document.getElementById('syncTime').onclick = async () => {
|
||||
toast('Syncing...');
|
||||
const result = await api('/api/action/sync-time', { method: 'POST' });
|
||||
toast(result.msg || 'Time synced');
|
||||
};
|
||||
}
|
||||
|
||||
async function renderFirmware(el) {
|
||||
|
||||
Reference in New Issue
Block a user