13
13
SensorStateClass ,
14
14
)
15
15
from homeassistant .const import (
16
- ATTR_NAME ,
17
16
PERCENTAGE ,
18
17
EntityCategory ,
19
18
UnitOfDataRate ,
@@ -375,17 +374,6 @@ def native_value(self):
375
374
376
375
return None
377
376
378
- # Deprecated since Home Assistant 2024.6.0
379
- # Can be removed completely in 2024.12.0
380
- @property
381
- def extra_state_attributes (self ) -> dict [str , Any ] | None :
382
- """Return the state attributes."""
383
- if self .coordinator .data :
384
- data = self .coordinator .data ["system_stats" ]["memory" ]
385
- size = round (float (data ["total" ]) / 1024 , 2 )
386
- return {ATTR_MEMORY_SIZE : f"{ size } { UnitOfInformation .GIBIBYTES } " }
387
- return None
388
-
389
377
390
378
class QNAPNetworkSensor (QNAPSensor ):
391
379
"""A QNAP sensor that monitors network stats."""
@@ -414,22 +402,6 @@ def native_value(self):
414
402
415
403
return None
416
404
417
- # Deprecated since Home Assistant 2024.6.0
418
- # Can be removed completely in 2024.12.0
419
- @property
420
- def extra_state_attributes (self ) -> dict [str , Any ] | None :
421
- """Return the state attributes."""
422
- if self .coordinator .data :
423
- data = self .coordinator .data ["system_stats" ]["nics" ][self .monitor_device ]
424
- return {
425
- ATTR_IP : data ["ip" ],
426
- ATTR_MASK : data ["mask" ],
427
- ATTR_MAC : data ["mac" ],
428
- ATTR_MAX_SPEED : data ["max_speed" ],
429
- ATTR_PACKETS_ERR : data ["err_packets" ],
430
- }
431
- return None
432
-
433
405
434
406
class QNAPSystemSensor (QNAPSensor ):
435
407
"""A QNAP sensor that monitors overall system health."""
@@ -455,25 +427,6 @@ def native_value(self):
455
427
456
428
return None
457
429
458
- # Deprecated since Home Assistant 2024.6.0
459
- # Can be removed completely in 2024.12.0
460
- @property
461
- def extra_state_attributes (self ) -> dict [str , Any ] | None :
462
- """Return the state attributes."""
463
- if self .coordinator .data :
464
- data = self .coordinator .data ["system_stats" ]
465
- days = int (data ["uptime" ]["days" ])
466
- hours = int (data ["uptime" ]["hours" ])
467
- minutes = int (data ["uptime" ]["minutes" ])
468
-
469
- return {
470
- ATTR_NAME : data ["system" ]["name" ],
471
- ATTR_MODEL : data ["system" ]["model" ],
472
- ATTR_SERIAL : data ["system" ]["serial_number" ],
473
- ATTR_UPTIME : f"{ days :0>2d} d { hours :0>2d} h { minutes :0>2d} m" ,
474
- }
475
- return None
476
-
477
430
478
431
class QNAPDriveSensor (QNAPSensor ):
479
432
"""A QNAP sensor that monitors HDD/SSD drive stats."""
@@ -533,17 +486,3 @@ def native_value(self):
533
486
return used_gb / total_gb * 100
534
487
535
488
return None
536
-
537
- # Deprecated since Home Assistant 2024.6.0
538
- # Can be removed completely in 2024.12.0
539
- @property
540
- def extra_state_attributes (self ) -> dict [str , Any ] | None :
541
- """Return the state attributes."""
542
- if self .coordinator .data :
543
- data = self .coordinator .data ["volumes" ][self .monitor_device ]
544
- total_gb = int (data ["total_size" ]) / 1024 / 1024 / 1024
545
-
546
- return {
547
- ATTR_VOLUME_SIZE : f"{ round (total_gb , 1 )} { UnitOfInformation .GIBIBYTES } "
548
- }
549
- return None
0 commit comments