mirror of
https://github.com/home-assistant/core.git
synced 2026-05-26 02:35:12 +02:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38b4184dc3 | |||
| cfde7975d8 | |||
| d7ab696a4c | |||
| 7f7dad7f71 | |||
| 0ed21dbed7 | |||
| d2b37ee28b | |||
| b82c95e77f | |||
| baa61982a1 | |||
| 8ff6de788d | |||
| 640f82642a | |||
| 64ed269f9c | |||
| 2b58ef96eb | |||
| 74ca79ac28 | |||
| afb27bc165 | |||
| 0cbf27f44f | |||
| a5ceafa544 | |||
| cd4d669231 | |||
| cc411d06b5 | |||
| 1329f12d37 | |||
| 3899f5347b | |||
| cf02cfaa7c | |||
| e77c16ea1b | |||
| f1e2f94ee0 | |||
| 3516883b0a | |||
| c8b70b1a38 | |||
| 946625e281 | |||
| f4b7840d5c | |||
| 060f447e4a | |||
| d5bae0a2cf | |||
| f9bef804b1 | |||
| 6de03f4ed6 | |||
| e7f3e5637f | |||
| 80cefc74ec | |||
| 2f33b4b7f9 | |||
| cf52a7a509 | |||
| f5835f849a | |||
| ec5210dca8 | |||
| 422ea1a9b1 | |||
| b6f69f6b99 | |||
| a2a3819241 | |||
| 3ce33b0ac6 | |||
| e507a97d8b |
@@ -193,7 +193,11 @@ async def async_setup_entry(
|
||||
Aranet4BluetoothSensorEntity, async_add_entities
|
||||
)
|
||||
)
|
||||
entry.async_on_unload(entry.runtime_data.async_register_processor(processor))
|
||||
entry.async_on_unload(
|
||||
entry.runtime_data.async_register_processor(
|
||||
processor, AranetSensorEntityDescription
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class Aranet4BluetoothSensorEntity(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
from ipaddress import ip_address
|
||||
from typing import Any
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
import voluptuous as vol
|
||||
@@ -49,6 +49,9 @@ from .const import (
|
||||
from .errors import AuthenticationRequired, CannotConnect
|
||||
from .hub import AxisHub, get_axis_api
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import axis
|
||||
|
||||
AXIS_OUI = {"00:40:8c", "ac:cc:8e", "b8:a4:4f", "e8:27:25"}
|
||||
DEFAULT_PORT = 443
|
||||
DEFAULT_PROTOCOL = "https"
|
||||
@@ -93,7 +96,8 @@ class AxisFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
errors["base"] = "cannot_connect"
|
||||
|
||||
else:
|
||||
serial = api.vapix.serial_number
|
||||
if (serial := self._get_serial_number(api)) is None:
|
||||
return self.async_abort(reason="no_serial_number")
|
||||
config = {
|
||||
CONF_PROTOCOL: user_input[CONF_PROTOCOL],
|
||||
CONF_HOST: user_input[CONF_HOST],
|
||||
@@ -258,6 +262,19 @@ class AxisFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
return await self.async_step_user()
|
||||
|
||||
@staticmethod
|
||||
def _get_serial_number(api: axis.AxisDevice) -> str | None:
|
||||
"""Retrieve the device serial number from the Axis API.
|
||||
|
||||
Tries basic_device_info first, then property_handler. Returns None if not found.
|
||||
"""
|
||||
vapix = api.vapix
|
||||
if vapix.basic_device_info.initialized:
|
||||
return vapix.basic_device_info["0"].serial_number
|
||||
if vapix.params.property_handler.initialized:
|
||||
return vapix.params.property_handler["0"].system_serial_number
|
||||
return None
|
||||
|
||||
|
||||
class AxisOptionsFlowHandler(OptionsFlow):
|
||||
"""Handle Axis device options."""
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"link_local_address": "Link local addresses are not supported",
|
||||
"no_serial_number": "Could not retrieve a serial number from the device. Please check device connectivity and try again.",
|
||||
"not_axis_device": "Discovered device not an Axis device",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
|
||||
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
"integration_type": "device",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["blebox_uniapi"],
|
||||
"requirements": ["blebox-uniapi==2.5.3"],
|
||||
"requirements": ["blebox-uniapi==2.5.4"],
|
||||
"zeroconf": ["_bbxsrv._tcp.local."]
|
||||
}
|
||||
|
||||
@@ -124,7 +124,9 @@ async def async_setup_entry(
|
||||
BlueMaestroBluetoothSensorEntity, async_add_entities
|
||||
)
|
||||
)
|
||||
entry.async_on_unload(coordinator.async_register_processor(processor))
|
||||
entry.async_on_unload(
|
||||
coordinator.async_register_processor(processor, SensorEntityDescription)
|
||||
)
|
||||
|
||||
|
||||
class BlueMaestroBluetoothSensorEntity(
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
"requirements": [
|
||||
"bleak==3.0.2",
|
||||
"bleak-retry-connector==4.6.1",
|
||||
"bluetooth-adapters==2.1.0",
|
||||
"bluetooth-adapters==2.3.0",
|
||||
"bluetooth-auto-recovery==1.6.4",
|
||||
"bluetooth-data-tools==1.29.18",
|
||||
"dbus-fast==5.0.9",
|
||||
"habluetooth==6.7.3"
|
||||
"dbus-fast==5.0.11",
|
||||
"habluetooth==6.7.4"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -275,9 +275,13 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
)
|
||||
)
|
||||
|
||||
def should_expose(self, state: State) -> bool:
|
||||
"""If a state object should be exposed."""
|
||||
return self._should_expose_entity_id(state.entity_id)
|
||||
def should_expose(self, entity_id: str) -> bool:
|
||||
"""If an entity should be exposed."""
|
||||
entity_filter: EntityFilter = self._config[CONF_FILTER]
|
||||
if not entity_filter.empty_filter:
|
||||
return entity_filter(entity_id)
|
||||
|
||||
return async_should_expose(self.hass, CLOUD_GOOGLE, entity_id)
|
||||
|
||||
def _should_expose_legacy(self, entity_id: str) -> bool:
|
||||
"""If an entity ID should be exposed."""
|
||||
@@ -308,14 +312,6 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
and _supported_legacy(self.hass, entity_id)
|
||||
)
|
||||
|
||||
def _should_expose_entity_id(self, entity_id: str) -> bool:
|
||||
"""If an entity should be exposed."""
|
||||
entity_filter: EntityFilter = self._config[CONF_FILTER]
|
||||
if not entity_filter.empty_filter:
|
||||
return entity_filter(entity_id)
|
||||
|
||||
return async_should_expose(self.hass, CLOUD_GOOGLE, entity_id)
|
||||
|
||||
@property
|
||||
def agent_user_id(self) -> str:
|
||||
"""Return Agent User Id to use for query responses."""
|
||||
@@ -467,7 +463,7 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
|
||||
entity_id = event.data["entity_id"]
|
||||
|
||||
if not self._should_expose_entity_id(entity_id):
|
||||
if not self.should_expose(entity_id):
|
||||
return
|
||||
|
||||
self.async_schedule_google_sync_all()
|
||||
@@ -490,8 +486,7 @@ class CloudGoogleConfig(AbstractConfig):
|
||||
|
||||
# Check if any exposed entity uses the device area
|
||||
if not any(
|
||||
entity_entry.area_id is None
|
||||
and self._should_expose_entity_id(entity_entry.entity_id)
|
||||
entity_entry.area_id is None and self.should_expose(entity_entry.entity_id)
|
||||
for entity_entry in er.async_entries_for_device(
|
||||
er.async_get(self.hass), event.data["device_id"]
|
||||
)
|
||||
|
||||
@@ -357,6 +357,23 @@ class BaseScannerEntity(BaseTrackerEntity):
|
||||
"""Return true if the device is connected."""
|
||||
raise NotImplementedError
|
||||
|
||||
@final
|
||||
@property
|
||||
def state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the device state attributes."""
|
||||
attr: dict[str, Any] = {ATTR_IN_ZONES: []}
|
||||
attr.update(super().state_attributes)
|
||||
|
||||
if not self.is_connected:
|
||||
return attr
|
||||
|
||||
attr[ATTR_IN_ZONES] = [
|
||||
zone.ENTITY_ID_HOME,
|
||||
*zone.async_get_enclosing_zones(self.hass, zone.ENTITY_ID_HOME),
|
||||
]
|
||||
|
||||
return attr
|
||||
|
||||
|
||||
class ScannerEntityDescription(EntityDescription, frozen_or_thawed=True):
|
||||
"""A class that describes tracker entities."""
|
||||
@@ -484,9 +501,12 @@ class ScannerEntity(
|
||||
# Do this last or else the entity registry update listener has been installed
|
||||
await super().async_internal_added_to_hass()
|
||||
|
||||
@final
|
||||
# BaseScannerEntity.state_attributes is @final to keep external subclasses
|
||||
# from tampering with it; ScannerEntity is an in-tree subclass that
|
||||
# intentionally extends it with ip/mac/hostname.
|
||||
@final # type: ignore[misc]
|
||||
@property
|
||||
def state_attributes(self) -> dict[str, StateType]:
|
||||
def state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the device state attributes."""
|
||||
attr = super().state_attributes
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
],
|
||||
"quality_scale": "internal",
|
||||
"requirements": [
|
||||
"aiodhcpwatcher==1.2.6",
|
||||
"aiodhcpwatcher==1.2.7",
|
||||
"aiodiscover==3.2.3",
|
||||
"cached-ipaddress==1.1.1"
|
||||
]
|
||||
|
||||
@@ -27,7 +27,7 @@ DEFAULT_BLUETOOTH_SCANNING_MODE = BluetoothScanningMode.AUTO.value
|
||||
|
||||
DEFAULT_PORT: Final = 6053
|
||||
|
||||
STABLE_BLE_VERSION_STR = "2025.11.0"
|
||||
STABLE_BLE_VERSION_STR = "2026.5.1"
|
||||
STABLE_BLE_VERSION = AwesomeVersion(STABLE_BLE_VERSION_STR)
|
||||
PROJECT_URLS = {
|
||||
"esphome.bluetooth-proxy": "https://esphome.github.io/bluetooth-proxies/",
|
||||
|
||||
@@ -53,7 +53,7 @@ def async_static_info_updated(
|
||||
platform: entity_platform.EntityPlatform,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
info_type: type[_InfoT],
|
||||
entity_type: type[_EntityT],
|
||||
entity_type: Callable[[RuntimeEntryData, EntityInfo, type[_StateT]], _EntityT],
|
||||
state_type: type[_StateT],
|
||||
infos: list[EntityInfo],
|
||||
) -> None:
|
||||
@@ -188,7 +188,7 @@ async def platform_async_setup_entry(
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
*,
|
||||
info_type: type[_InfoT],
|
||||
entity_type: type[_EntityT],
|
||||
entity_type: Callable[[RuntimeEntryData, EntityInfo, type[_StateT]], _EntityT],
|
||||
state_type: type[_StateT],
|
||||
info_filter: Callable[[_InfoT], bool] | None = None,
|
||||
) -> None:
|
||||
@@ -196,6 +196,11 @@ async def platform_async_setup_entry(
|
||||
|
||||
This method is in charge of receiving, distributing and storing
|
||||
info and state updates.
|
||||
|
||||
`entity_type` is any callable that builds an entity from
|
||||
`(entry_data, info, state_type)`. A regular entity class satisfies this,
|
||||
and platforms with multiple entity classes can pass a factory function
|
||||
that picks the class per static info.
|
||||
"""
|
||||
entry_data = entry.runtime_data
|
||||
entry_data.info[info_type] = {}
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
"""Infrared platform for ESPHome."""
|
||||
|
||||
from functools import partial
|
||||
import functools
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from aioesphomeapi import EntityState, InfraredCapability, InfraredInfo
|
||||
from aioesphomeapi import EntityInfo, EntityState, InfraredCapability, InfraredInfo
|
||||
from aioesphomeapi.client import InfraredRFReceiveEventModel
|
||||
|
||||
from homeassistant.components.infrared import InfraredCommand, InfraredEmitterEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.components.infrared import (
|
||||
InfraredCommand,
|
||||
InfraredEmitterEntity,
|
||||
InfraredReceivedSignal,
|
||||
InfraredReceiverEntity,
|
||||
)
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
|
||||
from .entity import (
|
||||
EsphomeEntity,
|
||||
convert_api_error_ha_error,
|
||||
platform_async_setup_entry,
|
||||
)
|
||||
from .entry_data import RuntimeEntryData
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
class EsphomeInfraredEntity(
|
||||
EsphomeEntity[InfraredInfo, EntityState], InfraredEmitterEntity
|
||||
):
|
||||
"""ESPHome infrared emitter entity using native API."""
|
||||
class _EsphomeInfraredEntity(EsphomeEntity[InfraredInfo, EntityState]):
|
||||
"""Common base for ESPHome infrared entities."""
|
||||
|
||||
@callback
|
||||
def _on_device_update(self) -> None:
|
||||
@@ -32,6 +38,10 @@ class EsphomeInfraredEntity(
|
||||
# Infrared entities should go available as soon as the device comes online
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class EsphomeInfraredEmitterEntity(_EsphomeInfraredEntity, InfraredEmitterEntity):
|
||||
"""ESPHome infrared emitter entity using native API."""
|
||||
|
||||
@convert_api_error_ha_error
|
||||
async def async_send_command(self, command: InfraredCommand) -> None:
|
||||
"""Send an IR command."""
|
||||
@@ -46,10 +56,77 @@ class EsphomeInfraredEntity(
|
||||
)
|
||||
|
||||
|
||||
async_setup_entry = partial(
|
||||
class EsphomeInfraredReceiverEntity(_EsphomeInfraredEntity, InfraredReceiverEntity):
|
||||
"""ESPHome infrared receiver entity using native API."""
|
||||
|
||||
_unsub_receive: CALLBACK_TYPE | None = None
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks including IR receive subscription."""
|
||||
await super().async_added_to_hass()
|
||||
self._async_subscribe_receive()
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Unsubscribe from the device on entity removal."""
|
||||
await super().async_will_remove_from_hass()
|
||||
if self._unsub_receive is not None:
|
||||
self._unsub_receive()
|
||||
self._unsub_receive = None
|
||||
|
||||
@callback
|
||||
def _async_subscribe_receive(self) -> None:
|
||||
"""Subscribe to IR receive events if the device is connected."""
|
||||
# Subscribing requires an active API connection; defer to
|
||||
# _on_device_update when the device is not (yet) available.
|
||||
if self._unsub_receive is not None or not self._entry_data.available:
|
||||
return
|
||||
self._unsub_receive = self._client.subscribe_infrared_rf_receive(
|
||||
self._on_infrared_rf_receive
|
||||
)
|
||||
|
||||
@callback
|
||||
def _on_device_update(self) -> None:
|
||||
"""Call when device updates or entry data changes."""
|
||||
super()._on_device_update()
|
||||
if self._entry_data.available:
|
||||
self._async_subscribe_receive()
|
||||
elif self._unsub_receive is not None:
|
||||
self._unsub_receive = None
|
||||
|
||||
@callback
|
||||
def _on_infrared_rf_receive(self, event: InfraredRFReceiveEventModel) -> None:
|
||||
"""Handle a received IR signal from the device."""
|
||||
if (
|
||||
event.key != self._static_info.key
|
||||
or event.device_id != self._static_info.device_id
|
||||
):
|
||||
return
|
||||
self._handle_received_signal(InfraredReceivedSignal(timings=event.timings))
|
||||
|
||||
|
||||
def _make_infrared_entity(
|
||||
entry_data: RuntimeEntryData,
|
||||
info: EntityInfo,
|
||||
state_type: type[EntityState],
|
||||
) -> _EsphomeInfraredEntity:
|
||||
"""Build the right infrared entity based on the InfraredInfo capabilities."""
|
||||
if TYPE_CHECKING:
|
||||
assert isinstance(info, InfraredInfo)
|
||||
cls = (
|
||||
EsphomeInfraredReceiverEntity
|
||||
if info.capabilities & InfraredCapability.RECEIVER
|
||||
else EsphomeInfraredEmitterEntity
|
||||
)
|
||||
return cls(entry_data, info, state_type)
|
||||
|
||||
|
||||
async_setup_entry = functools.partial(
|
||||
platform_async_setup_entry,
|
||||
info_type=InfraredInfo,
|
||||
entity_type=EsphomeInfraredEntity,
|
||||
entity_type=_make_infrared_entity,
|
||||
state_type=EntityState,
|
||||
info_filter=lambda info: bool(info.capabilities & InfraredCapability.TRANSMITTER),
|
||||
info_filter=lambda info: bool(
|
||||
info.capabilities
|
||||
& (InfraredCapability.TRANSMITTER | InfraredCapability.RECEIVER)
|
||||
),
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Callable, Mapping
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from faadelays import Airport
|
||||
|
||||
@@ -121,13 +121,11 @@ class FAABinarySensor(CoordinatorEntity[FAADataUpdateCoordinator], BinarySensorE
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return the status of the sensor."""
|
||||
return self.entity_description.is_on_fn(self.coordinator.data)
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||
"""Return attributes for sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for FAA Delays integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import ClientConnectionError
|
||||
import faadelays
|
||||
@@ -23,7 +23,6 @@ class FAADelaysConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from aiohttp import ClientConnectionError
|
||||
from faadelays import Airport
|
||||
@@ -35,7 +34,6 @@ class FAADataUpdateCoordinator(DataUpdateCoordinator[Airport]):
|
||||
self.session = aiohttp_client.async_get_clientsession(hass)
|
||||
self.data = Airport(code, self.session)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> Airport:
|
||||
try:
|
||||
async with asyncio.timeout(10):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
@@ -45,7 +45,6 @@ class FacebookNotificationService(BaseNotificationService):
|
||||
"""Initialize the service."""
|
||||
self.page_access_token = access_token
|
||||
|
||||
@override
|
||||
def send_message(self, message: str = "", **kwargs: Any) -> None:
|
||||
"""Send some message."""
|
||||
payload = {"access_token": self.page_access_token}
|
||||
|
||||
@@ -4,7 +4,7 @@ from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -69,19 +69,16 @@ class BanSensor(SensorEntity):
|
||||
)
|
||||
_LOGGER.debug("Setting up jail %s", self.jail)
|
||||
|
||||
@override
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return self._name
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the state attributes of the fail2ban sensor."""
|
||||
return self.ban_dict
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the most recently banned IP Address."""
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Family Hub camera for Samsung Refrigerators."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfamilyhublocal import FamilyHubCam
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -52,14 +50,12 @@ class FamilyHubCamera(Camera):
|
||||
self._name = name
|
||||
self.family_hub_cam = family_hub_cam
|
||||
|
||||
@override
|
||||
async def async_camera_image(
|
||||
self, width: int | None = None, height: int | None = None
|
||||
) -> bytes | None:
|
||||
"""Return a still image response."""
|
||||
return await self.family_hub_cam.async_get_cam_image()
|
||||
|
||||
@override
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of this camera."""
|
||||
|
||||
@@ -5,7 +5,7 @@ from enum import IntFlag
|
||||
import functools as ft
|
||||
import logging
|
||||
import math
|
||||
from typing import Any, final, override
|
||||
from typing import Any, final
|
||||
|
||||
from propcache.api import cached_property
|
||||
import voluptuous as vol
|
||||
@@ -288,7 +288,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Set the direction of the fan."""
|
||||
await self.hass.async_add_executor_job(self.set_direction, direction)
|
||||
|
||||
@override
|
||||
def turn_on(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
@@ -310,7 +309,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
self._valid_preset_mode_or_raise(preset_mode)
|
||||
await self.async_turn_on(percentage, preset_mode, **kwargs)
|
||||
|
||||
@override
|
||||
async def async_turn_on(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
@@ -335,7 +333,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Oscillate the fan."""
|
||||
await self.hass.async_add_executor_job(self.oscillate, oscillating)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return true if the entity is on."""
|
||||
@@ -368,7 +365,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Return whether or not the fan is currently oscillating."""
|
||||
return self._attr_oscillating
|
||||
|
||||
@override
|
||||
@property
|
||||
def capability_attributes(self) -> dict[str, list[str] | None]:
|
||||
"""Return capability attributes."""
|
||||
@@ -383,7 +379,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
|
||||
return attrs
|
||||
|
||||
@override
|
||||
@final
|
||||
@property
|
||||
def state_attributes(self) -> dict[str, float | str | None]:
|
||||
@@ -408,7 +403,6 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
|
||||
return data
|
||||
|
||||
@override
|
||||
@cached_property
|
||||
def supported_features(self) -> FanEntityFeature:
|
||||
"""Flag supported features."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Config flow for Fast.com integration."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
|
||||
@@ -12,7 +12,6 @@ class FastdotcomConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""DataUpdateCoordinator for the Fast.com integration."""
|
||||
|
||||
from datetime import timedelta
|
||||
from typing import override
|
||||
|
||||
from fastdotcom import fast_com
|
||||
|
||||
@@ -27,7 +26,6 @@ class FastdotcomDataUpdateCoordinator(DataUpdateCoordinator[dict[str, float] | N
|
||||
update_interval=timedelta(hours=DEFAULT_INTERVAL),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, float] | None:
|
||||
"""Run an executor job to retrieve Fast.com data."""
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Support for Fast.com internet speed testing sensor."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@@ -48,7 +46,6 @@ class SpeedtestSensor(CoordinatorEntity[FastdotcomDataUpdateCoordinator], Sensor
|
||||
configuration_url="https://www.fast.com",
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(
|
||||
self,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import html
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
import urllib.error
|
||||
|
||||
import feedparser
|
||||
@@ -38,7 +38,6 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
@@ -70,7 +69,6 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import datetime
|
||||
import html
|
||||
from logging import getLogger
|
||||
from time import gmtime, struct_time
|
||||
from typing import TYPE_CHECKING, override
|
||||
from typing import TYPE_CHECKING
|
||||
from urllib.error import URLError
|
||||
|
||||
import feedparser
|
||||
@@ -114,7 +114,6 @@ class FeedReaderCoordinator(
|
||||
self.feed_version = feedparser.api.SUPPORTED_VERSIONS.get(feed["version"])
|
||||
self._feed = feed
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> list[feedparser.FeedParserDict] | None:
|
||||
"""Update the feed and publish new entries to the event bus."""
|
||||
assert self._feed is not None
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import html
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from feedparser import FeedParserDict
|
||||
|
||||
@@ -62,7 +61,6 @@ class FeedReaderEvent(CoordinatorEntity[FeedReaderCoordinator], EventEntity):
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import asyncio
|
||||
import re
|
||||
from typing import override
|
||||
|
||||
from haffmpeg.core import HAFFmpeg
|
||||
from haffmpeg.tools import IMAGE_JPEG, FFVersion, ImageFrame
|
||||
@@ -151,7 +150,6 @@ class FFmpegBase[_HAFFmpegT: HAFFmpeg](Entity): # pylint: disable=home-assistan
|
||||
self.ffmpeg = ffmpeg
|
||||
self.initial_state = initial_state
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register dispatcher & events.
|
||||
|
||||
@@ -176,7 +174,6 @@ class FFmpegBase[_HAFFmpegT: HAFFmpeg](Entity): # pylint: disable=home-assistan
|
||||
# register start/stop
|
||||
self._async_register_events()
|
||||
|
||||
@override
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Cameras with FFmpeg as decoder."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import web
|
||||
from haffmpeg.camera import CameraMjpeg
|
||||
@@ -63,12 +63,10 @@ class FFmpegCamera(Camera):
|
||||
self._input: str = config[CONF_INPUT]
|
||||
self._extra_arguments: str = config[CONF_EXTRA_ARGUMENTS]
|
||||
|
||||
@override
|
||||
async def stream_source(self) -> str:
|
||||
"""Return the stream source."""
|
||||
return self._input.split(" ")[-1]
|
||||
|
||||
@override
|
||||
async def async_camera_image(
|
||||
self, width: int | None = None, height: int | None = None
|
||||
) -> bytes | None:
|
||||
@@ -80,7 +78,6 @@ class FFmpegCamera(Camera):
|
||||
extra_cmd=self._extra_arguments,
|
||||
)
|
||||
|
||||
@override
|
||||
async def handle_async_mjpeg_stream(
|
||||
self, request: web.Request
|
||||
) -> web.StreamResponse:
|
||||
@@ -100,7 +97,6 @@ class FFmpegCamera(Camera):
|
||||
finally:
|
||||
await stream.close()
|
||||
|
||||
@override
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of this camera."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Provides a binary sensor which is a collection of ffmpeg tools."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from haffmpeg.core import HAFFmpeg
|
||||
import haffmpeg.sensor as ffmpeg_sensor
|
||||
@@ -85,13 +85,11 @@ class FFmpegBinarySensor[_HAFFmpegT: HAFFmpeg](
|
||||
self._state = state
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return true if the binary sensor is on."""
|
||||
return self._state
|
||||
|
||||
@override
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
@@ -108,7 +106,6 @@ class FFmpegMotion(FFmpegBinarySensor[ffmpeg_sensor.SensorMotion]):
|
||||
ffmpeg = ffmpeg_sensor.SensorMotion(manager.binary, self._async_callback)
|
||||
super().__init__(ffmpeg, config)
|
||||
|
||||
@override
|
||||
async def _async_start_ffmpeg(self, entity_ids: list[str] | None) -> None:
|
||||
"""Start a FFmpeg instance.
|
||||
|
||||
@@ -131,7 +128,6 @@ class FFmpegMotion(FFmpegBinarySensor[ffmpeg_sensor.SensorMotion]):
|
||||
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def device_class(self) -> BinarySensorDeviceClass:
|
||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Provides a binary sensor which is a collection of ffmpeg tools."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import haffmpeg.sensor as ffmpeg_sensor
|
||||
import voluptuous as vol
|
||||
@@ -74,7 +74,6 @@ class FFmpegNoise(FFmpegBinarySensor[ffmpeg_sensor.SensorNoise]):
|
||||
ffmpeg = ffmpeg_sensor.SensorNoise(manager.binary, self._async_callback)
|
||||
super().__init__(ffmpeg, config)
|
||||
|
||||
@override
|
||||
async def _async_start_ffmpeg(self, entity_ids: list[str] | None) -> None:
|
||||
"""Start a FFmpeg instance.
|
||||
|
||||
@@ -95,7 +94,6 @@ class FFmpegNoise(FFmpegBinarySensor[ffmpeg_sensor.SensorNoise]):
|
||||
extra_cmd=self._config.get(CONF_EXTRA_ARGUMENTS),
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def device_class(self) -> BinarySensorDeviceClass:
|
||||
"""Return the class of this sensor, from DEVICE_CLASSES."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Fibaro binary sensors."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -72,13 +72,11 @@ class FibaroBinarySensor(FibaroEntity, BinarySensorEntity):
|
||||
)
|
||||
self._attr_icon = SENSOR_TYPES[self._fibaro_sensor_type][1]
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||
"""Return the extra state attributes of the device."""
|
||||
return {**super().extra_state_attributes, **self._own_extra_state_attributes}
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Get the latest data and update the state."""
|
||||
super().update()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from contextlib import suppress
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -209,7 +209,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when entity is added to hass."""
|
||||
_LOGGER.debug(
|
||||
@@ -234,7 +233,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
if device != self.fibaro_device:
|
||||
self.controller.register(device.fibaro_id, self._update_callback)
|
||||
|
||||
@override
|
||||
@property
|
||||
def fan_mode(self) -> str | None:
|
||||
"""Return the fan setting."""
|
||||
@@ -243,7 +241,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
mode = self._fan_mode_device.mode
|
||||
return FANMODES[mode]
|
||||
|
||||
@override
|
||||
def set_fan_mode(self, fan_mode: str) -> None:
|
||||
"""Set new target fan mode."""
|
||||
if not self._fan_mode_device:
|
||||
@@ -264,7 +261,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
return device.thermostat_mode
|
||||
return device.mode
|
||||
|
||||
@override
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode | None:
|
||||
"""Return hvac operation ie. heat, cool, idle."""
|
||||
@@ -278,7 +274,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
return OPMODES_HVAC[fibaro_operation_mode]
|
||||
return None
|
||||
|
||||
@override
|
||||
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set new target operation mode."""
|
||||
if not self._op_mode_device:
|
||||
@@ -296,7 +291,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
elif "setMode" in device.actions:
|
||||
device.execute_action("setMode", [HA_OPMODES_HVAC[hvac_mode]])
|
||||
|
||||
@override
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction | None:
|
||||
"""Return the current running hvac operation if supported."""
|
||||
@@ -310,7 +304,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
|
||||
return None
|
||||
|
||||
@override
|
||||
@property
|
||||
def preset_mode(self) -> str | None:
|
||||
"""Return the current preset mode, e.g., home, away, temp.
|
||||
@@ -334,7 +327,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
return None
|
||||
return OPMODES_PRESET[mode]
|
||||
|
||||
@override
|
||||
def set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set new preset mode."""
|
||||
if self._op_mode_device is None:
|
||||
@@ -351,7 +343,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
"setMode", [HA_OPMODES_PRESET[preset_mode]]
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
@@ -362,7 +353,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
return device.value.float_value()
|
||||
return None
|
||||
|
||||
@override
|
||||
@property
|
||||
def target_temperature(self) -> float | None:
|
||||
"""Return the temperature we try to reach."""
|
||||
@@ -373,7 +363,6 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
return device.target_level
|
||||
return None
|
||||
|
||||
@override
|
||||
def set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperatures."""
|
||||
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_client import FibaroAuthenticationFailed, FibaroConnectFailed
|
||||
from slugify import slugify
|
||||
@@ -62,7 +62,6 @@ class FibaroConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Fibaro cover - curtains, rollershutters etc."""
|
||||
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -56,7 +56,6 @@ class PositionableFibaroCover(FibaroEntity, CoverEntity):
|
||||
return 100
|
||||
return position
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
@@ -76,37 +75,30 @@ class PositionableFibaroCover(FibaroEntity, CoverEntity):
|
||||
closed = self.current_cover_position == 0
|
||||
self._attr_is_closed = closed
|
||||
|
||||
@override
|
||||
def set_cover_position(self, **kwargs: Any) -> None:
|
||||
"""Move the cover to a specific position."""
|
||||
self.set_level(cast(int, kwargs.get(ATTR_POSITION)))
|
||||
|
||||
@override
|
||||
def set_cover_tilt_position(self, **kwargs: Any) -> None:
|
||||
"""Move the slats to a specific position."""
|
||||
self.set_level2(cast(int, kwargs.get(ATTR_TILT_POSITION)))
|
||||
|
||||
@override
|
||||
def open_cover(self, **kwargs: Any) -> None:
|
||||
"""Open the cover."""
|
||||
self.action("open")
|
||||
|
||||
@override
|
||||
def close_cover(self, **kwargs: Any) -> None:
|
||||
"""Close the cover."""
|
||||
self.action("close")
|
||||
|
||||
@override
|
||||
def open_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Open the cover tilt."""
|
||||
self.set_level2(100)
|
||||
|
||||
@override
|
||||
def close_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Close the cover."""
|
||||
self.set_level2(0)
|
||||
|
||||
@override
|
||||
def stop_cover(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover."""
|
||||
self.action("stop")
|
||||
@@ -132,7 +124,6 @@ class FibaroCover(FibaroEntity, CoverEntity):
|
||||
if "stopSlats" in self.fibaro_device.actions:
|
||||
self._attr_supported_features |= CoverEntityFeature.STOP_TILT
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
@@ -147,32 +138,26 @@ class FibaroCover(FibaroEntity, CoverEntity):
|
||||
closed = device_state == "closed"
|
||||
self._attr_is_closed = closed
|
||||
|
||||
@override
|
||||
def open_cover(self, **kwargs: Any) -> None:
|
||||
"""Open the cover."""
|
||||
self.action("open")
|
||||
|
||||
@override
|
||||
def close_cover(self, **kwargs: Any) -> None:
|
||||
"""Close the cover."""
|
||||
self.action("close")
|
||||
|
||||
@override
|
||||
def stop_cover(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover."""
|
||||
self.action("stop")
|
||||
|
||||
@override
|
||||
def open_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Open the cover slats."""
|
||||
self.action("rotateSlatsUp")
|
||||
|
||||
@override
|
||||
def close_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Close the cover slats."""
|
||||
self.action("rotateSlatsDown")
|
||||
|
||||
@override
|
||||
def stop_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover slats turning."""
|
||||
self.action("stopSlats")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -32,7 +32,6 @@ class FibaroEntity(Entity):
|
||||
if not fibaro_device.visible:
|
||||
self._attr_entity_registry_visible_default = False
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when entity is added to hass."""
|
||||
self.async_on_remove(
|
||||
@@ -100,7 +99,6 @@ class FibaroEntity(Entity):
|
||||
"""Return the current binary state."""
|
||||
return self.fibaro_device.value.bool_value(False)
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> Mapping[str, Any]:
|
||||
"""Return the state attributes of the device."""
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Support for Fibaro event entities."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel, SceneEvent
|
||||
from pyfibaro.fibaro_state_resolver import FibaroEvent
|
||||
|
||||
@@ -55,7 +53,6 @@ class FibaroEventEntity(FibaroEntity, EventEntity):
|
||||
self._attr_event_types = scene_event.key_event_types
|
||||
self._attr_unique_id = f"{fibaro_device.unique_id_str}.{key_id}"
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when entity is added to hass."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Fibaro lights."""
|
||||
|
||||
from contextlib import suppress
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -100,7 +100,6 @@ class FibaroLight(FibaroEntity, LightEntity):
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
|
||||
@override
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the light on."""
|
||||
if ATTR_BRIGHTNESS in kwargs:
|
||||
@@ -125,12 +124,10 @@ class FibaroLight(FibaroEntity, LightEntity):
|
||||
# The simplest case is left for last. No dimming, just switch on
|
||||
self.call_turn_on()
|
||||
|
||||
@override
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the light off."""
|
||||
self.call_turn_off()
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Fibaro locks."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -34,19 +34,16 @@ class FibaroLock(FibaroEntity, LockEntity):
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
|
||||
@override
|
||||
def lock(self, **kwargs: Any) -> None:
|
||||
"""Lock the device."""
|
||||
self.action("secure")
|
||||
self._attr_is_locked = True
|
||||
|
||||
@override
|
||||
def unlock(self, **kwargs: Any) -> None:
|
||||
"""Unlock the device."""
|
||||
self.action("unsecure") # codespell:ignore unsecure
|
||||
self._attr_is_locked = False
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update device state."""
|
||||
super().update()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Fibaro scenes."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_scene import SceneModel
|
||||
|
||||
@@ -50,7 +50,6 @@ class FibaroScene(Scene):
|
||||
identifiers={(DOMAIN, controller.hub_serial)}
|
||||
)
|
||||
|
||||
@override
|
||||
def activate(self, **kwargs: Any) -> None:
|
||||
"""Activate the scene."""
|
||||
self._fibaro_scene.start()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Support for Fibaro sensors."""
|
||||
|
||||
from contextlib import suppress
|
||||
from typing import override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -157,7 +156,6 @@ class FibaroSensor(FibaroEntity, SensorEntity):
|
||||
fibaro_device.unit, fibaro_device.unit
|
||||
)
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
@@ -183,7 +181,6 @@ class FibaroAdditionalSensor(FibaroEntity, SensorEntity):
|
||||
self._attr_name = f"{fibaro_device.friendly_name} {entity_description.name}"
|
||||
self._attr_unique_id = f"{fibaro_device.unique_id_str}_{entity_description.key}"
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Fibaro switches."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -34,19 +34,16 @@ class FibaroSwitch(FibaroEntity, SwitchEntity):
|
||||
super().__init__(fibaro_device)
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
|
||||
|
||||
@override
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn device on."""
|
||||
self.call_turn_on()
|
||||
self._attr_is_on = True
|
||||
|
||||
@override
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn device off."""
|
||||
self.call_turn_off()
|
||||
self._attr_is_on = False
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update device state."""
|
||||
super().update()
|
||||
|
||||
@@ -6,7 +6,7 @@ https://www.fido.ca/pages/#/my-account/wireless
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfido import FidoClient
|
||||
from pyfido.client import PyFidoError
|
||||
@@ -224,7 +224,6 @@ class FidoSensor(SensorEntity):
|
||||
|
||||
self._attr_name = f"{name} {number} {description.name}"
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the state attributes of the sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for file integration."""
|
||||
|
||||
from copy import deepcopy
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -69,7 +69,6 @@ class FileConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 2
|
||||
|
||||
@override
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
@@ -84,7 +83,6 @@ class FileConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
self.hass.config.is_allowed_path, file_path
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for file notification."""
|
||||
|
||||
import os
|
||||
from typing import Any, TextIO, override
|
||||
from typing import Any, TextIO
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_TITLE_DEFAULT,
|
||||
@@ -42,7 +42,6 @@ class FileNotifyEntity(NotifyEntity):
|
||||
self._attr_name = config.get(CONF_NAME, DEFAULT_NAME)
|
||||
self._attr_unique_id = unique_id
|
||||
|
||||
@override
|
||||
def send_message(self, message: str, title: str | None = None) -> None:
|
||||
"""Send a message to a file."""
|
||||
file: TextIO
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import logging
|
||||
import pathlib
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -38,7 +38,6 @@ class FilesizeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -4,7 +4,6 @@ from datetime import datetime, timedelta
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
from typing import override
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_FILE_PATH
|
||||
@@ -56,12 +55,10 @@ class FileSizeCoordinator(DataUpdateCoordinator[dict[str, int | float | datetime
|
||||
except OSError as error:
|
||||
raise UpdateFailed(f"Can not retrieve file statistics {error}") from error
|
||||
|
||||
@override
|
||||
async def _async_setup(self) -> None:
|
||||
"""Set up path."""
|
||||
self.path = await self.hass.async_add_executor_job(self._get_full_path)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, float | int | datetime]:
|
||||
"""Fetch file information."""
|
||||
statinfo = await self.hass.async_add_executor_job(self._update)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
@@ -89,7 +88,6 @@ class FilesizeEntity(CoordinatorEntity[FileSizeCoordinator], SensorEntity):
|
||||
identifiers={(DOMAIN, entry_id)},
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | int | datetime:
|
||||
"""Return the value of the sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for filter."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -246,7 +246,6 @@ class FilterConfigFlowHandler(SchemaConfigFlowHandler, domain=DOMAIN):
|
||||
options_flow = OPTIONS_FLOW
|
||||
options_flow_reloads = True
|
||||
|
||||
@override
|
||||
def async_config_entry_title(self, options: Mapping[str, Any]) -> str:
|
||||
"""Return config entry title."""
|
||||
return cast(str, options[CONF_NAME])
|
||||
|
||||
@@ -8,7 +8,7 @@ from functools import partial
|
||||
import logging
|
||||
from numbers import Number
|
||||
import statistics
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -323,7 +323,6 @@ class SensorFilter(SensorEntity):
|
||||
if update_ha:
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
|
||||
@@ -399,7 +398,6 @@ class SensorFilter(SensorEntity):
|
||||
|
||||
self.async_on_remove(async_at_started(self.hass, _async_hass_started))
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> datetime | StateType:
|
||||
"""Return the state of the sensor."""
|
||||
@@ -428,12 +426,10 @@ class FilterState:
|
||||
value = round(float(self.state), precision)
|
||||
self.state = int(value) if precision == 0 else value
|
||||
|
||||
@override
|
||||
def __str__(self) -> str:
|
||||
"""Return state as the string representation of FilterState."""
|
||||
return str(self.state)
|
||||
|
||||
@override
|
||||
def __repr__(self) -> str:
|
||||
"""Return timestamp and state as the representation of FilterState."""
|
||||
return f"{self.timestamp} : {self.state}"
|
||||
@@ -549,7 +545,6 @@ class RangeFilter(Filter, SensorEntity):
|
||||
self._upper_bound = upper_bound
|
||||
self._stats_internal: Counter = Counter()
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the range filter."""
|
||||
|
||||
@@ -607,7 +602,6 @@ class OutlierFilter(Filter, SensorEntity):
|
||||
self._stats_internal: Counter = Counter()
|
||||
self._store_raw = True
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the outlier filter."""
|
||||
|
||||
@@ -650,7 +644,6 @@ class LowPassFilter(Filter, SensorEntity):
|
||||
)
|
||||
self._time_constant = time_constant
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the low pass filter."""
|
||||
|
||||
@@ -701,7 +694,6 @@ class TimeSMAFilter(Filter, SensorEntity):
|
||||
else:
|
||||
return
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the Simple Moving Average filter."""
|
||||
|
||||
@@ -739,7 +731,6 @@ class ThrottleFilter(Filter, SensorEntity):
|
||||
)
|
||||
self._only_numbers = False
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the throttle filter."""
|
||||
if not self.states or len(self.states) == self.states.maxlen:
|
||||
@@ -769,7 +760,6 @@ class TimeThrottleFilter(Filter, SensorEntity):
|
||||
self._last_emitted_at: datetime | None = None
|
||||
self._only_numbers = False
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the filter."""
|
||||
window_start = new_state.timestamp - self._time_window
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from contextlib import suppress
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fing_agent_api import FingAgent
|
||||
import httpx
|
||||
@@ -22,7 +22,6 @@ class FingConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from fing_agent_api import FingAgent
|
||||
from fing_agent_api.models import AgentInfoResponse, Device
|
||||
@@ -52,7 +51,6 @@ class FingDataUpdateCoordinator(DataUpdateCoordinator[FingDataObject]):
|
||||
config_entry=config_entry,
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> FingDataObject:
|
||||
"""Fetch data from Fing Agent."""
|
||||
device_response = None
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Platform for Device tracker integration."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from fing_agent_api.models import Device
|
||||
|
||||
from homeassistant.components.device_tracker import ScannerEntity
|
||||
@@ -78,25 +76,21 @@ class FingTrackedDevice(CoordinatorEntity[FingDataUpdateCoordinator], ScannerEnt
|
||||
self._attr_name = self._device.name
|
||||
self._attr_icon = get_icon_from_type(self._device.type)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_connected(self) -> bool:
|
||||
"""Return true if the device is connected to the network."""
|
||||
return self._device.active
|
||||
|
||||
@override
|
||||
@property
|
||||
def ip_address(self) -> str | None:
|
||||
"""Return the primary ip address of the device."""
|
||||
return self._device.ip[0] if self._device.ip else None
|
||||
|
||||
@override
|
||||
@property
|
||||
def entity_registry_enabled_default(self) -> bool:
|
||||
"""Enable entity by default."""
|
||||
return True
|
||||
|
||||
@override
|
||||
@property
|
||||
def unique_id(self) -> str | None:
|
||||
"""Return the unique ID of the entity."""
|
||||
@@ -115,7 +109,6 @@ class FingTrackedDevice(CoordinatorEntity[FingDataUpdateCoordinator], ScannerEnt
|
||||
or self._attr_icon != get_icon_from_type(new_device.type)
|
||||
)
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from collections import namedtuple
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
from fints.client import FinTS3PinTanClient
|
||||
from fints.models import SEPAAccount
|
||||
@@ -275,7 +275,6 @@ class FinTsHoldingsAccount(SensorEntity):
|
||||
self._holdings = bank.get_holdings(self._account)
|
||||
self._attr_native_value = sum(h.total_value for h in self._holdings)
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Additional attributes of the sensor.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfirefly import (
|
||||
Firefly,
|
||||
@@ -58,7 +58,6 @@ class FireflyConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -4,7 +4,6 @@ import asyncio
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from aiohttp import CookieJar
|
||||
from pyfirefly import (
|
||||
@@ -67,7 +66,6 @@ class FireflyDataUpdateCoordinator(DataUpdateCoordinator[FireflyCoordinatorData]
|
||||
),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_setup(self) -> None:
|
||||
"""Set up the coordinator."""
|
||||
try:
|
||||
@@ -91,7 +89,6 @@ class FireflyDataUpdateCoordinator(DataUpdateCoordinator[FireflyCoordinatorData]
|
||||
translation_placeholders={"error": repr(err)},
|
||||
) from err
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> FireflyCoordinatorData:
|
||||
"""Fetch data from Firefly III API."""
|
||||
now = datetime.now()
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Sensor platform for Firefly III integration."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfirefly.models import Account, Budget, Category
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
@@ -94,7 +92,6 @@ class FireflyAccountBalanceSensor(FireflyAccountBaseEntity, SensorEntity):
|
||||
coordinator.data.primary_currency.attributes.code
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return current account balance."""
|
||||
@@ -108,7 +105,6 @@ class FireflyAccountRoleSensor(FireflyAccountBaseEntity, SensorEntity):
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
_attr_entity_registry_enabled_default = True
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return account role."""
|
||||
@@ -143,7 +139,6 @@ class FireflyAccountTypeSensor(FireflyAccountBaseEntity, SensorEntity):
|
||||
else "mdi:bank"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return account type."""
|
||||
@@ -169,7 +164,6 @@ class FireflyCategorySensor(FireflyCategoryBaseEntity, SensorEntity):
|
||||
coordinator.data.primary_currency.attributes.code
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return net spent+earned value for this category in the period."""
|
||||
@@ -201,7 +195,6 @@ class FireflyBudgetSensor(FireflyBudgetBaseEntity, SensorEntity):
|
||||
coordinator.data.primary_currency.attributes.code
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return spent value for this budget in the period."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Binary Sensor platform for FireServiceRota integration."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -47,13 +47,11 @@ class ResponseBinarySensor(
|
||||
self._client = client
|
||||
self._attr_unique_id = f"{entry.unique_id}_Duty"
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return the state of the binary sensor."""
|
||||
return self._client.on_duty
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return available attributes for binary sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for FireServiceRota."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfireservicerota import FireServiceRota, InvalidAuthError
|
||||
import voluptuous as vol
|
||||
@@ -34,7 +34,6 @@ class FireServiceRotaFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
self._existing_entry: dict[str, Any] | None = None
|
||||
self._description_placeholders: dict[str, str] | None = None
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from pyfireservicerota import (
|
||||
ExpiredTokenError,
|
||||
@@ -52,7 +52,6 @@ class FireServiceUpdateCoordinator(DataUpdateCoordinator[dict | None]):
|
||||
|
||||
self.client = client
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict | None:
|
||||
"""Get the latest availability data."""
|
||||
return await self.client.async_update()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Sensor platform for FireServiceRota integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@@ -40,7 +40,6 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
|
||||
self._state: str | None = None
|
||||
self._state_attributes: dict[str, Any] = {}
|
||||
|
||||
@override
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return the icon to use in the frontend."""
|
||||
@@ -52,13 +51,11 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
|
||||
|
||||
return "mdi:fire-truck"
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> str | None:
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return available attributes for sensor."""
|
||||
@@ -95,7 +92,6 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
|
||||
|
||||
return attr
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Run when about to be added to hass."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Switch platform for FireServiceRota integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -54,7 +54,6 @@ class ResponseSwitch(SwitchEntity):
|
||||
self._state_attributes: dict[str, Any] = {}
|
||||
self._state_icon = None
|
||||
|
||||
@override
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return the icon to use in the frontend."""
|
||||
@@ -65,19 +64,16 @@ class ResponseSwitch(SwitchEntity):
|
||||
|
||||
return "mdi:forum"
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Get the assumed state of the switch."""
|
||||
return self._state
|
||||
|
||||
@override
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return if switch is available."""
|
||||
return self._client.on_duty
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return available attributes for switch."""
|
||||
@@ -102,12 +98,10 @@ class ResponseSwitch(SwitchEntity):
|
||||
if key in data
|
||||
}
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Send Acknowledge response status."""
|
||||
await self.async_set_response(True)
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Send Reject response status."""
|
||||
await self.async_set_response(False)
|
||||
@@ -123,7 +117,6 @@ class ResponseSwitch(SwitchEntity):
|
||||
await self._client.async_set_response(value)
|
||||
self.client_update()
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register update callback."""
|
||||
self.async_on_remove(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Support for Firmata binary sensor input."""
|
||||
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_PIN
|
||||
@@ -48,17 +47,14 @@ async def async_setup_entry(
|
||||
class FirmataBinarySensor(FirmataPinEntity, BinarySensorEntity):
|
||||
"""Representation of a binary sensor on a Firmata board."""
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Set up a binary sensor."""
|
||||
await self._api.start_pin(self.async_write_ha_state)
|
||||
|
||||
@override
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Stop reporting a binary sensor."""
|
||||
await self._api.stop_pin()
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if binary sensor is on."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Firmata light output."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -68,24 +68,20 @@ class FirmataLight(FirmataPinEntity, LightEntity):
|
||||
# Default first turn on to max
|
||||
self._last_on_level = 255
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Set up a light."""
|
||||
await self._api.start_pin()
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if light is on."""
|
||||
return self._api.state > 0
|
||||
|
||||
@override
|
||||
@property
|
||||
def brightness(self) -> int:
|
||||
"""Return the brightness of the light."""
|
||||
return self._api.state
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on light."""
|
||||
level = kwargs.get(ATTR_BRIGHTNESS, self._last_on_level)
|
||||
@@ -93,7 +89,6 @@ class FirmataLight(FirmataPinEntity, LightEntity):
|
||||
self.async_write_ha_state()
|
||||
self._last_on_level = level
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off light."""
|
||||
await self._api.set_level(0)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Support for Firmata sensor input."""
|
||||
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_PIN
|
||||
@@ -48,17 +47,14 @@ async def async_setup_entry(
|
||||
class FirmataSensor(FirmataPinEntity, SensorEntity):
|
||||
"""Representation of a sensor on a Firmata board."""
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Set up a sensor."""
|
||||
await self._api.start_pin(self.async_write_ha_state)
|
||||
|
||||
@override
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Stop reporting a sensor."""
|
||||
await self._api.stop_pin()
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> int:
|
||||
"""Return sensor state."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Support for Firmata switch output."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_PIN
|
||||
@@ -49,24 +49,20 @@ async def async_setup_entry(
|
||||
class FirmataSwitch(FirmataPinEntity, SwitchEntity):
|
||||
"""Representation of a switch on a Firmata board."""
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Set up a switch."""
|
||||
await self._api.start_pin()
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if switch is on."""
|
||||
return self._api.is_on
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on switch."""
|
||||
await self._api.turn_on()
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off switch."""
|
||||
await self._api.turn_off()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for the Fish Audio integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fishaudio import AsyncFishAudio
|
||||
from fishaudio.exceptions import AuthenticationError, FishAudioError
|
||||
@@ -168,7 +168,6 @@ class FishAudioConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Initialize the config flow."""
|
||||
self.client = None
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
@@ -217,7 +216,6 @@ class FishAudioConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
},
|
||||
)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
@callback
|
||||
def async_get_supported_subentry_types(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""TTS platform for the Fish Audio integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fishaudio.exceptions import APIError, RateLimitError
|
||||
|
||||
@@ -69,19 +69,16 @@ class FishAudioTTSEntity(TextToSpeechEntity):
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def default_language(self) -> str:
|
||||
"""Return the default language."""
|
||||
return "en"
|
||||
|
||||
@override
|
||||
@property
|
||||
def supported_languages(self) -> list[str]:
|
||||
"""Return a list of supported languages."""
|
||||
return TTS_SUPPORTED_LANGUAGES
|
||||
|
||||
@override
|
||||
async def async_get_tts_audio(
|
||||
self,
|
||||
message: str,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Awaitable, Callable
|
||||
import logging
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
from fitbit import Fitbit
|
||||
from fitbit.exceptions import HTTPException, HTTPUnauthorized
|
||||
@@ -177,7 +177,6 @@ class OAuthFitbitApi(FitbitApi):
|
||||
super().__init__(hass, unit_system)
|
||||
self._oauth_session = oauth_session
|
||||
|
||||
@override
|
||||
async def async_get_access_token(self) -> dict[str, Any]:
|
||||
"""Return a valid access token for the Fitbit API."""
|
||||
await self._oauth_session.async_ensure_token_valid()
|
||||
@@ -199,7 +198,6 @@ class ConfigFlowFitbitApi(FitbitApi):
|
||||
super().__init__(hass)
|
||||
self._token = token
|
||||
|
||||
@override
|
||||
async def async_get_access_token(self) -> dict[str, Any]:
|
||||
"""Return the token for the Fitbit API."""
|
||||
return self._token
|
||||
|
||||
@@ -7,7 +7,7 @@ details on Fitbit authorization.
|
||||
import base64
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
from typing import Any, cast, override
|
||||
from typing import Any, cast
|
||||
|
||||
import aiohttp
|
||||
|
||||
@@ -33,7 +33,6 @@ class FitbitOAuth2Implementation(AuthImplementation):
|
||||
Authorization header.
|
||||
"""
|
||||
|
||||
@override
|
||||
async def async_resolve_external_data(self, external_data: dict[str, Any]) -> dict:
|
||||
"""Resolve the authorization code to tokens."""
|
||||
return await self._post(
|
||||
@@ -44,7 +43,6 @@ class FitbitOAuth2Implementation(AuthImplementation):
|
||||
}
|
||||
)
|
||||
|
||||
@override
|
||||
async def _token_request(self, data: dict) -> dict:
|
||||
"""Make a token request."""
|
||||
return await self._post(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult
|
||||
from homeassistant.const import CONF_TOKEN
|
||||
@@ -22,13 +22,11 @@ class OAuth2FlowHandler(
|
||||
|
||||
DOMAIN = DOMAIN
|
||||
|
||||
@override
|
||||
@property
|
||||
def logger(self) -> logging.Logger:
|
||||
"""Return logger."""
|
||||
return logging.getLogger(__name__)
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_authorize_data(self) -> dict[str, str]:
|
||||
"""Extra data that needs to be appended to the authorize url."""
|
||||
@@ -51,7 +49,6 @@ class OAuth2FlowHandler(
|
||||
return self.async_show_form(step_id="reauth_confirm")
|
||||
return await self.async_step_user()
|
||||
|
||||
@override
|
||||
async def async_step_creation(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
@@ -70,7 +67,6 @@ class OAuth2FlowHandler(
|
||||
_LOGGER.error("Failed to create Fitbit credentials: %s", err)
|
||||
return self.async_abort(reason="cannot_connect")
|
||||
|
||||
@override
|
||||
async def async_oauth_create_entry(self, data: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Create an entry for the flow, or update existing entry."""
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import asyncio
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Final, override
|
||||
from typing import Final
|
||||
|
||||
from fitbit_web_api.models.device import Device
|
||||
|
||||
@@ -42,7 +42,6 @@ class FitbitDeviceCoordinator(DataUpdateCoordinator[dict[str, Device]]):
|
||||
)
|
||||
self._api = api
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, Device]:
|
||||
"""Fetch data from API endpoint."""
|
||||
async with asyncio.timeout(TIMEOUT):
|
||||
|
||||
@@ -4,7 +4,7 @@ from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Any, Final, cast, override
|
||||
from typing import Any, Final, cast
|
||||
|
||||
from fitbit_web_api.models.device import Device
|
||||
|
||||
@@ -638,7 +638,6 @@ class FitbitSensor(SensorEntity):
|
||||
self._attr_available = True
|
||||
self._attr_native_value = self.entity_description.value_fn(result)
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""When entity is added to hass."""
|
||||
await super().async_added_to_hass()
|
||||
@@ -677,7 +676,6 @@ class FitbitBatterySensor(CoordinatorEntity[FitbitDeviceCoordinator], SensorEnti
|
||||
if enable_default_override:
|
||||
self._attr_entity_registry_enabled_default = True
|
||||
|
||||
@override
|
||||
@property
|
||||
def icon(self) -> str | None:
|
||||
"""Icon to use in the frontend, if any."""
|
||||
@@ -687,7 +685,6 @@ class FitbitBatterySensor(CoordinatorEntity[FitbitDeviceCoordinator], SensorEnti
|
||||
return icon_for_battery_level(battery_level=battery_level)
|
||||
return self.entity_description.icon
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, str | None]:
|
||||
"""Return the state attributes."""
|
||||
@@ -696,13 +693,11 @@ class FitbitBatterySensor(CoordinatorEntity[FitbitDeviceCoordinator], SensorEnti
|
||||
"type": self.device.type.lower() if self.device.type is not None else None,
|
||||
}
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""When entity is added to hass update state from existing coordinator data."""
|
||||
await super().async_added_to_hass()
|
||||
self._handle_coordinator_update()
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
@@ -738,13 +733,11 @@ class FitbitBatteryLevelSensor(
|
||||
model=device.device_version,
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""When entity is added to hass update state from existing coordinator data."""
|
||||
await super().async_added_to_hass()
|
||||
self._handle_coordinator_update()
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""The FiveM binary sensor platform."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
@@ -50,7 +49,6 @@ class FiveMSensorEntity(FiveMEntity, BinarySensorEntity):
|
||||
|
||||
entity_description: FiveMBinarySensorEntityDescription
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return the state of the sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for FiveM integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fivem import FiveM, FiveMServerOfflineError
|
||||
import voluptuous as vol
|
||||
@@ -40,7 +40,6 @@ class FiveMConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fivem import FiveM, FiveMServerOfflineError
|
||||
|
||||
@@ -58,7 +58,6 @@ class FiveMDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
self.version = info["version"]
|
||||
self.game_name = info["vars"]["gamename"]
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Get server data from 3rd party library and update properties."""
|
||||
try:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import EntityDescription
|
||||
@@ -47,7 +47,6 @@ class FiveMEntity(CoordinatorEntity[FiveMDataUpdateCoordinator]):
|
||||
sw_version=self.coordinator.version,
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> Mapping[str, Any] | None:
|
||||
"""Return the extra attributes of the sensor."""
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""The FiveM sensor platform."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -67,7 +66,6 @@ class FiveMSensorEntity(FiveMEntity, SensorEntity):
|
||||
|
||||
entity_description: FiveMSensorEntityDescription
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the state of the sensor."""
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fixerio import Fixerio
|
||||
from fixerio.exceptions import FixerioException
|
||||
@@ -72,25 +72,21 @@ class ExchangeRateSensor(SensorEntity):
|
||||
self._name = name
|
||||
self._state = None
|
||||
|
||||
@override
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return self._name
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return self._target
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
||||
"""Return the state attributes."""
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import Device
|
||||
|
||||
@@ -85,7 +84,6 @@ class BinarySensor(CoordinatorEntity[FjaraskupanCoordinator], BinarySensorEntity
|
||||
self._attr_unique_id = f"{device.address}-{entity_description.key}"
|
||||
self._attr_device_info = device_info
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
"""Return true if the binary sensor is on."""
|
||||
|
||||
@@ -4,7 +4,6 @@ from collections.abc import AsyncGenerator
|
||||
from contextlib import asynccontextmanager, contextmanager
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import (
|
||||
Device,
|
||||
@@ -88,7 +87,6 @@ class FjaraskupanCoordinator(DataUpdateCoordinator[State]):
|
||||
update_interval=timedelta(seconds=120),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_refresh(
|
||||
self,
|
||||
log_failures: bool = True,
|
||||
@@ -104,7 +102,6 @@ class FjaraskupanCoordinator(DataUpdateCoordinator[State]):
|
||||
raise_on_entry_error=raise_on_entry_error,
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> State:
|
||||
"""Handle an explicit update request."""
|
||||
if self._refresh_was_scheduled:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Fjäråskupan fans."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from fjaraskupan import (
|
||||
COMMAND_AFTERCOOKINGTIMERAUTO,
|
||||
@@ -86,7 +86,6 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
||||
self._preset_mode = PRESET_MODE_NORMAL
|
||||
self._update_from_device_data(coordinator.data)
|
||||
|
||||
@override
|
||||
async def async_set_percentage(self, percentage: int) -> None:
|
||||
"""Set speed."""
|
||||
|
||||
@@ -102,7 +101,6 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
||||
)
|
||||
await device.send_fan_speed(int(new_speed))
|
||||
|
||||
@override
|
||||
async def async_turn_on(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
@@ -135,44 +133,37 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
||||
elif preset_mode == PRESET_MODE_AFTER_COOKING_AUTO:
|
||||
await device.send_after_cooking(0)
|
||||
|
||||
@override
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set new preset mode."""
|
||||
command = PRESET_TO_COMMAND[preset_mode]
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
await device.send_command(command)
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the entity off."""
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
await device.send_command(COMMAND_STOP_FAN)
|
||||
|
||||
@override
|
||||
@property
|
||||
def speed_count(self) -> int:
|
||||
"""Return the number of speeds the fan supports."""
|
||||
return len(ORDERED_NAMED_FAN_SPEEDS)
|
||||
|
||||
@override
|
||||
@property
|
||||
def percentage(self) -> int | None:
|
||||
"""Return the current speed."""
|
||||
return self._percentage
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if fan is on."""
|
||||
return self._percentage != 0
|
||||
|
||||
@override
|
||||
@property
|
||||
def preset_mode(self) -> str | None:
|
||||
"""Return the current preset mode."""
|
||||
return self._preset_mode
|
||||
|
||||
@override
|
||||
@property
|
||||
def preset_modes(self) -> list[str] | None:
|
||||
"""Return a list of available preset modes."""
|
||||
@@ -199,7 +190,6 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
||||
else:
|
||||
self._preset_mode = PRESET_MODE_NORMAL
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle data update."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for lights."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -44,7 +44,6 @@ class Light(CoordinatorEntity[FjaraskupanCoordinator], LightEntity):
|
||||
self._attr_unique_id = coordinator.device.address
|
||||
self._attr_device_info = device_info
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the light on."""
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
@@ -53,14 +52,12 @@ class Light(CoordinatorEntity[FjaraskupanCoordinator], LightEntity):
|
||||
else:
|
||||
await device.send_dim(100)
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the entity off."""
|
||||
if self.is_on:
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
await device.send_dim(0)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return True if entity is on."""
|
||||
@@ -68,7 +65,6 @@ class Light(CoordinatorEntity[FjaraskupanCoordinator], LightEntity):
|
||||
return data.light_on
|
||||
return False
|
||||
|
||||
@override
|
||||
@property
|
||||
def brightness(self) -> int | None:
|
||||
"""Return the brightness of this light between 0..255."""
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Support for sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.number import NumberEntity
|
||||
from homeassistant.const import EntityCategory, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -51,7 +49,6 @@ class PeriodicVentingTime(CoordinatorEntity[FjaraskupanCoordinator], NumberEntit
|
||||
self._attr_unique_id = f"{coordinator.device.address}-periodic-venting"
|
||||
self._attr_device_info = device_info
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the entity value to represent the entity state."""
|
||||
@@ -59,7 +56,6 @@ class PeriodicVentingTime(CoordinatorEntity[FjaraskupanCoordinator], NumberEntit
|
||||
return data.periodic_venting
|
||||
return None
|
||||
|
||||
@override
|
||||
async def async_set_native_value(self, value: float) -> None:
|
||||
"""Set new value."""
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Support for sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import Device
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
@@ -55,7 +53,6 @@ class RssiSensor(CoordinatorEntity[FjaraskupanCoordinator], SensorEntity):
|
||||
self._attr_unique_id = f"{device.address}-signal-strength"
|
||||
self._attr_device_info = device_info
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the value reported by the sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Platform for Flexit AC units with CI66 Modbus adapter."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -139,7 +139,6 @@ class Flexit(ClimateEntity):
|
||||
else:
|
||||
self._attr_hvac_action = HVACAction.OFF
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return device specific state attributes."""
|
||||
@@ -153,7 +152,6 @@ class Flexit(ClimateEntity):
|
||||
"outdoor_air_temp": self._outdoor_air_temp,
|
||||
}
|
||||
|
||||
@override
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if (target_temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||
@@ -165,7 +163,6 @@ class Flexit(ClimateEntity):
|
||||
else:
|
||||
_LOGGER.error("Modbus error setting target temperature to Flexit")
|
||||
|
||||
@override
|
||||
async def async_set_fan_mode(self, fan_mode: str) -> None:
|
||||
"""Set new fan mode."""
|
||||
if self.fan_modes and await self._async_write_int16_to_register(
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
|
||||
@@ -70,7 +69,6 @@ class FlexitBinarySensor(FlexitEntity, BinarySensorEntity):
|
||||
f"{coordinator.device.serial_number}-{entity_description.key}"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return value of binary sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""The Flexit Nordic (BACnet) integration."""
|
||||
|
||||
import asyncio.exceptions
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from flexit_bacnet import (
|
||||
OPERATION_MODE_FIREPLACE,
|
||||
@@ -85,7 +85,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
super().__init__(coordinator)
|
||||
self._attr_unique_id = coordinator.device.serial_number
|
||||
|
||||
@override
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction | None:
|
||||
"""Return current HVAC action."""
|
||||
@@ -93,13 +92,11 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
return HVACAction.HEATING
|
||||
return HVACAction.FAN
|
||||
|
||||
@override
|
||||
@property
|
||||
def current_temperature(self) -> float:
|
||||
"""Return the current temperature."""
|
||||
return self.device.room_temperature
|
||||
|
||||
@override
|
||||
@property
|
||||
def target_temperature(self) -> float:
|
||||
"""Return the temperature we try to reach."""
|
||||
@@ -108,7 +105,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
|
||||
return self.device.air_temp_setpoint_home
|
||||
|
||||
@override
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||
@@ -134,7 +130,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
finally:
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
@property
|
||||
def preset_mode(self) -> str:
|
||||
"""Return the current preset mode, e.g., home, away, temp.
|
||||
@@ -143,7 +138,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
"""
|
||||
return OPERATION_TO_PRESET_MODE_MAP[self.device.operation_mode]
|
||||
|
||||
@override
|
||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set new preset mode."""
|
||||
try:
|
||||
@@ -174,7 +168,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
finally:
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
"""Return hvac operation ie. heat, cool mode."""
|
||||
@@ -183,7 +176,6 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
|
||||
return HVACMode.FAN_ONLY
|
||||
|
||||
@override
|
||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set new target hvac mode."""
|
||||
try:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import asyncio.exceptions
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -30,7 +30,6 @@ class FlexitBacnetConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import asyncio.exceptions
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -41,7 +40,6 @@ class FlexitCoordinator(DataUpdateCoordinator[FlexitBACnet]):
|
||||
self.config_entry.data[CONF_DEVICE_ID],
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> FlexitBACnet:
|
||||
"""Fetch data from the device."""
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import asyncio.exceptions
|
||||
from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -229,25 +228,21 @@ class FlexitNumber(FlexitEntity, NumberEntity):
|
||||
f"{coordinator.device.serial_number}-{entity_description.key}"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float:
|
||||
"""Return the state of the number."""
|
||||
return self.entity_description.native_value_fn(self.coordinator.device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_max_value(self) -> float:
|
||||
"""Return the native max value of the number."""
|
||||
return self.entity_description.native_max_value_fn(self.coordinator.device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_min_value(self) -> float:
|
||||
"""Return the native min value of the number."""
|
||||
return self.entity_description.native_min_value_fn(self.coordinator.device)
|
||||
|
||||
@override
|
||||
async def async_set_native_value(self, value: float) -> None:
|
||||
"""Update the current value."""
|
||||
set_native_value_fn = self.entity_description.set_native_value_fn(
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
|
||||
@@ -189,7 +188,6 @@ class FlexitSensor(FlexitEntity, SensorEntity):
|
||||
f"{coordinator.device.serial_number}-{entity_description.key}"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return value of sensor."""
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import asyncio.exceptions
|
||||
from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -129,13 +129,11 @@ class FlexitSwitch(FlexitEntity, SwitchEntity):
|
||||
f"{coordinator.device.serial_number}-{entity_description.key}"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return value of the switch."""
|
||||
return self.entity_description.is_on_fn(self.coordinator.data)
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn switch on."""
|
||||
try:
|
||||
@@ -151,7 +149,6 @@ class FlexitSwitch(FlexitEntity, SwitchEntity):
|
||||
finally:
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn switch off."""
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Support for Flipr binary sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
@@ -46,7 +44,6 @@ async def async_setup_entry(
|
||||
class FliprBinarySensor(FliprEntity, BinarySensorEntity):
|
||||
"""Representation of Flipr binary sensors."""
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if the binary sensor is on in case of a Problem is detected."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Config flow for Flipr integration."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from flipr_api import FliprAPIRestClient
|
||||
from requests.exceptions import HTTPError, Timeout
|
||||
@@ -27,7 +27,6 @@ class FliprConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 2
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from flipr_api import FliprAPIRestClient
|
||||
from flipr_api.exceptions import FliprError
|
||||
@@ -54,7 +54,6 @@ class BaseDataUpdateCoordinator[_DataT](DataUpdateCoordinator[_DataT]):
|
||||
class FliprDataUpdateCoordinator(BaseDataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Class to hold Flipr data retrieval."""
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Fetch data from API endpoint."""
|
||||
try:
|
||||
@@ -70,7 +69,6 @@ class FliprDataUpdateCoordinator(BaseDataUpdateCoordinator[dict[str, Any]]):
|
||||
class FliprHubDataUpdateCoordinator(BaseDataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Class to hold Flipr hub data retrieval."""
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Fetch data from API endpoint."""
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Select platform for the Flipr's Hub."""
|
||||
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -39,14 +38,12 @@ async def async_setup_entry(
|
||||
class FliprHubSelect(FliprEntity, SelectEntity):
|
||||
"""Select representing Hub mode."""
|
||||
|
||||
@override
|
||||
@property
|
||||
def current_option(self) -> str | None:
|
||||
"""Return current select option."""
|
||||
_LOGGER.debug("coordinator data = %s", self.coordinator.data)
|
||||
return self.coordinator.data["mode"]
|
||||
|
||||
@override
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Select new mode for Hub."""
|
||||
_LOGGER.debug("Changing mode of %s to %s", self.device_id, option)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"""Sensor platform for the Flipr's pool_sensor."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@@ -72,7 +70,6 @@ async def async_setup_entry(
|
||||
class FliprSensor(FliprEntity, SensorEntity):
|
||||
"""Sensor representing FliprSensor data."""
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> str:
|
||||
"""State of the sensor."""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Switch platform for the Flipr's Hub."""
|
||||
|
||||
import logging
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -38,14 +38,12 @@ async def async_setup_entry(
|
||||
class FliprHubSwitch(FliprEntity, SwitchEntity):
|
||||
"""Switch representing Hub state."""
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return state of the switch."""
|
||||
_LOGGER.debug("coordinator data = %s", self.coordinator.data)
|
||||
return self.coordinator.data["state"]
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off the switch."""
|
||||
_LOGGER.debug("Switching off %s", self.device_id)
|
||||
@@ -57,7 +55,6 @@ class FliprHubSwitch(FliprEntity, SwitchEntity):
|
||||
_LOGGER.debug("New hub infos are %s", data)
|
||||
self.coordinator.async_set_updated_data(data)
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the switch."""
|
||||
_LOGGER.debug("Switching on %s", self.device_id)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Support for Flo Water Monitor binary sensors."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
@@ -48,13 +48,11 @@ class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
|
||||
"""Initialize the pending alerts binary sensor."""
|
||||
super().__init__("pending_system_alerts", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if the Flo device has pending alerts."""
|
||||
return self._device.has_alerts
|
||||
|
||||
@override
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the state attributes."""
|
||||
@@ -77,7 +75,6 @@ class FloWaterDetectedBinarySensor(FloEntity, BinarySensorEntity):
|
||||
"""Initialize the pending alerts binary sensor."""
|
||||
super().__init__("water_detected", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if the Flo device is detecting water."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Config flow for flo integration."""
|
||||
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from aioflo import async_get_api
|
||||
from aioflo.errors import RequestError
|
||||
@@ -38,7 +38,6 @@ class FloConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, override
|
||||
from typing import Any
|
||||
|
||||
from aioflo.api import API
|
||||
from aioflo.errors import RequestError
|
||||
@@ -57,7 +57,6 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
update_interval=timedelta(seconds=60),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self):
|
||||
"""Update data via library."""
|
||||
try:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user