generated from CubeCraft-Creations/Tracehound
hub: emit battery_pct/video_remaining as null, not omitted
The SPA types these as number|null and null-checks them, but omitempty dropped the field entirely when uncalibrated → undefined in JS → "NaN%". Always serialize the field (null when unknown) so the card shows "N/A". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,11 @@ type StatusLog struct {
|
|||||||
type CameraStatus struct {
|
type CameraStatus struct {
|
||||||
CameraID string `json:"camera_id"`
|
CameraID string `json:"camera_id"`
|
||||||
FriendlyName string `json:"friendly_name"`
|
FriendlyName string `json:"friendly_name"`
|
||||||
BatteryPct *int `json:"battery_pct,omitempty"`
|
// Not omitempty: the SPA expects these as `number | null`. Omitting them
|
||||||
VideoRemainingSec *int `json:"video_remaining_sec,omitempty"`
|
// makes the field `undefined` in JS, which slips past null checks and
|
||||||
|
// renders as "NaN%".
|
||||||
|
BatteryPct *int `json:"battery_pct"`
|
||||||
|
VideoRemainingSec *int `json:"video_remaining_sec"`
|
||||||
Recording bool `json:"recording"`
|
Recording bool `json:"recording"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
Resolution string `json:"resolution"`
|
Resolution string `json:"resolution"`
|
||||||
|
|||||||
Reference in New Issue
Block a user