mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Use shorthand attributes in Rainforest eagle (#99825)
This commit is contained in:
parent
02e077daab
commit
66d16108be
@ -75,11 +75,13 @@ class EagleSensor(CoordinatorEntity[EagleDataCoordinator], SensorEntity):
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(coordinator)
|
||||
self.entity_description = entity_description
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str | None:
|
||||
"""Return unique ID of entity."""
|
||||
return f"{self.coordinator.cloud_id}-${self.coordinator.hardware_address}-{self.entity_description.key}"
|
||||
self._attr_unique_id = f"{coordinator.cloud_id}-${coordinator.hardware_address}-{entity_description.key}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, coordinator.cloud_id)},
|
||||
manufacturer="Rainforest Automation",
|
||||
model=coordinator.model,
|
||||
name=coordinator.model,
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
@ -90,13 +92,3 @@ class EagleSensor(CoordinatorEntity[EagleDataCoordinator], SensorEntity):
|
||||
def native_value(self) -> StateType:
|
||||
"""Return native value of the sensor."""
|
||||
return self.coordinator.data.get(self.entity_description.key)
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device info."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self.coordinator.cloud_id)},
|
||||
manufacturer="Rainforest Automation",
|
||||
model=self.coordinator.model,
|
||||
name=self.coordinator.model,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user