diff --git a/custom_components/integration_blueprint/binary_sensor.py b/custom_components/integration_blueprint/binary_sensor.py index a3afa01..c765d65 100644 --- a/custom_components/integration_blueprint/binary_sensor.py +++ b/custom_components/integration_blueprint/binary_sensor.py @@ -44,6 +44,6 @@ def __init__( self.entity_description = entity_description @property - def is_on(self): + def is_on(self) -> bool: """Return true if the binary_sensor is on.""" return self.coordinator.data.get("title", "") == "foo" diff --git a/custom_components/integration_blueprint/entity.py b/custom_components/integration_blueprint/entity.py index 06578ca..94bbc1e 100644 --- a/custom_components/integration_blueprint/entity.py +++ b/custom_components/integration_blueprint/entity.py @@ -1,6 +1,7 @@ """BlueprintEntity class""" from __future__ import annotations +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import ATTRIBUTION, DOMAIN, NAME, VERSION @@ -16,9 +17,9 @@ def __init__(self, coordinator: BlueprintDataUpdateCoordinator) -> None: """Initialize.""" super().__init__(coordinator) self._attr_unique_id = coordinator.config_entry.entry_id - self._attr_device_info = { - "identifiers": {(DOMAIN, self.unique_id)}, - "name": NAME, - "model": VERSION, - "manufacturer": NAME, - } + self._attr_device_info = DeviceInfo( + identifiers={(DOMAIN, self.unique_id)}, + name=NAME, + model=VERSION, + manufacturer=NAME, + ) diff --git a/custom_components/integration_blueprint/sensor.py b/custom_components/integration_blueprint/sensor.py index 970f3a8..8eb2ef6 100644 --- a/custom_components/integration_blueprint/sensor.py +++ b/custom_components/integration_blueprint/sensor.py @@ -40,6 +40,6 @@ def __init__( self.entity_description = entity_description @property - def native_value(self): + def native_value(self) -> str: """Return the native value of the sensor.""" return self.coordinator.data.get("body") diff --git a/custom_components/integration_blueprint/switch.py b/custom_components/integration_blueprint/switch.py index c853af7..286ea9b 100644 --- a/custom_components/integration_blueprint/switch.py +++ b/custom_components/integration_blueprint/switch.py @@ -40,16 +40,16 @@ def __init__( self.entity_description = entity_description @property - def is_on(self): + def is_on(self) -> bool: """Return true if the switch is on.""" return self.coordinator.data.get("title", "") == "foo" - async def async_turn_on(self, **kwargs: any): # pylint: disable=unused-argument + async def async_turn_on(self, **_: any) -> None: """Turn on the switch.""" await self.coordinator.api.async_set_title("bar") await self.coordinator.async_request_refresh() - async def async_turn_off(self, **kwargs: any): # pylint: disable=unused-argument + async def async_turn_off(self, **_: any) -> None: """Turn off the switch.""" await self.coordinator.api.async_set_title("foo") await self.coordinator.async_request_refresh()