mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self.entity_description = entity_description
|
self.entity_description = entity_description
|
||||||
|
self._attr_unique_id = f"{coordinator.cloud_id}-${coordinator.hardware_address}-{entity_description.key}"
|
||||||
@property
|
self._attr_device_info = DeviceInfo(
|
||||||
def unique_id(self) -> str | None:
|
identifiers={(DOMAIN, coordinator.cloud_id)},
|
||||||
"""Return unique ID of entity."""
|
manufacturer="Rainforest Automation",
|
||||||
return f"{self.coordinator.cloud_id}-${self.coordinator.hardware_address}-{self.entity_description.key}"
|
model=coordinator.model,
|
||||||
|
name=coordinator.model,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
@ -90,13 +92,3 @@ class EagleSensor(CoordinatorEntity[EagleDataCoordinator], SensorEntity):
|
|||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return native value of the sensor."""
|
"""Return native value of the sensor."""
|
||||||
return self.coordinator.data.get(self.entity_description.key)
|
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