feat(clock): timezone, NTP, set-time and clocktower sync in the device Clock tab
Console side of the firmware 3.x TimeKeeper overhaul (project-vesper F-079/F-081/F-083). The Clock tab's "Network & Time" card was read-only and showed fields the firmware no longer reports, and both analog clocks drew the browser's own time. - Time & Timezone card: device local time, zone, mode, UTC offset, DST state (incl. expired manual dates), next change, RTC synced. Read live from the device (system.get_time, clock.get_timezone) - the device is the source of truth for time settings; nothing about them is mirrored to Firestore. - EditTimezoneModal: Automatic (country -> zone from the backend timezone table, or a custom yearly rule built into a POSIX string), Manual DST (std offset, amount, this season's start/end), Fixed, Local only. - SetDeviceTimeModal: this computer's UTC time, or a typed local time. - NTP Sync card + NtpSettingsModal: automatic on/off, nightly time, servers, last result/drift; Sync Now queues clock.sync_ntp and polls clock.get_ntp. - SyncClockModal (was a placeholder): pause, enter what the face shows, clock.set_face + resume. - EditClockSettingsModal: face sync policy force/smart + max wait; mirrored as clockSettings.faceSyncMode / smartMaxWaitMin (added to the backend model, which silently dropped unknown keys - the old gmtOffsetSec/ntpServer mirror never persisted, so those dead drift checks are removed). - Device Time / Clocktower clocks now show the device's wall clock and the real face position (refreshed every 30 s while the clock runs). Live reads are chained after the existing clock.get_config drift check and face polling pauses while a modal or Sync Now is sending, because device replies are matched FIFO without a request id. Stage 5 of project-vesper docs/features/timekeeper-overhaul.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,13 @@ import api from '@/lib/api'
|
||||
import Card from '@/components/ui/Card'
|
||||
import Button from '@/components/ui/Button'
|
||||
import StatusBadge from '@/components/ui/StatusBadge'
|
||||
import { useToast } from '@/components/ui/Toast'
|
||||
import SyncClockModal from '@/modals/bellcloud/devices/SyncClockModal'
|
||||
import EditTimezoneModal from '@/modals/bellcloud/devices/EditTimezoneModal'
|
||||
import SetDeviceTimeModal from '@/modals/bellcloud/devices/SetDeviceTimeModal'
|
||||
import NtpSettingsModal from '@/modals/bellcloud/devices/NtpSettingsModal'
|
||||
import { fmtWallClock, fmtDeviceDateTime, fmtUtcOffset, fmtRelative } from '@/lib/formatters'
|
||||
import { TZ_MODE_LABELS } from '@/lib/deviceTimezone'
|
||||
|
||||
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -44,19 +50,31 @@ function silenceLabel(isOn, from, to) {
|
||||
return 'On'
|
||||
}
|
||||
|
||||
function formatUtcOffset(offsetSec) {
|
||||
if (offsetSec == null) return null
|
||||
const totalMinutes = offsetSec / 60
|
||||
const sign = totalMinutes >= 0 ? '+' : '-'
|
||||
const abs = Math.abs(totalMinutes)
|
||||
const hours = Math.floor(abs / 60)
|
||||
const minutes = abs % 60
|
||||
return minutes === 0 ? `UTC${sign}${hours}` : `UTC${sign}${hours}:${String(minutes).padStart(2, '0')}`
|
||||
// clock.get_ntp last_sync.result → badge (firmware 3.1.0+)
|
||||
const SYNC_RESULTS = {
|
||||
applied: { variant: 'success', label: 'Corrected' },
|
||||
in_sync: { variant: 'success', label: 'In sync' },
|
||||
pending_confirmation: { variant: 'warning', label: 'Awaiting confirmation' },
|
||||
mismatch_not_applied: { variant: 'warning', label: 'Mismatch — not applied' },
|
||||
failed: { variant: 'danger', label: 'Failed' },
|
||||
}
|
||||
|
||||
function fmtDrift(ms) {
|
||||
if (ms == null) return null
|
||||
const abs = Math.abs(ms)
|
||||
const sign = ms < 0 ? '−' : '+'
|
||||
if (abs < 1000) return `${sign}${abs} ms`
|
||||
if (abs < 120000) return `${sign}${(abs / 1000).toFixed(1)} s`
|
||||
return `${sign}${Math.round(abs / 60000)} min`
|
||||
}
|
||||
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
|
||||
// ─── Analog Clock Face ────────────────────────────────────────────────────────
|
||||
|
||||
function AnalogClock({ time, label, variant = 'primary' }) {
|
||||
// `time` is a wall-clock Date read with UTC getters (device time is in the device's timezone,
|
||||
// not the browser's). null = unknown: the face is drawn without hands.
|
||||
function AnalogClock({ time, label, variant = 'primary', showSeconds = true }) {
|
||||
const canvasRef = useRef(null)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -68,9 +86,9 @@ function AnalogClock({ time, label, variant = 'primary' }) {
|
||||
const cy = size / 2
|
||||
const r = size / 2 - 4
|
||||
|
||||
const h = time.getHours() % 12
|
||||
const m = time.getMinutes()
|
||||
const s = time.getSeconds()
|
||||
const h = time ? time.getUTCHours() % 12 : 0
|
||||
const m = time ? time.getUTCMinutes() : 0
|
||||
const s = time && showSeconds ? time.getUTCSeconds() : 0
|
||||
|
||||
const isPrimary = variant === 'primary'
|
||||
const accentColor = isPrimary ? 'rgba(192,193,255,0.9)' : 'rgba(192,193,255,0.35)'
|
||||
@@ -121,6 +139,8 @@ function AnalogClock({ time, label, variant = 'primary' }) {
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
if (!time) return
|
||||
|
||||
// Hour hand
|
||||
const hourAngle = ((h + m / 60) / 12) * Math.PI * 2 - Math.PI / 2
|
||||
ctx.beginPath()
|
||||
@@ -142,23 +162,30 @@ function AnalogClock({ time, label, variant = 'primary' }) {
|
||||
ctx.stroke()
|
||||
|
||||
// Second hand
|
||||
const secAngle = (s / 60) * Math.PI * 2 - Math.PI / 2
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(cx, cy)
|
||||
ctx.lineTo(cx + Math.cos(secAngle) * r * 0.82, cy + Math.sin(secAngle) * r * 0.82)
|
||||
ctx.strokeStyle = secondHandColor
|
||||
ctx.lineWidth = 1
|
||||
ctx.lineCap = 'round'
|
||||
ctx.stroke()
|
||||
if (showSeconds) {
|
||||
const secAngle = (s / 60) * Math.PI * 2 - Math.PI / 2
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(cx, cy)
|
||||
ctx.lineTo(cx + Math.cos(secAngle) * r * 0.82, cy + Math.sin(secAngle) * r * 0.82)
|
||||
ctx.strokeStyle = secondHandColor
|
||||
ctx.lineWidth = 1
|
||||
ctx.lineCap = 'round'
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
// Center dot
|
||||
ctx.beginPath()
|
||||
ctx.arc(cx, cy, isPrimary ? 4 : 3, 0, Math.PI * 2)
|
||||
ctx.fillStyle = centerDotColor
|
||||
ctx.fill()
|
||||
}, [time, variant])
|
||||
}, [time, variant, showSeconds])
|
||||
|
||||
const digitalTime = `${time.getHours().toString().padStart(2, '0')}:${time.getMinutes().toString().padStart(2, '0')}:${time.getSeconds().toString().padStart(2, '0')}`
|
||||
const pad2 = n => n.toString().padStart(2, '0')
|
||||
const digitalTime = !time
|
||||
? '—'
|
||||
: showSeconds
|
||||
? `${pad2(time.getUTCHours())}:${pad2(time.getUTCMinutes())}:${pad2(time.getUTCSeconds())}`
|
||||
: `${pad2(time.getUTCHours() % 12 || 12)}:${pad2(time.getUTCMinutes())}`
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 'var(--space-3)' }}>
|
||||
@@ -275,8 +302,16 @@ export default function ClockTab({
|
||||
loadDevice,
|
||||
reloadDeviceSilent,
|
||||
}) {
|
||||
const { toast } = useToast()
|
||||
const [now, setNow] = useState(new Date())
|
||||
const [showSync, setShowSync] = useState(false)
|
||||
const [showTimezone, setShowTimezone] = useState(false)
|
||||
const [showSetTime, setShowSetTime] = useState(false)
|
||||
const [showNtp, setShowNtp] = useState(false)
|
||||
const [syncingNtp, setSyncingNtp] = useState(false)
|
||||
// Live clock state read from the device (firmware 3.x) — the device is the source of truth
|
||||
// for time, timezone and NTP; none of it is mirrored to the device record.
|
||||
const [live, setLive] = useState({ status: 'loading', time: null, timeAt: 0, tz: null, ntp: null, face: null })
|
||||
const [flashFields, setFlashFields] = useState(false)
|
||||
const [togglingClock, setTogglingClock] = useState(false)
|
||||
|
||||
@@ -335,9 +370,8 @@ export default function ClockTab({
|
||||
trueBacklightOutput !== (clock?.backlightOutput || 0) ||
|
||||
(!!data.backlight && data.backlight_on !== extractTime(clock?.backlightTurnOnTime)) ||
|
||||
(!!data.backlight && data.backlight_off !== extractTime(clock?.backlightTurnOffTime)) ||
|
||||
(data.gmt_offset_sec != null && data.gmt_offset_sec !== clock?.gmtOffsetSec) ||
|
||||
(data.dst_offset_sec != null && data.dst_offset_sec !== clock?.dstOffsetSec) ||
|
||||
(data.ntp_server != null && data.ntp_server !== clock?.ntpServer)
|
||||
(data.face_sync_mode != null && data.face_sync_mode !== (clock?.faceSyncMode || 'force')) ||
|
||||
(data.smart_max_wait_min != null && data.smart_max_wait_min !== (clock?.smartMaxWaitMin ?? 61))
|
||||
|
||||
if (!hasDrift) return
|
||||
|
||||
@@ -363,18 +397,76 @@ export default function ClockTab({
|
||||
backlightOutput: trueBacklightOutput,
|
||||
backlightTurnOnTime: data.backlight_on ? `2000-01-01T${data.backlight_on}:00Z` : '',
|
||||
backlightTurnOffTime: data.backlight_off ? `2000-01-01T${data.backlight_off}:00Z` : '',
|
||||
gmtOffsetSec: data.gmt_offset_sec ?? clock?.gmtOffsetSec,
|
||||
dstOffsetSec: data.dst_offset_sec ?? clock?.dstOffsetSec,
|
||||
ntpServer: data.ntp_server ?? clock?.ntpServer,
|
||||
faceSyncMode: data.face_sync_mode ?? clock?.faceSyncMode ?? 'force',
|
||||
smartMaxWaitMin: data.smart_max_wait_min ?? clock?.smartMaxWaitMin ?? 61,
|
||||
},
|
||||
},
|
||||
}).then(() => reloadDeviceSilent?.())
|
||||
}).catch(() => {
|
||||
// Device offline or didn't reply — keep showing the last-known Firestore values.
|
||||
}).finally(() => {
|
||||
// Replies are matched FIFO (no req_id), so the live reads start only after this one
|
||||
loadLive()
|
||||
})
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [device?.id, device?.device_id])
|
||||
|
||||
// ── Live time / timezone / NTP / face from the device ─────────────────────
|
||||
// Replies are matched FIFO, so these go one after another.
|
||||
const loadLive = async (parts = ['time', 'tz', 'ntp', 'face']) => {
|
||||
if (!sendMqttCommandSilent) return
|
||||
const commands = { time: 'system.get_time', tz: 'clock.get_timezone', ntp: 'clock.get_ntp', face: 'clock.get_face' }
|
||||
const update = {}
|
||||
try {
|
||||
for (const part of parts) {
|
||||
const reply = await sendMqttCommandSilent(commands[part])
|
||||
update[part] = reply?.data || null
|
||||
if (part === 'time') update.timeAt = Date.now()
|
||||
}
|
||||
setLive(l => ({ ...l, ...update, status: 'ok' }))
|
||||
} catch {
|
||||
setLive(l => ({ ...l, ...update, status: l.status === 'ok' ? 'ok' : 'offline' }))
|
||||
}
|
||||
}
|
||||
|
||||
// The face moves a minute at a time — refresh it while the clock runs. Paused while a
|
||||
// modal or Sync Now may be sending commands, so FIFO reply matching can't cross wires.
|
||||
const busy = showSync || showTimezone || showSetTime || showNtp || syncingNtp
|
||||
useEffect(() => {
|
||||
if (!(attr?.hasClock) || live.status !== 'ok' || busy) return
|
||||
const id = setInterval(() => loadLive(['face']), 30000)
|
||||
return () => clearInterval(id)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [attr?.hasClock, live.status, busy])
|
||||
|
||||
// Sync Now runs on the device in the background (firmware 3.1.0+): poll clock.get_ntp until done
|
||||
const handleSyncNow = async () => {
|
||||
setSyncingNtp(true)
|
||||
try {
|
||||
await sendMqttCommand('clock.sync_ntp')
|
||||
let ntp = null
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await sleep(2000)
|
||||
ntp = (await sendMqttCommandSilent('clock.get_ntp'))?.data
|
||||
if (ntp && !ntp.sync_in_progress) break
|
||||
}
|
||||
setLive(l => ({ ...l, ntp: ntp || l.ntp }))
|
||||
const result = ntp?.last_sync
|
||||
if (!ntp || ntp.sync_in_progress || !result) {
|
||||
toast.warning('NTP sync', 'No result yet — check again in a moment.')
|
||||
} else {
|
||||
const label = SYNC_RESULTS[result.result]?.label || result.result
|
||||
const notify = result.result === 'failed' ? toast.danger : result.result.startsWith('mismatch') ? toast.warning : toast.success
|
||||
notify(`NTP: ${label}`, result.message)
|
||||
}
|
||||
await loadLive(['time'])
|
||||
} catch {
|
||||
// sendMqttCommand already showed the failure toast
|
||||
} finally {
|
||||
setSyncingNtp(false)
|
||||
}
|
||||
}
|
||||
|
||||
// ── Derived values ────────────────────────────────────────────────────────
|
||||
|
||||
const hasClock = attr?.hasClock ?? false
|
||||
@@ -399,9 +491,16 @@ export default function ClockTab({
|
||||
const backlightOnTime = extractTime(clock?.backlightTurnOnTime)
|
||||
const backlightOffTime = extractTime(clock?.backlightTurnOffTime)
|
||||
|
||||
const timezone = formatUtcOffset(clock?.gmtOffsetSec)
|
||||
const ntpServer = clock?.ntpServer || null
|
||||
const dstActive = !!clock?.dstOffsetSec
|
||||
const tz = live.tz
|
||||
const ntp = live.ntp
|
||||
const lastSync = ntp?.last_sync || null
|
||||
const syncBadge = lastSync ? (SYNC_RESULTS[lastSync.result] || { variant: 'neutral', label: lastSync.result }) : null
|
||||
// Device wall clock, ticking locally from the last system.get_time reply
|
||||
const deviceTime = live.time?.rtc_available
|
||||
? new Date(live.time.local_timestamp * 1000 + (now.getTime() - live.timeAt))
|
||||
: null
|
||||
const faceTime = live.face ? new Date(Date.UTC(2000, 0, 1, live.face.clock_hour % 12, live.face.clock_minute)) : null
|
||||
const liveMissing = live.status === 'loading' ? 'Loading…' : 'No reply from the device'
|
||||
|
||||
const alertTypeLabel =
|
||||
alertType === 'single' ? 'Single Fire' :
|
||||
@@ -576,8 +675,8 @@ export default function ClockTab({
|
||||
|
||||
{/* Right — clocks, with equal breathing room on all sides */}
|
||||
<div style={{ display: 'flex', alignItems: 'flex-start', gap: 'var(--space-12)', padding: '0 var(--space-8)' }}>
|
||||
<AnalogClock time={now} label="RTC Time" variant="primary" />
|
||||
<AnalogClock time={now} label="Clocktower" variant="primary" />
|
||||
<AnalogClock time={deviceTime} label="Device Time" variant="primary" />
|
||||
<AnalogClock time={faceTime} label="Clocktower" variant={hasClock ? 'primary' : 'secondary'} showSeconds={false} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -695,21 +794,91 @@ export default function ClockTab({
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Network & Time */}
|
||||
<Card title="Network & Time">
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' }}>
|
||||
<SettingRow label="Timezone" value={timezone || '—'} mono={!!timezone} />
|
||||
<SettingRow label="NTP Server" value={ntpServer || '—'} mono={!!ntpServer} />
|
||||
<SettingRow
|
||||
label="DST"
|
||||
badge={<StatusBadge variant={dstActive ? 'success' : 'neutral'}>{dstActive ? 'Active' : 'Not Active'}</StatusBadge>}
|
||||
/>
|
||||
</div>
|
||||
{canEdit && (
|
||||
<div style={{ marginTop: 'var(--space-4)', paddingTop: 'var(--space-4)', borderTop: '1px solid var(--color-border)' }}>
|
||||
<p style={{ fontSize: 'var(--font-size-xs)', color: 'var(--color-text-muted)' }}>
|
||||
Read-only — reported directly by the device. Editing timezone/NTP settings from the console is not yet supported.
|
||||
</p>
|
||||
{/* Time & Timezone (live from the device) */}
|
||||
<Card
|
||||
title="Time & Timezone"
|
||||
action={canEdit && live.status === 'ok' && (
|
||||
<div style={{ display: 'flex', gap: 'var(--space-2)' }}>
|
||||
<Button variant="ghost" size="sm" onClick={() => setShowSetTime(true)}>Set Time</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => setShowTimezone(true)}>Edit</Button>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{live.status !== 'ok' || !tz ? (
|
||||
<p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>{liveMissing}</p>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' }}>
|
||||
<SettingRow label="Local time" value={live.time?.local ? fmtWallClock(live.time.local) : '—'} />
|
||||
<SettingRow label="Timezone" value={tz.name || TZ_MODE_LABELS[tz.mode]} />
|
||||
<SettingRow label="Mode" value={TZ_MODE_LABELS[tz.mode] || tz.mode} />
|
||||
<SettingRow label="UTC offset" value={fmtUtcOffset(tz.current_offset_min)} mono />
|
||||
<SettingRow
|
||||
label="DST"
|
||||
badge={
|
||||
tz.mode === 'local' ? <StatusBadge variant="neutral">Not used</StatusBadge>
|
||||
: tz.dst_schedule_expired ? <StatusBadge variant="warning">Dates expired</StatusBadge>
|
||||
: <StatusBadge variant={tz.dst_active ? 'success' : 'neutral'}>{tz.dst_active ? 'Active' : 'Not active'}</StatusBadge>
|
||||
}
|
||||
/>
|
||||
{tz.next_transition > 0 && (
|
||||
<SettingRow label="Next change" value={fmtDeviceDateTime(tz.next_transition, tz.current_offset_min)} />
|
||||
)}
|
||||
<SettingRow
|
||||
label="Clock source"
|
||||
badge={<StatusBadge variant={live.time?.rtc_synced ? 'success' : 'warning'}>{live.time?.rtc_synced ? 'Synced' : 'Not synced yet'}</StatusBadge>}
|
||||
/>
|
||||
{tz.dst_schedule_expired && (
|
||||
<p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-warning)', marginTop: 'var(--space-2)' }}>
|
||||
The manual DST dates have passed — enter next season's dates.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{/* NTP Sync (live from the device) */}
|
||||
<Card
|
||||
title="NTP Sync"
|
||||
action={canEdit && live.status === 'ok' && (
|
||||
<div style={{ display: 'flex', gap: 'var(--space-2)' }}>
|
||||
<Button variant="ghost" size="sm" loading={syncingNtp} disabled={tz?.mode === 'local'} onClick={handleSyncNow}>Sync Now</Button>
|
||||
<Button variant="ghost" size="sm" onClick={() => setShowNtp(true)}>Edit</Button>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{live.status !== 'ok' || !ntp ? (
|
||||
<p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>{liveMissing}</p>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-2)' }}>
|
||||
<SettingRow
|
||||
label="Automatic"
|
||||
badge={<StatusBadge variant={ntp.auto && tz?.mode !== 'local' ? 'success' : 'neutral'}>
|
||||
{tz?.mode === 'local' ? 'Off (local mode)' : ntp.auto ? `Nightly ${ntp.sync_time}` : 'Off'}
|
||||
</StatusBadge>}
|
||||
/>
|
||||
<SettingRow label="Servers" value={(ntp.servers || []).join(', ') || '—'} mono />
|
||||
<SettingRow
|
||||
label="Last sync"
|
||||
badge={syncBadge ? <StatusBadge variant={syncBadge.variant}>{syncBadge.label}</StatusBadge> : null}
|
||||
value={syncBadge ? undefined : 'None since boot'}
|
||||
/>
|
||||
{lastSync && (
|
||||
<>
|
||||
<SettingRow label="When" value={lastSync.at ? fmtRelative(new Date(lastSync.at * 1000).toISOString()) : '—'} />
|
||||
<SettingRow label="Drift corrected" value={fmtDrift(lastSync.drift_ms) || '—'} mono />
|
||||
<SettingRow label="Servers answered" value={`${lastSync.servers_answered} / ${lastSync.servers_queried}`} />
|
||||
{lastSync.result !== 'applied' && lastSync.result !== 'in_sync' && (
|
||||
<p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)', marginTop: 'var(--space-2)' }}>
|
||||
{lastSync.message}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{ntp.pending_confirmation && (
|
||||
<p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-warning)', marginTop: 'var(--space-2)' }}>
|
||||
A large correction is waiting for a second sync to confirm it.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
@@ -717,7 +886,35 @@ export default function ClockTab({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SyncClockModal open={showSync} onClose={() => setShowSync(false)} device={device} />
|
||||
<SyncClockModal
|
||||
open={showSync}
|
||||
onClose={() => setShowSync(false)}
|
||||
face={live.face}
|
||||
sendMqttCommand={sendMqttCommand}
|
||||
onSaved={() => loadLive(['face'])}
|
||||
/>
|
||||
<EditTimezoneModal
|
||||
open={showTimezone}
|
||||
onClose={() => setShowTimezone(false)}
|
||||
current={tz}
|
||||
sendMqttCommand={sendMqttCommand}
|
||||
onSaved={(data) => { setLive(l => ({ ...l, tz: data || l.tz })); loadLive(['time', 'ntp']) }}
|
||||
/>
|
||||
<SetDeviceTimeModal
|
||||
open={showSetTime}
|
||||
onClose={() => setShowSetTime(false)}
|
||||
timezone={tz}
|
||||
ntp={ntp}
|
||||
sendMqttCommand={sendMqttCommand}
|
||||
onSaved={(data) => { if (data) setLive(l => ({ ...l, time: data, timeAt: Date.now() })); loadLive(['tz']) }}
|
||||
/>
|
||||
<NtpSettingsModal
|
||||
open={showNtp}
|
||||
onClose={() => setShowNtp(false)}
|
||||
ntp={ntp}
|
||||
sendMqttCommand={sendMqttCommand}
|
||||
onSaved={(data) => setLive(l => ({ ...l, ntp: data || l.ntp }))}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user