Add init return type to integrations (#87523)

Add type hints to integrations
This commit is contained in:
epenet 2023-02-06 11:37:25 +01:00 committed by GitHub
parent ade0d6fcae
commit bb3e0633a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 118 additions and 84 deletions

View file

@ -262,7 +262,7 @@ class AbstractAemetSensor(CoordinatorEntity[WeatherUpdateCoordinator], SensorEnt
unique_id, unique_id,
coordinator: WeatherUpdateCoordinator, coordinator: WeatherUpdateCoordinator,
description: SensorEntityDescription, description: SensorEntityDescription,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self.entity_description = description self.entity_description = description
@ -279,7 +279,7 @@ class AemetSensor(AbstractAemetSensor):
unique_id_prefix, unique_id_prefix,
weather_coordinator: WeatherUpdateCoordinator, weather_coordinator: WeatherUpdateCoordinator,
description: SensorEntityDescription, description: SensorEntityDescription,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__( super().__init__(
name=name, name=name,
@ -304,7 +304,7 @@ class AemetForecastSensor(AbstractAemetSensor):
weather_coordinator: WeatherUpdateCoordinator, weather_coordinator: WeatherUpdateCoordinator,
forecast_mode, forecast_mode,
description: SensorEntityDescription, description: SensorEntityDescription,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__( super().__init__(
name=name, name=name,

View file

@ -102,7 +102,7 @@ class AemetWeather(CoordinatorEntity[WeatherUpdateCoordinator], WeatherEntity):
unique_id, unique_id,
coordinator: WeatherUpdateCoordinator, coordinator: WeatherUpdateCoordinator,
forecast_mode, forecast_mode,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self._forecast_mode = forecast_mode self._forecast_mode = forecast_mode

View file

@ -195,7 +195,9 @@ class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorEntity):
_attr_device_class = BinarySensorDeviceClass.DOOR _attr_device_class = BinarySensorDeviceClass.DOOR
def __init__(self, data, device, description: BinarySensorEntityDescription): def __init__(
self, data, device, description: BinarySensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(data, device) super().__init__(data, device)
self.entity_description = description self.entity_description = description
@ -235,7 +237,9 @@ class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorEntity):
entity_description: AugustBinarySensorEntityDescription entity_description: AugustBinarySensorEntityDescription
def __init__(self, data, device, description: AugustBinarySensorEntityDescription): def __init__(
self, data, device, description: AugustBinarySensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(data, device) super().__init__(data, device)
self.entity_description = description self.entity_description = description

View file

@ -268,7 +268,7 @@ class AugustBatterySensor(AugustEntityMixin, SensorEntity, Generic[_T]):
device, device,
old_device, old_device,
description: AugustSensorEntityDescription[_T], description: AugustSensorEntityDescription[_T],
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(data, device) super().__init__(data, device)
self.entity_description = description self.entity_description = description

View file

@ -130,7 +130,7 @@ class BboxUptimeSensor(SensorEntity):
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
_attr_device_class = SensorDeviceClass.TIMESTAMP _attr_device_class = SensorDeviceClass.TIMESTAMP
def __init__(self, bbox_data, name, description: SensorEntityDescription): def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = f"{name} {description.name}" self._attr_name = f"{name} {description.name}"
@ -149,7 +149,7 @@ class BboxSensor(SensorEntity):
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
def __init__(self, bbox_data, name, description: SensorEntityDescription): def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = f"{name} {description.name}" self._attr_name = f"{name} {description.name}"

View file

@ -55,7 +55,9 @@ async def async_setup_entry(
class BlinkBinarySensor(BinarySensorEntity): class BlinkBinarySensor(BinarySensorEntity):
"""Representation of a Blink binary sensor.""" """Representation of a Blink binary sensor."""
def __init__(self, data, camera, description: BinarySensorEntityDescription): def __init__(
self, data, camera, description: BinarySensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.data = data self.data = data
self.entity_description = description self.entity_description = description

View file

@ -53,7 +53,7 @@ async def async_setup_entry(
class BlinkSensor(SensorEntity): class BlinkSensor(SensorEntity):
"""A Blink camera sensor.""" """A Blink camera sensor."""
def __init__(self, data, camera, description: SensorEntityDescription): def __init__(self, data, camera, description: SensorEntityDescription) -> None:
"""Initialize sensors from Blink camera.""" """Initialize sensors from Blink camera."""
self.entity_description = description self.entity_description = description
self._attr_name = f"{DOMAIN} {camera} {description.name}" self._attr_name = f"{DOMAIN} {camera} {description.name}"

View file

@ -114,7 +114,7 @@ class BroadlinkSensor(BroadlinkEntity, SensorEntity):
_attr_has_entity_name = True _attr_has_entity_name = True
def __init__(self, device, description: SensorEntityDescription): def __init__(self, device, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(device) super().__init__(device)
self.entity_description = description self.entity_description = description

View file

@ -692,7 +692,9 @@ class BrSensor(SensorEntity):
_attr_entity_registry_enabled_default = False _attr_entity_registry_enabled_default = False
_attr_should_poll = False _attr_should_poll = False
def __init__(self, client_name, coordinates, description: SensorEntityDescription): def __init__(
self, client_name, coordinates, description: SensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = f"{client_name} {description.name}" self._attr_name = f"{client_name} {description.name}"

View file

@ -91,7 +91,9 @@ class ComedHourlyPricingSensor(SensorEntity):
_attr_attribution = "Data provided by ComEd Hourly Pricing service" _attr_attribution = "Data provided by ComEd Hourly Pricing service"
def __init__(self, websession, offset, name, description: SensorEntityDescription): def __init__(
self, websession, offset, name, description: SensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.websession = websession self.websession = websession

View file

@ -59,7 +59,7 @@ class DaikinZoneSwitch(SwitchEntity):
_attr_icon = ZONE_ICON _attr_icon = ZONE_ICON
_attr_has_entity_name = True _attr_has_entity_name = True
def __init__(self, daikin_api: DaikinApi, zone_id): def __init__(self, daikin_api: DaikinApi, zone_id) -> None:
"""Initialize the zone.""" """Initialize the zone."""
self._api = daikin_api self._api = daikin_api
self._zone_id = zone_id self._zone_id = zone_id

View file

@ -651,7 +651,7 @@ class DarkSkySensor(SensorEntity):
name, name,
forecast_day=None, forecast_day=None,
forecast_hour=None, forecast_hour=None,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.forecast_data = forecast_data self.forecast_data = forecast_data
@ -794,7 +794,7 @@ class DarkSkyAlertSensor(SensorEntity):
def __init__( def __init__(
self, forecast_data, description: DarkskySensorEntityDescription, name self, forecast_data, description: DarkskySensorEntityDescription, name
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.forecast_data = forecast_data self.forecast_data = forecast_data

View file

@ -106,7 +106,9 @@ class DiscogsSensor(SensorEntity):
_attr_attribution = "Data provided by Discogs" _attr_attribution = "Data provided by Discogs"
def __init__(self, discogs_data, name, description: SensorEntityDescription): def __init__(
self, discogs_data, name, description: SensorEntityDescription
) -> None:
"""Initialize the Discogs sensor.""" """Initialize the Discogs sensor."""
self.entity_description = description self.entity_description = description
self._discogs_data = discogs_data self._discogs_data = discogs_data

View file

@ -110,7 +110,7 @@ class DovadoSensor(SensorEntity):
entity_description: DovadoSensorEntityDescription entity_description: DovadoSensorEntityDescription
def __init__(self, data, description: DovadoSensorEntityDescription): def __init__(self, data, description: DovadoSensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._data = data self._data = data

View file

@ -113,7 +113,7 @@ class DwdWeatherWarningsSensor(SensorEntity):
api, api,
name, name,
description: SensorEntityDescription, description: SensorEntityDescription,
): ) -> None:
"""Initialize a DWD-Weather-Warnings sensor.""" """Initialize a DWD-Weather-Warnings sensor."""
self._api = api self._api = api
self.entity_description = description self.entity_description = description

View file

@ -188,7 +188,7 @@ class EBoxSensor(SensorEntity):
ebox_data, ebox_data,
description: SensorEntityDescription, description: SensorEntityDescription,
name, name,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = f"{name} {description.name}" self._attr_name = f"{name} {description.name}"

View file

@ -112,7 +112,7 @@ class EcobeeSensor(SensorEntity):
sensor_name, sensor_name,
sensor_index, sensor_index,
description: EcobeeSensorEntityDescription, description: EcobeeSensorEntityDescription,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.data = data self.data = data

View file

@ -60,7 +60,9 @@ async def async_setup_entry(
class EcoNetBinarySensor(EcoNetEntity, BinarySensorEntity): class EcoNetBinarySensor(EcoNetEntity, BinarySensorEntity):
"""Define a Econet binary sensor.""" """Define a Econet binary sensor."""
def __init__(self, econet_device, description: BinarySensorEntityDescription): def __init__(
self, econet_device, description: BinarySensorEntityDescription
) -> None:
"""Initialize.""" """Initialize."""
super().__init__(econet_device) super().__init__(econet_device)
self.entity_description = description self.entity_description = description

View file

@ -154,7 +154,9 @@ def setup_platform(
class EnOceanSensor(EnOceanEntity, RestoreEntity, SensorEntity): class EnOceanSensor(EnOceanEntity, RestoreEntity, SensorEntity):
"""Representation of an EnOcean sensor device such as a power meter.""" """Representation of an EnOcean sensor device such as a power meter."""
def __init__(self, dev_id, dev_name, description: EnOceanSensorEntityDescription): def __init__(
self, dev_id, dev_name, description: EnOceanSensorEntityDescription
) -> None:
"""Initialize the EnOcean sensor device.""" """Initialize the EnOcean sensor device."""
super().__init__(dev_id, dev_name) super().__init__(dev_id, dev_name)
self.entity_description = description self.entity_description = description
@ -223,7 +225,7 @@ class EnOceanTemperatureSensor(EnOceanSensor):
scale_max, scale_max,
range_from, range_from,
range_to, range_to,
): ) -> None:
"""Initialize the EnOcean temperature sensor device.""" """Initialize the EnOcean temperature sensor device."""
super().__init__(dev_id, dev_name, description) super().__init__(dev_id, dev_name, description)
self._scale_min = scale_min self._scale_min = scale_min

View file

@ -34,7 +34,7 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity):
def __init__( def __init__(
self, coordinator, entry_id, description: BinarySensorEntityDescription self, coordinator, entry_id, description: BinarySensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self.entity_description = description self.entity_description = description

View file

@ -214,7 +214,9 @@ async def async_setup_platform(
class FidoSensor(SensorEntity): class FidoSensor(SensorEntity):
"""Implementation of a Fido sensor.""" """Implementation of a Fido sensor."""
def __init__(self, fido_data, name, number, description: SensorEntityDescription): def __init__(
self, fido_data, name, number, description: SensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.fido_data = fido_data self.fido_data = fido_data

View file

@ -53,7 +53,7 @@ def setup_scanner(
class FleetGoDeviceScanner: class FleetGoDeviceScanner:
"""Define a scanner for the FleetGO platform.""" """Define a scanner for the FleetGO platform."""
def __init__(self, config, see: SeeCallback): def __init__(self, config, see: SeeCallback) -> None:
"""Initialize FleetGoDeviceScanner.""" """Initialize FleetGoDeviceScanner."""
self._include = config.get(CONF_INCLUDE) self._include = config.get(CONF_INCLUDE)
self._see = see self._see = see

View file

@ -142,7 +142,7 @@ class GrowattInverter(SensorEntity):
def __init__( def __init__(
self, probe, name, unique_id, description: GrowattSensorEntityDescription self, probe, name, unique_id, description: GrowattSensorEntityDescription
): ) -> None:
"""Initialize a PVOutput sensor.""" """Initialize a PVOutput sensor."""
self.probe = probe self.probe = probe
self.entity_description = description self.entity_description = description

View file

@ -392,7 +392,7 @@ class SourceManager:
*, *,
retry_delay: int = COMMAND_RETRY_DELAY, retry_delay: int = COMMAND_RETRY_DELAY,
max_retry_attempts: int = COMMAND_RETRY_ATTEMPTS, max_retry_attempts: int = COMMAND_RETRY_ATTEMPTS,
): ) -> None:
"""Init input manager.""" """Init input manager."""
self.retry_delay = retry_delay self.retry_delay = retry_delay
self.max_retry_attempts = max_retry_attempts self.max_retry_attempts = max_retry_attempts

View file

@ -89,7 +89,7 @@ class HydrawiseEntity(Entity):
_attr_attribution = "Data provided by hydrawise.com" _attr_attribution = "Data provided by hydrawise.com"
def __init__(self, data, description: EntityDescription): def __init__(self, data, description: EntityDescription) -> None:
"""Initialize the Hydrawise entity.""" """Initialize the Hydrawise entity."""
self.entity_description = description self.entity_description = description
self.data = data self.data = data

View file

@ -81,7 +81,7 @@ class HydrawiseSwitch(HydrawiseEntity, SwitchEntity):
def __init__( def __init__(
self, data, description: SwitchEntityDescription, default_watering_timer self, data, description: SwitchEntityDescription, default_watering_timer
): ) -> None:
"""Initialize a switch for Hydrawise device.""" """Initialize a switch for Hydrawise device."""
super().__init__(data, description) super().__init__(data, description)
self._default_watering_timer = default_watering_timer self._default_watering_timer = default_watering_timer

View file

@ -60,7 +60,9 @@ class IOSSensor(SensorEntity):
_attr_should_poll = False _attr_should_poll = False
def __init__(self, device_name, device, description: SensorEntityDescription): def __init__(
self, device_name, device, description: SensorEntityDescription
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._device = device self._device = device

View file

@ -41,7 +41,7 @@ class Iperf3Sensor(RestoreEntity, SensorEntity):
_attr_attribution = "Data retrieved using Iperf3" _attr_attribution = "Data retrieved using Iperf3"
_attr_should_poll = False _attr_should_poll = False
def __init__(self, iperf3_data, description: SensorEntityDescription): def __init__(self, iperf3_data, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._iperf3_data = iperf3_data self._iperf3_data = iperf3_data

View file

@ -121,7 +121,7 @@ class IPMAWeather(WeatherEntity):
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
def __init__(self, location: Location, api: IPMA_API, config): def __init__(self, location: Location, api: IPMA_API, config) -> None:
"""Initialise the platform with a data instance and station name.""" """Initialise the platform with a data instance and station name."""
self._api = api self._api = api
self._location_name = config.get(CONF_NAME, location.name) self._location_name = config.get(CONF_NAME, location.name)

View file

@ -91,7 +91,9 @@ async def async_setup_entry(
class JuiceNetSensorDevice(JuiceNetDevice, SensorEntity): class JuiceNetSensorDevice(JuiceNetDevice, SensorEntity):
"""Implementation of a JuiceNet sensor.""" """Implementation of a JuiceNet sensor."""
def __init__(self, device, coordinator, description: SensorEntityDescription): def __init__(
self, device, coordinator, description: SensorEntityDescription
) -> None:
"""Initialise the sensor.""" """Initialise the sensor."""
super().__init__(device, description.key, coordinator) super().__init__(device, description.key, coordinator)
self.entity_description = description self.entity_description = description

View file

@ -71,7 +71,7 @@ class KaiterraSensor(SensorEntity):
def __init__( def __init__(
self, api, name, device_id, description: KaiterraSensorEntityDescription self, api, name, device_id, description: KaiterraSensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self._api = api self._api = api
self._device_id = device_id self._device_id = device_id

View file

@ -102,7 +102,7 @@ class KonnectedSensor(SensorEntity):
description: SensorEntityDescription, description: SensorEntityDescription,
addr=None, addr=None,
initial_state=None, initial_state=None,
): ) -> None:
"""Initialize the entity for a single sensor_type.""" """Initialize the entity for a single sensor_type."""
self.entity_description = description self.entity_description = description
self._addr = addr self._addr = addr

View file

@ -37,7 +37,9 @@ async def async_setup_entry(
class LiteJetScene(Scene): class LiteJetScene(Scene):
"""Representation of a single LiteJet scene.""" """Representation of a single LiteJet scene."""
def __init__(self, entry_id, lj: LiteJet, i, name): # pylint: disable=invalid-name def __init__(
self, entry_id, lj: LiteJet, i, name # pylint: disable=invalid-name
) -> None:
"""Initialize the scene.""" """Initialize the scene."""
self._lj = lj self._lj = lj
self._index = i self._index = i

View file

@ -59,7 +59,7 @@ class LogiSensor(SensorEntity):
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
def __init__(self, camera, time_zone, description: SensorEntityDescription): def __init__(self, camera, time_zone, description: SensorEntityDescription) -> None:
"""Initialize a sensor for Logi Circle camera.""" """Initialize a sensor for Logi Circle camera."""
self.entity_description = description self.entity_description = description
self._camera = camera self._camera = camera

View file

@ -146,7 +146,7 @@ class MagicSeaweedSensor(SensorEntity):
unit_system, unit_system,
description: SensorEntityDescription, description: SensorEntityDescription,
hour=None, hour=None,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.client_name = name self.client_name = name

View file

@ -37,7 +37,7 @@ async def async_setup_entry(
class NightscoutSensor(SensorEntity): class NightscoutSensor(SensorEntity):
"""Implementation of a Nightscout sensor.""" """Implementation of a Nightscout sensor."""
def __init__(self, api: NightscoutAPI, name, unique_id): def __init__(self, api: NightscoutAPI, name, unique_id) -> None:
"""Initialize the Nightscout sensor.""" """Initialize the Nightscout sensor."""
self.api = api self.api = api
self._attr_unique_id = unique_id self._attr_unique_id = unique_id

View file

@ -85,7 +85,7 @@ class NoboZone(ClimateEntity):
_attr_target_temperature_step = 1 _attr_target_temperature_step = 1
# Need to poll to get preset change when in HVACMode.AUTO, so can't set _attr_should_poll = False # Need to poll to get preset change when in HVACMode.AUTO, so can't set _attr_should_poll = False
def __init__(self, zone_id, hub: nobo, override_type): def __init__(self, zone_id, hub: nobo, override_type) -> None:
"""Initialize the climate device.""" """Initialize the climate device."""
self._id = zone_id self._id = zone_id
self._nobo = hub self._nobo = hub

View file

@ -38,7 +38,7 @@ def setup_platform(
class OmbiSensor(SensorEntity): class OmbiSensor(SensorEntity):
"""Representation of an Ombi sensor.""" """Representation of an Ombi sensor."""
def __init__(self, ombi, description: SensorEntityDescription): def __init__(self, ombi, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._ombi = ombi self._ombi = ombi

View file

@ -55,7 +55,9 @@ class ONVIFSensor(ONVIFBaseEntity, RestoreSensor):
_attr_should_poll = False _attr_should_poll = False
def __init__(self, uid, device: ONVIFDevice, entry: er.RegistryEntry | None = None): def __init__(
self, uid, device: ONVIFDevice, entry: er.RegistryEntry | None = None
) -> None:
"""Initialize the ONVIF binary sensor.""" """Initialize the ONVIF binary sensor."""
self._attr_unique_id = uid self._attr_unique_id = uid
if entry is not None: if entry is not None:

View file

@ -113,7 +113,7 @@ def setup_platform(
class OpenEVSESensor(SensorEntity): class OpenEVSESensor(SensorEntity):
"""Implementation of an OpenEVSE sensor.""" """Implementation of an OpenEVSE sensor."""
def __init__(self, charger, description: SensorEntityDescription): def __init__(self, charger, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.charger = charger self.charger = charger

View file

@ -89,7 +89,7 @@ class MinutPointSensor(MinutPointEntity, SensorEntity):
def __init__( def __init__(
self, point_client, device_id, description: MinutPointSensorEntityDescription self, point_client, device_id, description: MinutPointSensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(point_client, device_id, description.device_class) super().__init__(point_client, device_id, description.device_class)
self.entity_description = description self.entity_description = description

View file

@ -64,7 +64,7 @@ class PoolSenseEntity(CoordinatorEntity):
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
def __init__(self, coordinator, email, description: EntityDescription): def __init__(self, coordinator, email, description: EntityDescription) -> None:
"""Initialize poolsense sensor.""" """Initialize poolsense sensor."""
super().__init__(coordinator) super().__init__(coordinator)
self.entity_description = description self.entity_description = description

View file

@ -59,7 +59,7 @@ async def async_setup_entry(
class ProgettihwswBinarySensor(CoordinatorEntity, BinarySensorEntity): class ProgettihwswBinarySensor(CoordinatorEntity, BinarySensorEntity):
"""Represent a binary sensor.""" """Represent a binary sensor."""
def __init__(self, coordinator, name, sensor: Input): def __init__(self, coordinator, name, sensor: Input) -> None:
"""Set initializing values.""" """Set initializing values."""
super().__init__(coordinator) super().__init__(coordinator)
self._name = name self._name = name

View file

@ -60,7 +60,7 @@ async def async_setup_entry(
class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity): class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
"""Represent a switch entity.""" """Represent a switch entity."""
def __init__(self, coordinator, name, switch: Relay): def __init__(self, coordinator, name, switch: Relay) -> None:
"""Initialize the values.""" """Initialize the values."""
super().__init__(coordinator) super().__init__(coordinator)
self._switch = switch self._switch = switch

View file

@ -256,7 +256,7 @@ class ProxmoxEntity(CoordinatorEntity):
host_name, host_name,
node_name, node_name,
vm_id=None, vm_id=None,
): ) -> None:
"""Initialize the Proxmox entity.""" """Initialize the Proxmox entity."""
super().__init__(coordinator) super().__init__(coordinator)

View file

@ -78,7 +78,7 @@ class ProxmoxBinarySensor(ProxmoxEntity, BinarySensorEntity):
host_name, host_name,
node_name, node_name,
vm_id, vm_id,
): ) -> None:
"""Create the binary sensor for vms or containers.""" """Create the binary sensor for vms or containers."""
super().__init__( super().__init__(
coordinator, unique_id, name, icon, host_name, node_name, vm_id coordinator, unique_id, name, icon, host_name, node_name, vm_id

View file

@ -102,7 +102,7 @@ class PyLoadSensor(SensorEntity):
def __init__( def __init__(
self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name self, api: PyLoadAPI, sensor_type: SensorEntityDescription, client_name
): ) -> None:
"""Initialize a new pyLoad sensor.""" """Initialize a new pyLoad sensor."""
self._attr_name = f"{client_name} {sensor_type.name}" self._attr_name = f"{client_name} {sensor_type.name}"
self.type = sensor_type.key self.type = sensor_type.key

View file

@ -107,7 +107,7 @@ class QBittorrentSensor(SensorEntity):
qbittorrent_client, qbittorrent_client,
client_name, client_name,
exception, exception,
): ) -> None:
"""Initialize the qBittorrent sensor.""" """Initialize the qBittorrent sensor."""
self.entity_description = description self.entity_description = description
self.client = qbittorrent_client self.client = qbittorrent_client

View file

@ -319,7 +319,9 @@ class QNAPStatsAPI:
class QNAPSensor(SensorEntity): class QNAPSensor(SensorEntity):
"""Base class for a QNAP sensor.""" """Base class for a QNAP sensor."""
def __init__(self, api, description: SensorEntityDescription, monitor_device=None): def __init__(
self, api, description: SensorEntityDescription, monitor_device=None
) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.monitor_device = monitor_device self.monitor_device = monitor_device

View file

@ -98,7 +98,7 @@ class RaspyRFMSwitch(SwitchEntity):
_attr_should_poll = False _attr_should_poll = False
def __init__(self, raspyrfm_client, name: str, gateway, controlunit): def __init__(self, raspyrfm_client, name: str, gateway, controlunit) -> None:
"""Initialize the switch.""" """Initialize the switch."""
self._raspyrfm_client = raspyrfm_client self._raspyrfm_client = raspyrfm_client

View file

@ -94,7 +94,7 @@ def setup_platform(
class RedditSensor(SensorEntity): class RedditSensor(SensorEntity):
"""Representation of a Reddit sensor.""" """Representation of a Reddit sensor."""
def __init__(self, reddit, subreddit: str, limit: int, sort_by: str): def __init__(self, reddit, subreddit: str, limit: int, sort_by: str) -> None:
"""Initialize the Reddit sensor.""" """Initialize the Reddit sensor."""
self._reddit = reddit self._reddit = reddit
self._subreddit = subreddit self._subreddit = subreddit

View file

@ -69,7 +69,7 @@ class RepetierSensor(SensorEntity):
name, name,
printer_id, printer_id,
description: RepetierSensorEntityDescription, description: RepetierSensorEntityDescription,
): ) -> None:
"""Init new sensor.""" """Init new sensor."""
self.entity_description = description self.entity_description = description
self._api = api self._api = api

View file

@ -80,7 +80,7 @@ class RingBinarySensor(RingEntityMixin, BinarySensorEntity):
ring, ring,
device, device,
description: RingBinarySensorEntityDescription, description: RingBinarySensorEntityDescription,
): ) -> None:
"""Initialize a sensor for Ring device.""" """Initialize a sensor for Ring device."""
super().__init__(config_entry_id, device) super().__init__(config_entry_id, device)
self.entity_description = description self.entity_description = description

View file

@ -49,7 +49,7 @@ class RingSensor(RingEntityMixin, SensorEntity):
config_entry_id, config_entry_id,
device, device,
description: RingSensorEntityDescription, description: RingSensorEntityDescription,
): ) -> None:
"""Initialize a sensor for Ring device.""" """Initialize a sensor for Ring device."""
super().__init__(config_entry_id, device) super().__init__(config_entry_id, device)
self.entity_description = description self.entity_description = description

View file

@ -109,7 +109,7 @@ class RovaSensor(SensorEntity):
def __init__( def __init__(
self, platform_name, description: SensorEntityDescription, data_service self, platform_name, description: SensorEntityDescription, data_service
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.data_service = data_service self.data_service = data_service

View file

@ -130,7 +130,7 @@ class RTorrentSensor(SensorEntity):
def __init__( def __init__(
self, rtorrent_client, client_name, description: SensorEntityDescription self, rtorrent_client, client_name, description: SensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.client = rtorrent_client self.client = rtorrent_client

View file

@ -160,7 +160,7 @@ class SabnzbdSensor(SensorEntity):
client_name, client_name,
description: SabnzbdSensorEntityDescription, description: SabnzbdSensorEntityDescription,
entry_id, entry_id,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self._attr_unique_id = f"{entry_id}_{description.key}" self._attr_unique_id = f"{entry_id}_{description.key}"

View file

@ -336,7 +336,7 @@ class SmappeeSensor(SensorEntity):
smappee_base, smappee_base,
service_location, service_location,
description: SmappeeSensorEntityDescription, description: SmappeeSensorEntityDescription,
): ) -> None:
"""Initialize the Smappee sensor.""" """Initialize the Smappee sensor."""
self.entity_description = description self.entity_description = description
self._smappee_base = smappee_base self._smappee_base = smappee_base

View file

@ -279,7 +279,7 @@ class DeviceBroker:
smart_app, smart_app,
devices: Iterable, devices: Iterable,
scenes: Iterable, scenes: Iterable,
): ) -> None:
"""Create a new instance of the DeviceBroker.""" """Create a new instance of the DeviceBroker."""
self._hass = hass self._hass = hass
self._entry = entry self._entry = entry

View file

@ -16,7 +16,7 @@ class SmartTubEntity(CoordinatorEntity):
def __init__( def __init__(
self, coordinator: DataUpdateCoordinator, spa: smarttub.Spa, entity_name self, coordinator: DataUpdateCoordinator, spa: smarttub.Spa, entity_name
): ) -> None:
"""Initialize the entity. """Initialize the entity.
Given a spa id and a short name for the entity, we provide basic device Given a spa id and a short name for the entity, we provide basic device

View file

@ -33,7 +33,7 @@ async def async_setup_entry(
class SmartTubPump(SmartTubEntity, SwitchEntity): class SmartTubPump(SmartTubEntity, SwitchEntity):
"""A pump on a spa.""" """A pump on a spa."""
def __init__(self, coordinator, pump: SpaPump): def __init__(self, coordinator, pump: SpaPump) -> None:
"""Initialize the entity.""" """Initialize the entity."""
super().__init__(coordinator, pump.spa, "pump") super().__init__(coordinator, pump.spa, "pump")
self.pump_id = pump.id self.pump_id = pump.id

View file

@ -278,7 +278,7 @@ class SolarEdgeSensor(SensorEntity):
platform_name, platform_name,
data, data,
description: SolarEdgeLocalSensorEntityDescription, description: SolarEdgeLocalSensorEntityDescription,
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._platform_name = platform_name self._platform_name = platform_name

View file

@ -168,7 +168,7 @@ async def async_setup_platform(
class StartcaSensor(SensorEntity): class StartcaSensor(SensorEntity):
"""Representation of Start.ca Bandwidth sensor.""" """Representation of Start.ca Bandwidth sensor."""
def __init__(self, startcadata, name, description: SensorEntityDescription): def __init__(self, startcadata, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self.startcadata = startcadata self.startcadata = startcadata

View file

@ -99,7 +99,9 @@ def setup_platform(
class ThinkingCleanerSensor(SensorEntity): class ThinkingCleanerSensor(SensorEntity):
"""Representation of a ThinkingCleaner Sensor.""" """Representation of a ThinkingCleaner Sensor."""
def __init__(self, tc_object, update_devices, description: SensorEntityDescription): def __init__(
self, tc_object, update_devices, description: SensorEntityDescription
) -> None:
"""Initialize the ThinkingCleaner.""" """Initialize the ThinkingCleaner."""
self.entity_description = description self.entity_description = description
self._tc_object = tc_object self._tc_object = tc_object

View file

@ -75,7 +75,9 @@ def setup_platform(
class ThinkingCleanerSwitch(SwitchEntity): class ThinkingCleanerSwitch(SwitchEntity):
"""ThinkingCleaner Switch (dock, clean, find me).""" """ThinkingCleaner Switch (dock, clean, find me)."""
def __init__(self, tc_object, update_devices, description: SwitchEntityDescription): def __init__(
self, tc_object, update_devices, description: SwitchEntityDescription
) -> None:
"""Initialize the ThinkingCleaner.""" """Initialize the ThinkingCleaner."""
self.entity_description = description self.entity_description = description

View file

@ -86,7 +86,7 @@ class TotalConnectAlarm(
name, name,
location_id, location_id,
partition_id, partition_id,
): ) -> None:
"""Initialize the TotalConnect status.""" """Initialize the TotalConnect status."""
super().__init__(coordinator) super().__init__(coordinator)
self._location_id = location_id self._location_id = location_id

View file

@ -141,7 +141,7 @@ class TravisCISensor(SensorEntity):
def __init__( def __init__(
self, data, repo_name, user, branch, description: SensorEntityDescription self, data, repo_name, user, branch, description: SensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._build = None self._build = None

View file

@ -189,7 +189,7 @@ class ViCareBinarySensor(BinarySensorEntity):
def __init__( def __init__(
self, name, api, device_config, description: ViCareBinarySensorEntityDescription self, name, api, device_config, description: ViCareBinarySensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = name self._attr_name = name

View file

@ -98,7 +98,7 @@ class ViCareButton(ButtonEntity):
def __init__( def __init__(
self, name, api, device_config, description: ViCareButtonEntityDescription self, name, api, device_config, description: ViCareButtonEntityDescription
): ) -> None:
"""Initialize the button.""" """Initialize the button."""
self.entity_description = description self.entity_description = description
self._device_config = device_config self._device_config = device_config

View file

@ -659,7 +659,7 @@ class ViCareSensor(SensorEntity):
def __init__( def __init__(
self, name, api, device_config, description: ViCareSensorEntityDescription self, name, api, device_config, description: ViCareSensorEntityDescription
): ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
self.entity_description = description self.entity_description = description
self._attr_name = name self._attr_name = name

View file

@ -32,7 +32,7 @@ class VilfoRouterSensor(SensorEntity):
entity_description: VilfoSensorEntityDescription entity_description: VilfoSensorEntityDescription
def __init__(self, api, description: VilfoSensorEntityDescription): def __init__(self, api, description: VilfoSensorEntityDescription) -> None:
"""Initialize.""" """Initialize."""
self.entity_description = description self.entity_description = description
self.api = api self.api = api

View file

@ -84,7 +84,9 @@ def setup_platform(
class VultrSensor(SensorEntity): class VultrSensor(SensorEntity):
"""Representation of a Vultr subscription sensor.""" """Representation of a Vultr subscription sensor."""
def __init__(self, vultr, subscription, name, description: SensorEntityDescription): def __init__(
self, vultr, subscription, name, description: SensorEntityDescription
) -> None:
"""Initialize a new Vultr sensor.""" """Initialize a new Vultr sensor."""
self.entity_description = description self.entity_description = description
self._vultr = vultr self._vultr = vultr

View file

@ -77,7 +77,7 @@ def setup_platform(
class WirelessTagSwitch(WirelessTagBaseSensor, SwitchEntity): class WirelessTagSwitch(WirelessTagBaseSensor, SwitchEntity):
"""A switch implementation for Wireless Sensor Tags.""" """A switch implementation for Wireless Sensor Tags."""
def __init__(self, api, tag, description: SwitchEntityDescription): def __init__(self, api, tag, description: SwitchEntityDescription) -> None:
"""Initialize a switch for Wireless Sensor Tag.""" """Initialize a switch for Wireless Sensor Tag."""
super().__init__(api, tag) super().__init__(api, tag)
self.entity_description = description self.entity_description = description

View file

@ -53,7 +53,7 @@ async def async_setup_entry(
class WolfLinkSensor(CoordinatorEntity, SensorEntity): class WolfLinkSensor(CoordinatorEntity, SensorEntity):
"""Base class for all Wolf entities.""" """Base class for all Wolf entities."""
def __init__(self, coordinator, wolf_object: Parameter, device_id): def __init__(self, coordinator, wolf_object: Parameter, device_id) -> None:
"""Initialize.""" """Initialize."""
super().__init__(coordinator) super().__init__(coordinator)
self.wolf_object = wolf_object self.wolf_object = wolf_object

View file

@ -206,7 +206,7 @@ class MiroboVacuum(
entry, entry,
unique_id, unique_id,
coordinator: DataUpdateCoordinator[VacuumCoordinatorData], coordinator: DataUpdateCoordinator[VacuumCoordinatorData],
): ) -> None:
"""Initialize the Xiaomi vacuum cleaner robot handler.""" """Initialize the Xiaomi vacuum cleaner robot handler."""
super().__init__(device, entry, unique_id, coordinator) super().__init__(device, entry, unique_id, coordinator)
self._state: str | None = None self._state: str | None = None

View file

@ -71,7 +71,7 @@ class DiscoverYandexTransport(SensorEntity):
_attr_attribution = "Data provided by maps.yandex.ru" _attr_attribution = "Data provided by maps.yandex.ru"
def __init__(self, requester: YandexMapsRequester, stop_id, routes, name): def __init__(self, requester: YandexMapsRequester, stop_id, routes, name) -> None:
"""Initialize sensor.""" """Initialize sensor."""
self.requester = requester self.requester = requester
self._stop_id = stop_id self._stop_id = stop_id

View file

@ -89,7 +89,7 @@ class ZHAAlarmControlPanel(ZhaEntity, AlarmControlPanelEntity):
| AlarmControlPanelEntityFeature.TRIGGER | AlarmControlPanelEntityFeature.TRIGGER
) )
def __init__(self, unique_id, zha_device: ZHADevice, channels, **kwargs): def __init__(self, unique_id, zha_device: ZHADevice, channels, **kwargs) -> None:
"""Initialize the ZHA alarm control device.""" """Initialize the ZHA alarm control device."""
super().__init__(unique_id, zha_device, channels, **kwargs) super().__init__(unique_id, zha_device, channels, **kwargs)
cfg_entry = zha_device.gateway.config_entry cfg_entry = zha_device.gateway.config_entry

View file

@ -623,7 +623,7 @@ class Light(BaseLight, ZhaEntity):
_attr_supported_color_modes: set[ColorMode] _attr_supported_color_modes: set[ColorMode]
_REFRESH_INTERVAL = (45, 75) _REFRESH_INTERVAL = (45, 75)
def __init__(self, unique_id, zha_device: ZHADevice, channels, **kwargs): def __init__(self, unique_id, zha_device: ZHADevice, channels, **kwargs) -> None:
"""Initialize the ZHA light.""" """Initialize the ZHA light."""
super().__init__(unique_id, zha_device, channels, **kwargs) super().__init__(unique_id, zha_device, channels, **kwargs)
self._on_off_channel = self.cluster_channels[CHANNEL_ON_OFF] self._on_off_channel = self.cluster_channels[CHANNEL_ON_OFF]