1 """Sensor checking adc and status values from your ROMY."""
6 SensorEntityDescription,
12 SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
21 from .const
import DOMAIN
22 from .coordinator
import RomyVacuumCoordinator
23 from .entity
import RomyEntity
25 SENSORS: list[SensorEntityDescription] = [
28 native_unit_of_measurement=PERCENTAGE,
29 device_class=SensorDeviceClass.BATTERY,
30 entity_category=EntityCategory.DIAGNOSTIC,
34 entity_registry_enabled_default=
False,
35 native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
36 device_class=SensorDeviceClass.SIGNAL_STRENGTH,
37 entity_category=EntityCategory.DIAGNOSTIC,
41 translation_key=
"dustbin_sensor",
42 entity_registry_enabled_default=
False,
43 state_class=SensorStateClass.MEASUREMENT,
44 entity_category=EntityCategory.DIAGNOSTIC,
47 key=
"total_cleaning_time",
48 translation_key=
"total_cleaning_time",
49 state_class=SensorStateClass.TOTAL,
50 native_unit_of_measurement=UnitOfTime.HOURS,
51 entity_category=EntityCategory.DIAGNOSTIC,
54 key=
"total_number_of_cleaning_runs",
55 translation_key=
"total_number_of_cleaning_runs",
56 state_class=SensorStateClass.TOTAL,
57 native_unit_of_measurement=
"runs",
58 entity_category=EntityCategory.DIAGNOSTIC,
61 key=
"total_area_cleaned",
62 translation_key=
"total_area_cleaned",
63 state_class=SensorStateClass.TOTAL,
64 native_unit_of_measurement=UnitOfArea.SQUARE_METERS,
65 entity_category=EntityCategory.DIAGNOSTIC,
68 key=
"total_distance_driven",
69 translation_key=
"total_distance_driven",
70 state_class=SensorStateClass.TOTAL,
71 native_unit_of_measurement=UnitOfLength.METERS,
72 entity_category=EntityCategory.DIAGNOSTIC,
79 config_entry: ConfigEntry,
80 async_add_entities: AddEntitiesCallback,
82 """Set up ROMY vacuum cleaner."""
84 coordinator: RomyVacuumCoordinator = hass.data[DOMAIN][config_entry.entry_id]
88 for entity_description
in SENSORS
89 if entity_description.key
in coordinator.romy.sensors
94 """RomySensor Class."""
96 entity_description: SensorEntityDescription
100 coordinator: RomyVacuumCoordinator,
101 entity_description: SensorEntityDescription,
103 """Initialize ROMYs StatusSensor."""
105 self.
_attr_unique_id_attr_unique_id = f
"{entity_description.key}_{self.romy.unique_id}"
110 """Return the value of the sensor."""
None __init__(self, RomyVacuumCoordinator coordinator, SensorEntityDescription entity_description)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)