fix: omv invalid temperature when not available (#2322)
This commit is contained in:
1 parent
4f09363823
commit
5dc5d9e04a
4 files changed
+17
-5
No files matched your search
@@ -21,7 +21,7 @@ export interface HealthMonitoring {
|
||||
}[];
|
||||
smart: {
|
||||
deviceName: string;
|
||||
temperature: number;
|
||||
temperature: number | null;
|
||||
overallStatus: string;
|
||||
}[];
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export const smartSchema = z.object({
|
||||
// Convert string to number if necessary
|
||||
const temp = typeof val === "string" ? parseFloat(val) : val;
|
||||
if (isNaN(temp)) {
|
||||
throw new Error("Invalid temperature value");
|
||||
return null;
|
||||
}
|
||||
return temp;
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user