Use DeviceInfo in smappee ()

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/58596/head
epenet 2021-10-27 15:13:18 +02:00 committed by GitHub
parent e656974e8d
commit 8c1935ce0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 24 deletions
homeassistant/components/smappee

View File

@ -3,6 +3,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PRESENCE,
BinarySensorEntity,
)
from homeassistant.helpers.entity import DeviceInfo
from .const import DOMAIN
@ -71,15 +72,15 @@ class SmappeePresence(BinarySensorEntity):
)
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device info for this binary sensor."""
return {
"identifiers": {(DOMAIN, self._service_location.device_serial_number)},
"name": self._service_location.service_location_name,
"manufacturer": "Smappee",
"model": self._service_location.device_model,
"sw_version": self._service_location.firmware_version,
}
return DeviceInfo(
identifiers={(DOMAIN, self._service_location.device_serial_number)},
manufacturer="Smappee",
model=self._service_location.device_model,
name=self._service_location.service_location_name,
sw_version=self._service_location.firmware_version,
)
async def async_update(self):
"""Get the latest data from Smappee and update the state."""
@ -154,15 +155,15 @@ class SmappeeAppliance(BinarySensorEntity):
)
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device info for this binary sensor."""
return {
"identifiers": {(DOMAIN, self._service_location.device_serial_number)},
"name": self._service_location.service_location_name,
"manufacturer": "Smappee",
"model": self._service_location.device_model,
"sw_version": self._service_location.firmware_version,
}
return DeviceInfo(
identifiers={(DOMAIN, self._service_location.device_serial_number)},
manufacturer="Smappee",
model=self._service_location.device_model,
name=self._service_location.service_location_name,
sw_version=self._service_location.firmware_version,
)
async def async_update(self):
"""Get the latest data from Smappee and update the state."""

View File

@ -18,6 +18,7 @@ from homeassistant.const import (
ENERGY_WATT_HOUR,
POWER_WATT,
)
from homeassistant.helpers.entity import DeviceInfo
from .const import DOMAIN
@ -372,15 +373,15 @@ class SmappeeSensor(SensorEntity):
)
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device info for this sensor."""
return {
"identifiers": {(DOMAIN, self._service_location.device_serial_number)},
"name": self._service_location.service_location_name,
"manufacturer": "Smappee",
"model": self._service_location.device_model,
"sw_version": self._service_location.firmware_version,
}
return DeviceInfo(
identifiers={(DOMAIN, self._service_location.device_serial_number)},
manufacturer="Smappee",
model=self._service_location.device_model,
name=self._service_location.service_location_name,
sw_version=self._service_location.firmware_version,
)
async def async_update(self):
"""Get the latest data from Smappee and update the state."""