@@ -246,11 +246,20 @@ class Host6(AirOSDataClass):
246246 totalram : int
247247 freeram : int
248248 cpuload : float | int | None
249+ cputotal : float | int | None # Reported on XM firmware
250+ cpubusy : float | int | None # Reported on XM firmware
249251
250252 @classmethod
251253 def __pre_deserialize__ (cls , d : dict [str , Any ]) -> dict [str , Any ]:
252254 """Pre-deserialize hook for Host."""
253255 _check_and_log_unknown_enum_value (d , "netrole" , NetRole , "Host" , "netrole" )
256+
257+ # Calculate cpufloat from actuals instead on relying on near 100% value
258+ if (
259+ all (isinstance (d .get (k ), (int , float )) for k in ("cpubusy" , "cputotal" ))
260+ and d ["cputotal" ] > 0
261+ ):
262+ d ["cpuload" ] = round ((d ["cpubusy" ] / d ["cputotal" ]) * 100 , 2 )
254263 return d
255264
256265
@@ -562,7 +571,7 @@ class Wireless6(AirOSDataClass):
562571 apmac : str
563572 countrycode : int
564573 channel : int
565- frequency : str
574+ frequency : int
566575 dfs : int
567576 opmode : str
568577 antenna : str
@@ -593,6 +602,11 @@ def __pre_deserialize__(cls, d: dict[str, Any]) -> dict[str, Any]:
593602 _check_and_log_unknown_enum_value (
594603 d , "security" , Security , "Wireless" , "security"
595604 )
605+
606+ freq = d .get ("frequency" )
607+ if isinstance (freq , str ) and "MHz" in freq :
608+ d ["frequency" ] = int (freq .split ()[0 ])
609+
596610 return d
597611
598612
0 commit comments