Use shorthand attributes in Ondilo ico (#99627)
This commit is contained in:
parent
3c82045289
commit
c6bdc380b6
1 changed files with 7 additions and 13 deletions
|
@ -153,7 +153,13 @@ class OndiloICO(
|
|||
|
||||
pooldata = self._pooldata()
|
||||
self._attr_unique_id = f"{pooldata['ICO']['serial_number']}-{description.key}"
|
||||
self._device_name = pooldata["name"]
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, pooldata["ICO"]["serial_number"])},
|
||||
manufacturer="Ondilo",
|
||||
model="ICO",
|
||||
name=pooldata["name"],
|
||||
sw_version=pooldata["ICO"]["sw_version"],
|
||||
)
|
||||
|
||||
def _pooldata(self):
|
||||
"""Get pool data dict."""
|
||||
|
@ -177,15 +183,3 @@ class OndiloICO(
|
|||
def native_value(self):
|
||||
"""Last value of the sensor."""
|
||||
return self._devdata()["value"]
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info for the sensor."""
|
||||
pooldata = self._pooldata()
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, pooldata["ICO"]["serial_number"])},
|
||||
manufacturer="Ondilo",
|
||||
model="ICO",
|
||||
name=self._device_name,
|
||||
sw_version=pooldata["ICO"]["sw_version"],
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue