mirror of
https://github.com/home-assistant/core.git
synced 2026-05-25 18:25:10 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29c18f431c |
@@ -2,7 +2,7 @@
|
||||
|
||||
from collections.abc import Callable, Mapping
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from faadelays import Airport
|
||||
|
||||
@@ -121,11 +121,13 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from aiohttp import ClientConnectionError
|
||||
import faadelays
|
||||
@@ -23,6 +23,7 @@ class FAADelaysConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from aiohttp import ClientConnectionError
|
||||
from faadelays import Airport
|
||||
@@ -34,6 +35,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
@@ -45,6 +45,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -69,16 +69,19 @@ 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,5 +1,7 @@
|
||||
"""Family Hub camera for Samsung Refrigerators."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfamilyhublocal import FamilyHubCam
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -50,12 +52,14 @@ 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
|
||||
from typing import Any, final, override
|
||||
|
||||
from propcache.api import cached_property
|
||||
import voluptuous as vol
|
||||
@@ -288,6 +288,7 @@ 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,
|
||||
@@ -309,6 +310,7 @@ 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,
|
||||
@@ -333,6 +335,7 @@ 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."""
|
||||
@@ -365,6 +368,7 @@ 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."""
|
||||
@@ -379,6 +383,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
|
||||
return attrs
|
||||
|
||||
@override
|
||||
@final
|
||||
@property
|
||||
def state_attributes(self) -> dict[str, float | str | None]:
|
||||
@@ -403,6 +408,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
|
||||
@@ -12,6 +12,7 @@ class FastdotcomConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""DataUpdateCoordinator for the Fast.com integration."""
|
||||
|
||||
from datetime import timedelta
|
||||
from typing import override
|
||||
|
||||
from fastdotcom import fast_com
|
||||
|
||||
@@ -26,6 +27,7 @@ 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,5 +1,7 @@
|
||||
"""Support for Fast.com internet speed testing sensor."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@@ -46,6 +48,7 @@ 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
|
||||
from typing import Any, override
|
||||
import urllib.error
|
||||
|
||||
import feedparser
|
||||
@@ -38,6 +38,7 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
@@ -69,6 +70,7 @@ 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
|
||||
from typing import TYPE_CHECKING, override
|
||||
from urllib.error import URLError
|
||||
|
||||
import feedparser
|
||||
@@ -114,6 +114,7 @@ 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,6 +2,7 @@
|
||||
|
||||
import html
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from feedparser import FeedParserDict
|
||||
|
||||
@@ -61,6 +62,7 @@ class FeedReaderEvent(CoordinatorEntity[FeedReaderCoordinator], EventEntity):
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
@override
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle updated data from the coordinator."""
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import asyncio
|
||||
import re
|
||||
from typing import override
|
||||
|
||||
from haffmpeg.core import HAFFmpeg
|
||||
from haffmpeg.tools import IMAGE_JPEG, FFVersion, ImageFrame
|
||||
@@ -150,6 +151,7 @@ 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.
|
||||
|
||||
@@ -174,6 +176,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from aiohttp import web
|
||||
from haffmpeg.camera import CameraMjpeg
|
||||
@@ -63,10 +63,12 @@ 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:
|
||||
@@ -78,6 +80,7 @@ class FFmpegCamera(Camera):
|
||||
extra_cmd=self._extra_arguments,
|
||||
)
|
||||
|
||||
@override
|
||||
async def handle_async_mjpeg_stream(
|
||||
self, request: web.Request
|
||||
) -> web.StreamResponse:
|
||||
@@ -97,6 +100,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from haffmpeg.core import HAFFmpeg
|
||||
import haffmpeg.sensor as ffmpeg_sensor
|
||||
@@ -85,11 +85,13 @@ 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."""
|
||||
@@ -106,6 +108,7 @@ 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.
|
||||
|
||||
@@ -128,6 +131,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import haffmpeg.sensor as ffmpeg_sensor
|
||||
import voluptuous as vol
|
||||
@@ -74,6 +74,7 @@ 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.
|
||||
|
||||
@@ -94,6 +95,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -72,11 +72,13 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -209,6 +209,7 @@ 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(
|
||||
@@ -233,6 +234,7 @@ 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."""
|
||||
@@ -241,6 +243,7 @@ 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:
|
||||
@@ -261,6 +264,7 @@ 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."""
|
||||
@@ -274,6 +278,7 @@ 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:
|
||||
@@ -291,6 +296,7 @@ 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."""
|
||||
@@ -304,6 +310,7 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
|
||||
return None
|
||||
|
||||
@override
|
||||
@property
|
||||
def preset_mode(self) -> str | None:
|
||||
"""Return the current preset mode, e.g., home, away, temp.
|
||||
@@ -327,6 +334,7 @@ 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:
|
||||
@@ -343,6 +351,7 @@ class FibaroThermostat(FibaroEntity, ClimateEntity):
|
||||
"setMode", [HA_OPMODES_PRESET[preset_mode]]
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
@@ -353,6 +362,7 @@ 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."""
|
||||
@@ -363,6 +373,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_client import FibaroAuthenticationFailed, FibaroConnectFailed
|
||||
from slugify import slugify
|
||||
@@ -62,6 +62,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -56,6 +56,7 @@ class PositionableFibaroCover(FibaroEntity, CoverEntity):
|
||||
return 100
|
||||
return position
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
@@ -75,30 +76,37 @@ 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")
|
||||
@@ -124,6 +132,7 @@ 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()
|
||||
@@ -138,26 +147,32 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -32,6 +32,7 @@ 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(
|
||||
@@ -99,6 +100,7 @@ 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,5 +1,7 @@
|
||||
"""Support for Fibaro event entities."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel, SceneEvent
|
||||
from pyfibaro.fibaro_state_resolver import FibaroEvent
|
||||
|
||||
@@ -53,6 +55,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -100,6 +100,7 @@ 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:
|
||||
@@ -124,10 +125,12 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -34,16 +34,19 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_scene import SceneModel
|
||||
|
||||
@@ -50,6 +50,7 @@ class FibaroScene(Scene):
|
||||
identifiers={(DOMAIN, controller.hub_serial)}
|
||||
)
|
||||
|
||||
@override
|
||||
def activate(self, **kwargs: Any) -> None:
|
||||
"""Activate the scene."""
|
||||
self._fibaro_scene.start()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Support for Fibaro sensors."""
|
||||
|
||||
from contextlib import suppress
|
||||
from typing import override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -156,6 +157,7 @@ class FibaroSensor(FibaroEntity, SensorEntity):
|
||||
fibaro_device.unit, fibaro_device.unit
|
||||
)
|
||||
|
||||
@override
|
||||
def update(self) -> None:
|
||||
"""Update the state."""
|
||||
super().update()
|
||||
@@ -181,6 +183,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfibaro.fibaro_device import DeviceModel
|
||||
|
||||
@@ -34,16 +34,19 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfido import FidoClient
|
||||
from pyfido.client import PyFidoError
|
||||
@@ -224,6 +224,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -69,6 +69,7 @@ class FileConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 2
|
||||
|
||||
@override
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
@@ -83,6 +84,7 @@ 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
|
||||
from typing import Any, TextIO, override
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_TITLE_DEFAULT,
|
||||
@@ -42,6 +42,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -38,6 +38,7 @@ class FilesizeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -4,6 +4,7 @@ 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
|
||||
@@ -55,10 +56,12 @@ 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,6 +2,7 @@
|
||||
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
@@ -88,6 +89,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -246,6 +246,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -323,6 +323,7 @@ class SensorFilter(SensorEntity):
|
||||
if update_ha:
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
|
||||
@@ -398,6 +399,7 @@ 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."""
|
||||
@@ -426,10 +428,12 @@ 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}"
|
||||
@@ -545,6 +549,7 @@ 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."""
|
||||
|
||||
@@ -602,6 +607,7 @@ 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."""
|
||||
|
||||
@@ -644,6 +650,7 @@ class LowPassFilter(Filter, SensorEntity):
|
||||
)
|
||||
self._time_constant = time_constant
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the low pass filter."""
|
||||
|
||||
@@ -694,6 +701,7 @@ class TimeSMAFilter(Filter, SensorEntity):
|
||||
else:
|
||||
return
|
||||
|
||||
@override
|
||||
def _filter_state(self, new_state: FilterState) -> FilterState:
|
||||
"""Implement the Simple Moving Average filter."""
|
||||
|
||||
@@ -731,6 +739,7 @@ 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:
|
||||
@@ -760,6 +769,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fing_agent_api import FingAgent
|
||||
import httpx
|
||||
@@ -22,6 +22,7 @@ class FingConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
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
|
||||
@@ -51,6 +52,7 @@ 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,5 +1,7 @@
|
||||
"""Platform for Device tracker integration."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from fing_agent_api.models import Device
|
||||
|
||||
from homeassistant.components.device_tracker import ScannerEntity
|
||||
@@ -76,21 +78,25 @@ 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."""
|
||||
@@ -109,6 +115,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
from fints.client import FinTS3PinTanClient
|
||||
from fints.models import SEPAAccount
|
||||
@@ -275,6 +275,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfirefly import (
|
||||
Firefly,
|
||||
@@ -58,6 +58,7 @@ class FireflyConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -4,6 +4,7 @@ import asyncio
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from aiohttp import CookieJar
|
||||
from pyfirefly import (
|
||||
@@ -66,6 +67,7 @@ class FireflyDataUpdateCoordinator(DataUpdateCoordinator[FireflyCoordinatorData]
|
||||
),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_setup(self) -> None:
|
||||
"""Set up the coordinator."""
|
||||
try:
|
||||
@@ -89,6 +91,7 @@ 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,5 +1,7 @@
|
||||
"""Sensor platform for Firefly III integration."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from pyfirefly.models import Account, Budget, Category
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
@@ -92,6 +94,7 @@ class FireflyAccountBalanceSensor(FireflyAccountBaseEntity, SensorEntity):
|
||||
coordinator.data.primary_currency.attributes.code
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return current account balance."""
|
||||
@@ -105,6 +108,7 @@ 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."""
|
||||
@@ -139,6 +143,7 @@ class FireflyAccountTypeSensor(FireflyAccountBaseEntity, SensorEntity):
|
||||
else "mdi:bank"
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return account type."""
|
||||
@@ -164,6 +169,7 @@ 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."""
|
||||
@@ -195,6 +201,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -47,11 +47,13 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfireservicerota import FireServiceRota, InvalidAuthError
|
||||
import voluptuous as vol
|
||||
@@ -34,6 +34,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from pyfireservicerota import (
|
||||
ExpiredTokenError,
|
||||
@@ -52,6 +52,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@@ -40,6 +40,7 @@ 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."""
|
||||
@@ -51,11 +52,13 @@ 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."""
|
||||
@@ -92,6 +95,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -54,6 +54,7 @@ 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."""
|
||||
@@ -64,16 +65,19 @@ 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."""
|
||||
@@ -98,10 +102,12 @@ 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)
|
||||
@@ -117,6 +123,7 @@ 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,6 +1,7 @@
|
||||
"""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
|
||||
@@ -47,14 +48,17 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -68,20 +68,24 @@ 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)
|
||||
@@ -89,6 +93,7 @@ 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,6 +1,7 @@
|
||||
"""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
|
||||
@@ -47,14 +48,17 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_PIN
|
||||
@@ -49,20 +49,24 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fishaudio import AsyncFishAudio
|
||||
from fishaudio.exceptions import AuthenticationError, FishAudioError
|
||||
@@ -168,6 +168,7 @@ 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:
|
||||
@@ -216,6 +217,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fishaudio.exceptions import APIError, RateLimitError
|
||||
|
||||
@@ -69,16 +69,19 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
from fitbit import Fitbit
|
||||
from fitbit.exceptions import HTTPException, HTTPUnauthorized
|
||||
@@ -177,6 +177,7 @@ 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()
|
||||
@@ -198,6 +199,7 @@ 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
|
||||
from typing import Any, cast, override
|
||||
|
||||
import aiohttp
|
||||
|
||||
@@ -33,6 +33,7 @@ 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(
|
||||
@@ -43,6 +44,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult
|
||||
from homeassistant.const import CONF_TOKEN
|
||||
@@ -22,11 +22,13 @@ 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."""
|
||||
@@ -49,6 +51,7 @@ 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:
|
||||
@@ -67,6 +70,7 @@ 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
|
||||
from typing import Final, override
|
||||
|
||||
from fitbit_web_api.models.device import Device
|
||||
|
||||
@@ -42,6 +42,7 @@ 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
|
||||
from typing import Any, Final, cast, override
|
||||
|
||||
from fitbit_web_api.models.device import Device
|
||||
|
||||
@@ -638,6 +638,7 @@ 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()
|
||||
@@ -676,6 +677,7 @@ 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."""
|
||||
@@ -685,6 +687,7 @@ 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."""
|
||||
@@ -693,11 +696,13 @@ 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."""
|
||||
@@ -733,11 +738,13 @@ 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,6 +1,7 @@
|
||||
"""The FiveM binary sensor platform."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
@@ -49,6 +50,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fivem import FiveM, FiveMServerOfflineError
|
||||
import voluptuous as vol
|
||||
@@ -40,6 +40,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fivem import FiveM, FiveMServerOfflineError
|
||||
|
||||
@@ -58,6 +58,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import EntityDescription
|
||||
@@ -47,6 +47,7 @@ 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,6 +1,7 @@
|
||||
"""The FiveM sensor platform."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -66,6 +67,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fixerio import Fixerio
|
||||
from fixerio.exceptions import FixerioException
|
||||
@@ -72,21 +72,25 @@ 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,6 +2,7 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import Device
|
||||
|
||||
@@ -84,6 +85,7 @@ 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,6 +4,7 @@ from collections.abc import AsyncGenerator
|
||||
from contextlib import asynccontextmanager, contextmanager
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import (
|
||||
Device,
|
||||
@@ -87,6 +88,7 @@ class FjaraskupanCoordinator(DataUpdateCoordinator[State]):
|
||||
update_interval=timedelta(seconds=120),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_refresh(
|
||||
self,
|
||||
log_failures: bool = True,
|
||||
@@ -102,6 +104,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from fjaraskupan import (
|
||||
COMMAND_AFTERCOOKINGTIMERAUTO,
|
||||
@@ -86,6 +86,7 @@ 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."""
|
||||
|
||||
@@ -101,6 +102,7 @@ class Fan(CoordinatorEntity[FjaraskupanCoordinator], FanEntity):
|
||||
)
|
||||
await device.send_fan_speed(int(new_speed))
|
||||
|
||||
@override
|
||||
async def async_turn_on(
|
||||
self,
|
||||
percentage: int | None = None,
|
||||
@@ -133,37 +135,44 @@ 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."""
|
||||
@@ -190,6 +199,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -44,6 +44,7 @@ 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:
|
||||
@@ -52,12 +53,14 @@ 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."""
|
||||
@@ -65,6 +68,7 @@ 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,5 +1,7 @@
|
||||
"""Support for sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.number import NumberEntity
|
||||
from homeassistant.const import EntityCategory, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -49,6 +51,7 @@ 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."""
|
||||
@@ -56,6 +59,7 @@ 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,5 +1,7 @@
|
||||
"""Support for sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from fjaraskupan import Device
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
@@ -53,6 +55,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -139,6 +139,7 @@ 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."""
|
||||
@@ -152,6 +153,7 @@ 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:
|
||||
@@ -163,6 +165,7 @@ 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,6 +2,7 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
|
||||
@@ -69,6 +70,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from flexit_bacnet import (
|
||||
OPERATION_MODE_FIREPLACE,
|
||||
@@ -85,6 +85,7 @@ 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."""
|
||||
@@ -92,11 +93,13 @@ 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."""
|
||||
@@ -105,6 +108,7 @@ 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:
|
||||
@@ -130,6 +134,7 @@ 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.
|
||||
@@ -138,6 +143,7 @@ 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:
|
||||
@@ -168,6 +174,7 @@ class FlexitClimateEntity(FlexitEntity, ClimateEntity):
|
||||
finally:
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
"""Return hvac operation ie. heat, cool mode."""
|
||||
@@ -176,6 +183,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -30,6 +30,7 @@ class FlexitBacnetConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
VERSION = 1
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import asyncio.exceptions
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -40,6 +41,7 @@ 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,6 +3,7 @@
|
||||
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
|
||||
@@ -228,21 +229,25 @@ 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,6 +2,7 @@
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
|
||||
@@ -188,6 +189,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from flexit_bacnet import FlexitBACnet
|
||||
from flexit_bacnet.bacnet import DecodingError
|
||||
@@ -129,11 +129,13 @@ 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:
|
||||
@@ -149,6 +151,7 @@ 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,5 +1,7 @@
|
||||
"""Support for Flipr binary sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
@@ -44,6 +46,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from flipr_api import FliprAPIRestClient
|
||||
from requests.exceptions import HTTPError, Timeout
|
||||
@@ -27,6 +27,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from flipr_api import FliprAPIRestClient
|
||||
from flipr_api.exceptions import FliprError
|
||||
@@ -54,6 +54,7 @@ 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:
|
||||
@@ -69,6 +70,7 @@ 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,6 +1,7 @@
|
||||
"""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
|
||||
@@ -38,12 +39,14 @@ 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,5 +1,7 @@
|
||||
"""Sensor platform for the Flipr's pool_sensor."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@@ -70,6 +72,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -38,12 +38,14 @@ 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)
|
||||
@@ -55,6 +57,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
@@ -48,11 +48,13 @@ 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."""
|
||||
@@ -75,6 +77,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from aioflo import async_get_api
|
||||
from aioflo.errors import RequestError
|
||||
@@ -38,6 +38,7 @@ 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
|
||||
from typing import Any, override
|
||||
|
||||
from aioflo.api import API
|
||||
from aioflo.errors import RequestError
|
||||
@@ -57,6 +57,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
update_interval=timedelta(seconds=60),
|
||||
)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self):
|
||||
"""Update data via library."""
|
||||
try:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Base entity class for Flo entities."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
@@ -24,6 +26,7 @@ class FloEntity(Entity):
|
||||
|
||||
self._device: FloDeviceDataUpdateCoordinator = device
|
||||
|
||||
@override
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
@@ -37,6 +40,7 @@ class FloEntity(Entity):
|
||||
sw_version=self._device.firmware_version,
|
||||
)
|
||||
|
||||
@override
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if device is available."""
|
||||
@@ -46,6 +50,7 @@ class FloEntity(Entity):
|
||||
"""Update Flo entity."""
|
||||
await self._device.async_request_refresh()
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""When entity is added to hass."""
|
||||
self.async_on_remove(self._device.async_add_listener(self.async_write_ha_state))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Support for Flo Water Monitor sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
@@ -61,6 +63,7 @@ class FloDailyUsageSensor(FloEntity, SensorEntity):
|
||||
"""Initialize the daily water usage sensor."""
|
||||
super().__init__("daily_consumption", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current daily usage."""
|
||||
@@ -78,6 +81,7 @@ class FloSystemModeSensor(FloEntity, SensorEntity):
|
||||
"""Initialize the system mode sensor."""
|
||||
super().__init__("current_system_mode", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> str | None:
|
||||
"""Return the current system mode."""
|
||||
@@ -98,6 +102,7 @@ class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
|
||||
"""Initialize the flow rate sensor."""
|
||||
super().__init__("current_flow_rate", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current flow rate."""
|
||||
@@ -119,6 +124,7 @@ class FloTemperatureSensor(FloEntity, SensorEntity):
|
||||
if is_water:
|
||||
self._attr_translation_key = "water_temperature"
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
@@ -138,6 +144,7 @@ class FloHumiditySensor(FloEntity, SensorEntity):
|
||||
"""Initialize the humidity sensor."""
|
||||
super().__init__("humidity", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current humidity."""
|
||||
@@ -158,6 +165,7 @@ class FloPressureSensor(FloEntity, SensorEntity):
|
||||
"""Initialize the pressure sensor."""
|
||||
super().__init__("water_pressure", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current water pressure."""
|
||||
@@ -177,6 +185,7 @@ class FloBatterySensor(FloEntity, SensorEntity):
|
||||
"""Initialize the battery sensor."""
|
||||
super().__init__("battery", device)
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> float | None:
|
||||
"""Return the current battery level."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Switch representing the shutoff valve for the Flo by Moen integration."""
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from aioflo.location import SLEEP_MINUTE_OPTIONS, SYSTEM_MODE_HOME, SYSTEM_REVERT_MODES
|
||||
import voluptuous as vol
|
||||
@@ -69,12 +69,14 @@ class FloSwitch(FloEntity, SwitchEntity):
|
||||
super().__init__("shutoff_valve", device)
|
||||
self._attr_is_on = device.last_known_valve_state == "open"
|
||||
|
||||
@override
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Open the valve."""
|
||||
await self._device.api_client.device.open_valve(self._device.id)
|
||||
self._attr_is_on = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Close the valve."""
|
||||
await self._device.api_client.device.close_valve(self._device.id)
|
||||
@@ -87,6 +89,7 @@ class FloSwitch(FloEntity, SwitchEntity):
|
||||
self._attr_is_on = self._device.last_known_valve_state == "open"
|
||||
self.async_write_ha_state()
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""When entity is added to hass."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import asyncio
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -46,6 +46,7 @@ class FlockNotificationService(BaseNotificationService):
|
||||
self._url = url
|
||||
self._session = session
|
||||
|
||||
@override
|
||||
async def async_send_message(self, message: str, **kwargs: Any) -> None:
|
||||
"""Send the message to the user."""
|
||||
payload = {"text": message}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Flume binary sensors."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
@@ -122,6 +123,7 @@ class FlumeNotificationBinarySensor(
|
||||
|
||||
entity_description: FlumeBinarySensorEntityDescription
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return on state."""
|
||||
@@ -144,6 +146,7 @@ class FlumeConnectionBinarySensor(
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
_attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
|
||||
|
||||
@override
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return connection status."""
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
import os
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from pyflume import FlumeAuth, FlumeDeviceList
|
||||
from requests.exceptions import RequestException
|
||||
@@ -91,6 +91,7 @@ class FlumeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Init flume config flow."""
|
||||
self._reauth_unique_id: str | None = None
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""The IntelliFire integration."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
import pyflume
|
||||
from pyflume import FlumeAuth, FlumeData, FlumeDeviceList
|
||||
@@ -55,6 +55,7 @@ class FlumeDeviceDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
|
||||
self.flume_device = flume_device
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> None:
|
||||
"""Get the latest data from the Flume."""
|
||||
try:
|
||||
@@ -99,6 +100,7 @@ class FlumeDeviceConnectionUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
}
|
||||
_LOGGER.debug("Connectivity %s", self.connected)
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> None:
|
||||
"""Update the device list."""
|
||||
try:
|
||||
@@ -152,6 +154,7 @@ class FlumeNotificationDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||
|
||||
self.active_notifications_by_device = active_notifications_by_device
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> None:
|
||||
"""Update data."""
|
||||
_LOGGER.debug("Updating Flume Notification")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Platform for shared base classes for sensors."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import EntityDescription
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
@@ -50,6 +52,7 @@ class FlumeEntity[
|
||||
configuration_url="https://portal.flumewater.com",
|
||||
)
|
||||
|
||||
@override
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Request an update when added."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Sensor for displaying the number of result from Flume."""
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from pyflume import FlumeAuth, FlumeData
|
||||
from requests import Session
|
||||
@@ -156,6 +156,7 @@ async def async_setup_entry(
|
||||
class FlumeSensor(FlumeEntity[FlumeDeviceDataUpdateCoordinator], SensorEntity):
|
||||
"""Representation of the Flume sensor."""
|
||||
|
||||
@override
|
||||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the state of the sensor."""
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"""Support for Fluss Devices."""
|
||||
|
||||
from typing import override
|
||||
|
||||
from homeassistant.components.button import ButtonEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
@@ -29,11 +31,13 @@ class FlussButton(FlussEntity, ButtonEntity):
|
||||
|
||||
_attr_name = None
|
||||
|
||||
@override
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True only when the device is online."""
|
||||
return super().available and self.device["internetConnected"]
|
||||
|
||||
@override
|
||||
async def async_press(self) -> None:
|
||||
"""Handle the button press."""
|
||||
try:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Config flow for Fluss+ integration."""
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from fluss_api import (
|
||||
FlussApiClient,
|
||||
@@ -22,6 +22,7 @@ STEP_USER_DATA_SCHEMA = vol.Schema({vol.Required(CONF_API_KEY): cv.string})
|
||||
class FlussConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for Fluss+."""
|
||||
|
||||
@override
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""DataUpdateCoordinator for Fluss+ integration."""
|
||||
|
||||
import asyncio
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from fluss_api import (
|
||||
FlussApiClient,
|
||||
@@ -45,6 +45,7 @@ class FlussDataUpdateCoordinator(DataUpdateCoordinator[dict[str, dict[str, Any]]
|
||||
return False
|
||||
return status["status"]["internetConnected"]
|
||||
|
||||
@override
|
||||
async def _async_update_data(self) -> dict[str, dict[str, Any]]:
|
||||
"""Fetch Fluss+ devices and merge per-device connectivity status."""
|
||||
try:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user