Add RESTART command for master and slaves via ESP-NOW.
UART RESTART (client_id 0 = local reboot, >0 = unicast); dashboard and CLI hooks; delayed esp_restart after response. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+43
-2
@@ -233,6 +233,12 @@
|
||||
title="LED-Ring: Rot/Grün/Blau je 3×">
|
||||
Find me
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="restart(0)"
|
||||
:disabled="busy || !state.uart_connected"
|
||||
title="Master neu starten">
|
||||
Restart
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-muted small mt-2 mb-0" x-show="!state.uart_connected">
|
||||
UART nicht verbunden — Eingabe gesperrt.
|
||||
@@ -312,6 +318,12 @@
|
||||
title="LED-Ring Find me (ESP-NOW)">
|
||||
Find me
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="restart(c.id)"
|
||||
:disabled="busy || !state.uart_connected || !c.available"
|
||||
title="Neustart per ESP-NOW">
|
||||
Restart
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -366,7 +378,11 @@
|
||||
x-text="ota.masterMessage || (ota.step === 'master' ? ota.message : '')"></p>
|
||||
</td>
|
||||
<td class="ota-restart-col text-end">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm">Restart</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="restart(0)"
|
||||
:disabled="busy || !state.uart_connected">
|
||||
Restart
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -399,7 +415,11 @@
|
||||
<p class="small text-muted mb-0" x-text="row.bytesLabel"></p>
|
||||
</td>
|
||||
<td class="ota-restart-col text-end">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm">Restart</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
@click="restart(row.id)"
|
||||
:disabled="busy || !state.uart_connected">
|
||||
Restart
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -739,6 +759,27 @@
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
async restart(clientId = 0) {
|
||||
this.busy = true;
|
||||
try {
|
||||
const r = await fetch('/api/restart', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ client_id: clientId })
|
||||
});
|
||||
const data = await r.json();
|
||||
if (!r.ok || !data.success) {
|
||||
this.flash(data.error || 'Restart fehlgeschlagen', false);
|
||||
return;
|
||||
}
|
||||
const label = clientId === 0 ? 'Master' : `Slave ${clientId}`;
|
||||
this.flash(`Restart ausgelöst (${label})`, true);
|
||||
} catch (e) {
|
||||
this.flash(String(e), false);
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
async findMe(clientId = 0) {
|
||||
this.busy = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user