File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
custom_components/zte_router Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 9
9
"iot_class" : " local_polling" ,
10
10
"issue_tracker" : " https://github.com/Kajkac/ZTE-MC-Home-assistant-repo/issues" ,
11
11
"requirements" : [" aiohttp" ],
12
- "version" : " 1.0.31 "
12
+ "version" : " 1.0.32 "
13
13
}
Original file line number Diff line number Diff line change @@ -303,12 +303,29 @@ async def async_handle_coordinator_update(self):
303
303
if self .coordinator .data :
304
304
new_state = self .coordinator .data .get (self ._key , None )
305
305
if new_state is not None :
306
+ if "pci" in self ._key .lower ():
307
+ try :
308
+ if isinstance (new_state , str ):
309
+ new_state = int (new_state , 16 )
310
+ _LOGGER .debug (
311
+ f"Converted hex PCI value to decimal for key '{ self ._key } ': { new_state } "
312
+ )
313
+ except (ValueError , TypeError ):
314
+ _LOGGER .warning (
315
+ f"Failed to convert value for key '{ self ._key } ' (expected hex string): { new_state } "
316
+ )
306
317
self ._state = new_state
307
- _LOGGER .info (f"Sensor { self ._name } updated. Old state: { old_state } , New state: { self ._state } " )
318
+ _LOGGER .info (
319
+ f"Sensor '{ self ._name } ' updated. Old state: { old_state } , New state: { self ._state } "
320
+ )
308
321
else :
309
- _LOGGER .warning (f"No new data for sensor { self ._name } . Retaining last state: { self ._state } " )
322
+ _LOGGER .debug (
323
+ f"No value found for key '{ self ._key } ' in coordinator data."
324
+ )
310
325
else :
311
- _LOGGER .warning (f"No data available from coordinator for sensor { self ._name } . Retaining last state: { self ._state } " )
326
+ _LOGGER .warning (
327
+ f"No coordinator data available for sensor '{ self ._name } '. Retaining last state."
328
+ )
312
329
self .async_write_ha_state ()
313
330
314
331
class LastSMSSensor (ZTERouterEntity ):
You can’t perform that action at this time.
0 commit comments