1919from homeassistant .const import PERCENTAGE , EntityCategory
2020from homeassistant .core import HomeAssistant , callback
2121from homeassistant .helpers import entity_registry as er
22- from homeassistant .helpers .device_registry import CONNECTION_NETWORK_MAC , DeviceInfo
2322from homeassistant .helpers .entity_platform import AddConfigEntryEntitiesCallback
2423from homeassistant .helpers .typing import StateType
25- from homeassistant .helpers .update_coordinator import CoordinatorEntity
2624
2725from .const import DOMAIN
2826from .coordinator import BrotherConfigEntry , BrotherDataUpdateCoordinator
27+ from .entity import BrotherPrinterEntity
2928
3029# Coordinator is used to centralize the data updates
3130PARALLEL_UPDATES = 0
@@ -333,12 +332,9 @@ async def async_setup_entry(
333332 )
334333
335334
336- class BrotherPrinterSensor (
337- CoordinatorEntity [BrotherDataUpdateCoordinator ], SensorEntity
338- ):
339- """Define an Brother Printer sensor."""
335+ class BrotherPrinterSensor (BrotherPrinterEntity , SensorEntity ):
336+ """Define a Brother Printer sensor."""
340337
341- _attr_has_entity_name = True
342338 entity_description : BrotherSensorEntityDescription
343339
344340 def __init__ (
@@ -348,16 +344,7 @@ def __init__(
348344 ) -> None :
349345 """Initialize."""
350346 super ().__init__ (coordinator )
351- self ._attr_device_info = DeviceInfo (
352- configuration_url = f"http://{ coordinator .brother .host } /" ,
353- identifiers = {(DOMAIN , coordinator .brother .serial )},
354- connections = {(CONNECTION_NETWORK_MAC , coordinator .brother .mac )},
355- serial_number = coordinator .brother .serial ,
356- manufacturer = "Brother" ,
357- model = coordinator .brother .model ,
358- name = coordinator .brother .model ,
359- sw_version = coordinator .brother .firmware ,
360- )
347+
361348 self ._attr_native_value = description .value (coordinator .data )
362349 self ._attr_unique_id = f"{ coordinator .brother .serial .lower ()} _{ description .key } "
363350 self .entity_description = description
0 commit comments