Enable Ruff D212 (#87347)
This commit is contained in:
parent
97de0c6d9a
commit
ca1a12898c
237 changed files with 353 additions and 707 deletions
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Sphinx extension for ReadTheDocs-style "Edit on GitHub" links on the sidebar.
|
||||||
Sphinx extension for ReadTheDocs-style "Edit on GitHub" links on the sidebar.
|
|
||||||
|
|
||||||
Loosely based on https://github.com/astropy/astropy/pull/347
|
Loosely based on https://github.com/astropy/astropy/pull/347
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support Legacy API password auth provider.
|
||||||
Support Legacy API password auth provider.
|
|
||||||
|
|
||||||
It will be removed when auth system production ready
|
It will be removed when auth system production ready
|
||||||
"""
|
"""
|
||||||
|
@ -71,8 +70,7 @@ class LegacyApiPasswordAuthProvider(AuthProvider):
|
||||||
async def async_user_meta_for_credentials(
|
async def async_user_meta_for_credentials(
|
||||||
self, credentials: Credentials
|
self, credentials: Credentials
|
||||||
) -> UserMeta:
|
) -> UserMeta:
|
||||||
"""
|
"""Return info for the user.
|
||||||
Return info for the user.
|
|
||||||
|
|
||||||
Will be used to populate info when creating a new user.
|
Will be used to populate info when creating a new user.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -26,8 +26,7 @@ class StrEnum(str, Enum):
|
||||||
def _generate_next_value_(
|
def _generate_next_value_(
|
||||||
name: str, start: int, count: int, last_values: list[Any]
|
name: str, start: int, count: int, last_values: list[Any]
|
||||||
) -> Any:
|
) -> Any:
|
||||||
"""
|
"""Make `auto()` explicitly unsupported.
|
||||||
Make `auto()` explicitly unsupported.
|
|
||||||
|
|
||||||
We may revisit this when it's very clear that Python 3.11's
|
We may revisit this when it's very clear that Python 3.11's
|
||||||
`StrEnum.auto()` behavior will no longer change.
|
`StrEnum.auto()` behavior will no longer change.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""This package contains components that can be plugged into Home Assistant.
|
||||||
This package contains components that can be plugged into Home Assistant.
|
|
||||||
|
|
||||||
Component design guidelines:
|
Component design guidelines:
|
||||||
- Each component defines a constant DOMAIN that is equal to its filename.
|
- Each component defines a constant DOMAIN that is equal to its filename.
|
||||||
|
|
|
@ -38,8 +38,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def set_update_interval(instances_count: int, requests_remaining: int) -> timedelta:
|
def set_update_interval(instances_count: int, requests_remaining: int) -> timedelta:
|
||||||
"""
|
"""Return data update interval.
|
||||||
Return data update interval.
|
|
||||||
|
|
||||||
The number of requests is reset at midnight UTC so we calculate the update
|
The number of requests is reset at midnight UTC so we calculate the update
|
||||||
interval based on number of minutes until midnight, the number of Airly instances
|
interval based on number of minutes until midnight, the number of Airly instances
|
||||||
|
|
|
@ -16,8 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def validate_input(hass: core.HomeAssistant, data):
|
async def validate_input(hass: core.HomeAssistant, data):
|
||||||
"""
|
"""Validate the user input allows us to connect.
|
||||||
Validate the user input allows us to connect.
|
|
||||||
|
|
||||||
Data has the keys from DATA_SCHEMA with values provided by the user.
|
Data has the keys from DATA_SCHEMA with values provided by the user.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -41,8 +41,7 @@ def async_setup(hass):
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_intents(hass):
|
async def async_setup_intents(hass):
|
||||||
"""
|
"""Do intents setup.
|
||||||
Do intents setup.
|
|
||||||
|
|
||||||
Right now this module does not expose any, but the intent component breaks
|
Right now this module does not expose any, but the intent component breaks
|
||||||
without it.
|
without it.
|
||||||
|
|
|
@ -24,8 +24,7 @@ def build_app_list(app_list: dict[str, str]) -> BrowseMedia:
|
||||||
|
|
||||||
|
|
||||||
def item_payload(item: dict[str, Any]) -> BrowseMedia:
|
def item_payload(item: dict[str, Any]) -> BrowseMedia:
|
||||||
"""
|
"""Create response payload for a single media item.
|
||||||
Create response payload for a single media item.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -139,8 +139,7 @@ AutomationTriggerInfo = TriggerInfo
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def is_on(hass: HomeAssistant, entity_id: str) -> bool:
|
def is_on(hass: HomeAssistant, entity_id: str) -> bool:
|
||||||
"""
|
"""Return true if specified automation entity_id is on.
|
||||||
Return true if specified automation entity_id is on.
|
|
||||||
|
|
||||||
Async friendly.
|
Async friendly.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -217,8 +217,7 @@ class BayesianBinarySensor(BinarySensorEntity):
|
||||||
}
|
}
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""
|
"""Call when entity about to be added.
|
||||||
Call when entity about to be added.
|
|
||||||
|
|
||||||
All relevant update logic for instance attributes occurs within this closure.
|
All relevant update logic for instance attributes occurs within this closure.
|
||||||
Other methods in this class are designed to avoid directly modifying instance
|
Other methods in this class are designed to avoid directly modifying instance
|
||||||
|
@ -233,8 +232,7 @@ class BayesianBinarySensor(BinarySensorEntity):
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_threshold_sensor_state_listener(event: Event) -> None:
|
def async_threshold_sensor_state_listener(event: Event) -> None:
|
||||||
"""
|
"""Handle sensor state changes.
|
||||||
Handle sensor state changes.
|
|
||||||
|
|
||||||
When a state changes, we must update our list of current observations,
|
When a state changes, we must update our list of current observations,
|
||||||
then calculate the new probability.
|
then calculate the new probability.
|
||||||
|
@ -384,8 +382,7 @@ class BayesianBinarySensor(BinarySensorEntity):
|
||||||
return prior
|
return prior
|
||||||
|
|
||||||
def _build_observations_by_entity(self) -> dict[str, list[Observation]]:
|
def _build_observations_by_entity(self) -> dict[str, list[Observation]]:
|
||||||
"""
|
"""Build and return data structure of the form below.
|
||||||
Build and return data structure of the form below.
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"sensor.sensor1": [Observation, Observation],
|
"sensor.sensor1": [Observation, Observation],
|
||||||
|
@ -414,8 +411,7 @@ class BayesianBinarySensor(BinarySensorEntity):
|
||||||
return observations_by_entity
|
return observations_by_entity
|
||||||
|
|
||||||
def _build_observations_by_template(self) -> dict[Template, list[Observation]]:
|
def _build_observations_by_template(self) -> dict[Template, list[Observation]]:
|
||||||
"""
|
"""Build and return data structure of the form below.
|
||||||
Build and return data structure of the form below.
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"template": [Observation, Observation],
|
"template": [Observation, Observation],
|
||||||
|
|
|
@ -26,8 +26,7 @@ _T = TypeVar("_T")
|
||||||
class ActiveBluetoothDataUpdateCoordinator(
|
class ActiveBluetoothDataUpdateCoordinator(
|
||||||
PassiveBluetoothDataUpdateCoordinator, Generic[_T]
|
PassiveBluetoothDataUpdateCoordinator, Generic[_T]
|
||||||
):
|
):
|
||||||
"""
|
"""A coordinator that receives passive data from advertisements but can also poll.
|
||||||
A coordinator that receives passive data from advertisements but can also poll.
|
|
||||||
|
|
||||||
Unlike the passive processor coordinator, this coordinator does call a parser
|
Unlike the passive processor coordinator, this coordinator does call a parser
|
||||||
method to parse the data from the advertisement.
|
method to parse the data from the advertisement.
|
||||||
|
|
|
@ -96,8 +96,7 @@ async def see_device(
|
||||||
|
|
||||||
|
|
||||||
async def get_tracking_devices(hass: HomeAssistant) -> tuple[set[str], set[str]]:
|
async def get_tracking_devices(hass: HomeAssistant) -> tuple[set[str], set[str]]:
|
||||||
"""
|
"""Load all known devices.
|
||||||
Load all known devices.
|
|
||||||
|
|
||||||
We just need the devices so set consider_home and home range to 0
|
We just need the devices so set consider_home and home range to 0
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -55,8 +55,7 @@ async def async_setup_entry(
|
||||||
class BruntDevice(
|
class BruntDevice(
|
||||||
CoordinatorEntity[DataUpdateCoordinator[dict[str | None, Thing]]], CoverEntity
|
CoordinatorEntity[DataUpdateCoordinator[dict[str | None, Thing]]], CoverEntity
|
||||||
):
|
):
|
||||||
"""
|
"""Representation of a Brunt cover device.
|
||||||
Representation of a Brunt cover device.
|
|
||||||
|
|
||||||
Contains the common logic for all Brunt devices.
|
Contains the common logic for all Brunt devices.
|
||||||
"""
|
"""
|
||||||
|
@ -105,8 +104,7 @@ class BruntDevice(
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
|
@ -114,8 +112,7 @@ class BruntDevice(
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def request_cover_position(self) -> int | None:
|
def request_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return request position of cover.
|
||||||
Return request position of cover.
|
|
||||||
|
|
||||||
The request position is the position of the last request
|
The request position is the position of the last request
|
||||||
to Brunt, at times there is a diff of 1 to current
|
to Brunt, at times there is a diff of 1 to current
|
||||||
|
@ -125,8 +122,7 @@ class BruntDevice(
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def move_state(self) -> int | None:
|
def move_state(self) -> int | None:
|
||||||
"""
|
"""Return current moving state of cover.
|
||||||
Return current moving state of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 when stopped, 1 when opening, 2 when closing
|
None is unknown, 0 when stopped, 1 when opening, 2 when closing
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -51,8 +51,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
|
|
||||||
class BuienradarCam(Camera):
|
class BuienradarCam(Camera):
|
||||||
"""
|
"""A camera component producing animated buienradar radar-imagery GIFs.
|
||||||
A camera component producing animated buienradar radar-imagery GIFs.
|
|
||||||
|
|
||||||
Rain radar imagery camera based on image URL taken from [0].
|
Rain radar imagery camera based on image URL taken from [0].
|
||||||
|
|
||||||
|
@ -62,8 +61,7 @@ class BuienradarCam(Camera):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, latitude: float, longitude: float, delta: float, country: str
|
self, latitude: float, longitude: float, delta: float, country: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""Initialize the component.
|
||||||
Initialize the component.
|
|
||||||
|
|
||||||
This constructor must be run in the event loop.
|
This constructor must be run in the event loop.
|
||||||
"""
|
"""
|
||||||
|
@ -145,8 +143,7 @@ class BuienradarCam(Camera):
|
||||||
async def async_camera_image(
|
async def async_camera_image(
|
||||||
self, width: int | None = None, height: int | None = None
|
self, width: int | None = None, height: int | None = None
|
||||||
) -> bytes | None:
|
) -> bytes | None:
|
||||||
"""
|
"""Return a still image response from the camera.
|
||||||
Return a still image response from the camera.
|
|
||||||
|
|
||||||
Uses asyncio conditions to make sure only one task enters the critical
|
Uses asyncio conditions to make sure only one task enters the critical
|
||||||
section at the same time. Otherwise, two http requests would start
|
section at the same time. Otherwise, two http requests would start
|
||||||
|
|
|
@ -70,8 +70,7 @@ def scale_jpeg_camera_image(cam_image: Image, width: int, height: int) -> bytes:
|
||||||
|
|
||||||
|
|
||||||
class TurboJPEGSingleton:
|
class TurboJPEGSingleton:
|
||||||
"""
|
"""Load TurboJPEG only once.
|
||||||
Load TurboJPEG only once.
|
|
||||||
|
|
||||||
Ensures we do not log load failures each snapshot
|
Ensures we do not log load failures each snapshot
|
||||||
since camera image fetches happen every few
|
since camera image fetches happen every few
|
||||||
|
|
|
@ -476,8 +476,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
||||||
|
|
||||||
# ========== Service Calls ==========
|
# ========== Service Calls ==========
|
||||||
def _media_controller(self):
|
def _media_controller(self):
|
||||||
"""
|
"""Return media controller.
|
||||||
Return media controller.
|
|
||||||
|
|
||||||
First try from our own cast, then groups which our cast is a member in.
|
First try from our own cast, then groups which our cast is a member in.
|
||||||
"""
|
"""
|
||||||
|
@ -753,8 +752,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _media_status(self):
|
def _media_status(self):
|
||||||
"""
|
"""Return media status.
|
||||||
Return media status.
|
|
||||||
|
|
||||||
First try from our own cast, then groups which our cast is a member in.
|
First try from our own cast, then groups which our cast is a member in.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -64,8 +64,7 @@ class CiscoDeviceScanner(DeviceScanner):
|
||||||
return self.last_results
|
return self.last_results
|
||||||
|
|
||||||
def _update_info(self):
|
def _update_info(self):
|
||||||
"""
|
"""Ensure the information from the Cisco router is up to date.
|
||||||
Ensure the information from the Cisco router is up to date.
|
|
||||||
|
|
||||||
Returns boolean if scanning successful.
|
Returns boolean if scanning successful.
|
||||||
"""
|
"""
|
||||||
|
@ -139,8 +138,7 @@ class CiscoDeviceScanner(DeviceScanner):
|
||||||
|
|
||||||
|
|
||||||
def _parse_cisco_mac_address(cisco_hardware_addr):
|
def _parse_cisco_mac_address(cisco_hardware_addr):
|
||||||
"""
|
"""Parse a Cisco formatted HW address to normal MAC.
|
||||||
Parse a Cisco formatted HW address to normal MAC.
|
|
||||||
|
|
||||||
e.g. convert
|
e.g. convert
|
||||||
001d.ec02.07ab
|
001d.ec02.07ab
|
||||||
|
|
|
@ -78,8 +78,7 @@ class CiscoMEDeviceScanner(DeviceScanner):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def get_extra_attributes(self, device):
|
def get_extra_attributes(self, device):
|
||||||
"""
|
"""Get extra attributes of a device.
|
||||||
Get extra attributes of a device.
|
|
||||||
|
|
||||||
Some known extra attributes that may be returned in the device tuple
|
Some known extra attributes that may be returned in the device tuple
|
||||||
include SSID, PT (eg 802.11ac), devtype (eg iPhone 7) among others.
|
include SSID, PT (eg 802.11ac), devtype (eg iPhone 7) among others.
|
||||||
|
|
|
@ -24,8 +24,7 @@ def async_manage_legacy_subscription_issue(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
subscription_info: dict[str, Any],
|
subscription_info: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""Manage the legacy subscription issue.
|
||||||
Manage the legacy subscription issue.
|
|
||||||
|
|
||||||
If the provider is "legacy" create an issue,
|
If the provider is "legacy" create an issue,
|
||||||
in all other cases remove the issue.
|
in all other cases remove the issue.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support to allow pieces of code to request configuration from the user.
|
||||||
Support to allow pieces of code to request configuration from the user.
|
|
||||||
|
|
||||||
Initiate a request by calling the `request_config` method with a callback.
|
Initiate a request by calling the `request_config` method with a callback.
|
||||||
This will return a request id that has to be used for future calls.
|
This will return a request id that has to be used for future calls.
|
||||||
|
|
|
@ -19,8 +19,7 @@ class CrownstoneBaseEntity(Entity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cloud_id(self) -> str:
|
def cloud_id(self) -> str:
|
||||||
"""
|
"""Return the unique identifier for this device.
|
||||||
Return the unique identifier for this device.
|
|
||||||
|
|
||||||
Used as device ID and to generate unique entity ID's.
|
Used as device ID and to generate unique entity ID's.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -52,8 +52,7 @@ class CrownstoneEntryManager:
|
||||||
self.usb_sphere_id: str | None = None
|
self.usb_sphere_id: str | None = None
|
||||||
|
|
||||||
async def async_setup(self) -> bool:
|
async def async_setup(self) -> bool:
|
||||||
"""
|
"""Set up a Crownstone config entry.
|
||||||
Set up a Crownstone config entry.
|
|
||||||
|
|
||||||
Returns True if the setup was successful.
|
Returns True if the setup was successful.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -13,8 +13,7 @@ from .const import DONT_USE_USB, MANUAL_PATH, REFRESH_LIST
|
||||||
def list_ports_as_str(
|
def list_ports_as_str(
|
||||||
serial_ports: list[ListPortInfo], no_usb_option: bool = True
|
serial_ports: list[ListPortInfo], no_usb_option: bool = True
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
"""
|
"""Represent currently available serial ports as string.
|
||||||
Represent currently available serial ports as string.
|
|
||||||
|
|
||||||
Adds option to not use usb on top of the list,
|
Adds option to not use usb on top of the list,
|
||||||
option to use manual path or refresh list at the end.
|
option to use manual path or refresh list at the end.
|
||||||
|
|
|
@ -65,8 +65,7 @@ def hass_to_crownstone_state(value: int) -> int:
|
||||||
|
|
||||||
|
|
||||||
class CrownstoneEntity(CrownstoneBaseEntity, LightEntity):
|
class CrownstoneEntity(CrownstoneBaseEntity, LightEntity):
|
||||||
"""
|
"""Representation of a crownstone.
|
||||||
Representation of a crownstone.
|
|
||||||
|
|
||||||
Light platform is used to support dimming.
|
Light platform is used to support dimming.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Listeners for updating data in the Crownstone integration.
|
||||||
Listeners for updating data in the Crownstone integration.
|
|
||||||
|
|
||||||
For data updates, Cloud Push is used in form of an SSE server that sends out events.
|
For data updates, Cloud Push is used in form of an SSE server that sends out events.
|
||||||
For fast device switching Local Push is used in form of a USB dongle that hooks into a BLE mesh.
|
For fast device switching Local Push is used in form of a USB dongle that hooks into a BLE mesh.
|
||||||
|
|
|
@ -747,8 +747,7 @@ class DarkSkySensor(SensorEntity):
|
||||||
self._attr_native_value = self.get_state(currently)
|
self._attr_native_value = self.get_state(currently)
|
||||||
|
|
||||||
def get_state(self, data):
|
def get_state(self, data):
|
||||||
"""
|
"""Return a new state based on the type.
|
||||||
Return a new state based on the type.
|
|
||||||
|
|
||||||
If the sensor type is unknown, the current state is returned.
|
If the sensor type is unknown, the current state is returned.
|
||||||
"""
|
"""
|
||||||
|
@ -827,8 +826,7 @@ class DarkSkyAlertSensor(SensorEntity):
|
||||||
self._attr_native_value = self.get_state(alerts)
|
self._attr_native_value = self.get_state(alerts)
|
||||||
|
|
||||||
def get_state(self, data):
|
def get_state(self, data):
|
||||||
"""
|
"""Return a new state based on the type.
|
||||||
Return a new state based on the type.
|
|
||||||
|
|
||||||
If the sensor type is unknown, the current state is returned.
|
If the sensor type is unknown, the current state is returned.
|
||||||
"""
|
"""
|
||||||
|
@ -851,8 +849,7 @@ class DarkSkyAlertSensor(SensorEntity):
|
||||||
|
|
||||||
|
|
||||||
def convert_to_camel(data):
|
def convert_to_camel(data):
|
||||||
"""
|
"""Convert snake case (foo_bar_bat) to camel case (fooBarBat).
|
||||||
Convert snake case (foo_bar_bat) to camel case (fooBarBat).
|
|
||||||
|
|
||||||
This is not pythonic, but needed for certain situations.
|
This is not pythonic, but needed for certain situations.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -139,8 +139,7 @@ async def async_setup_entry(
|
||||||
def async_log_errors(
|
def async_log_errors(
|
||||||
func: Callable[Concatenate[_DenonDeviceT, _P], Awaitable[_R]],
|
func: Callable[Concatenate[_DenonDeviceT, _P], Awaitable[_R]],
|
||||||
) -> Callable[Concatenate[_DenonDeviceT, _P], Coroutine[Any, Any, _R | None]]:
|
) -> Callable[Concatenate[_DenonDeviceT, _P], Coroutine[Any, Any, _R | None]]:
|
||||||
"""
|
"""Log errors occurred when calling a Denon AVR receiver.
|
||||||
Log errors occurred when calling a Denon AVR receiver.
|
|
||||||
|
|
||||||
Decorates methods of DenonDevice class.
|
Decorates methods of DenonDevice class.
|
||||||
Declaration of staticmethod for this method is at the end of this class.
|
Declaration of staticmethod for this method is at the end of this class.
|
||||||
|
|
|
@ -301,8 +301,7 @@ class ConfiguredDoorBird:
|
||||||
return self.get_webhook_id(url, favs) is not None
|
return self.get_webhook_id(url, favs) is not None
|
||||||
|
|
||||||
def get_webhook_id(self, url, favs=None) -> str | None:
|
def get_webhook_id(self, url, favs=None) -> str | None:
|
||||||
"""
|
"""Return the device favorite ID for the given URL.
|
||||||
Return the device favorite ID for the given URL.
|
|
||||||
|
|
||||||
The favorite must exist or there will be problems.
|
The favorite must exist or there will be problems.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for Dublin RTPI information from data.dublinked.ie.
|
||||||
Support for Dublin RTPI information from data.dublinked.ie.
|
|
||||||
|
|
||||||
For more info on the API see :
|
For more info on the API see :
|
||||||
https://data.gov.ie/dataset/real-time-passenger-information-rtpi-for-dublin-bus-bus-eireann-luas-and-irish-rail/resource/4b9f2c4f-6bf5-4958-a43a-f12dab04cf61
|
https://data.gov.ie/dataset/real-time-passenger-information-rtpi-for-dublin-bus-bus-eireann-luas-and-irish-rail/resource/4b9f2c4f-6bf5-4958-a43a-f12dab04cf61
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for getting statistical data from a DWD Weather Warnings.
|
||||||
Support for getting statistical data from a DWD Weather Warnings.
|
|
||||||
|
|
||||||
Data is fetched from DWD:
|
Data is fetched from DWD:
|
||||||
https://rcccm.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/objekteinbindung.html
|
https://rcccm.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/objekteinbindung.html
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for EBox.
|
||||||
Support for EBox.
|
|
||||||
|
|
||||||
Get data from 'My Usage Page' page: https://client.ebox.ca/myusage
|
Get data from 'My Usage Page' page: https://client.ebox.ca/myusage
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,8 +32,7 @@ class EcoalSwitch(SwitchEntity):
|
||||||
"""Representation of Ecoal switch."""
|
"""Representation of Ecoal switch."""
|
||||||
|
|
||||||
def __init__(self, ecoal_contr, name, state_attr):
|
def __init__(self, ecoal_contr, name, state_attr):
|
||||||
"""
|
"""Initialize switch.
|
||||||
Initialize switch.
|
|
||||||
|
|
||||||
Sets HA switch to state as read from controller.
|
Sets HA switch to state as read from controller.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -29,8 +29,7 @@ CONFIG_SCHEMA = vol.Schema(
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""
|
"""Ecobee uses config flow for configuration.
|
||||||
Ecobee uses config flow for configuration.
|
|
||||||
|
|
||||||
But, an "ecobee:" entry in configuration.yaml will trigger an import flow
|
But, an "ecobee:" entry in configuration.yaml will trigger an import flow
|
||||||
if a config entry doesn't already exist. If ecobee.conf exists, the import
|
if a config entry doesn't already exist. If ecobee.conf exists, the import
|
||||||
|
@ -87,8 +86,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
|
||||||
|
|
||||||
class EcobeeData:
|
class EcobeeData:
|
||||||
"""
|
"""Handle getting the latest data from ecobee.com so platforms can use it.
|
||||||
Handle getting the latest data from ecobee.com so platforms can use it.
|
|
||||||
|
|
||||||
Also handle refreshing tokens and updating config entry with refreshed tokens.
|
Also handle refreshing tokens and updating config entry with refreshed tokens.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -76,8 +76,7 @@ class EcobeeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_import(self, import_data):
|
async def async_step_import(self, import_data):
|
||||||
"""
|
"""Import ecobee config from configuration.yaml.
|
||||||
Import ecobee config from configuration.yaml.
|
|
||||||
|
|
||||||
Triggered by async_setup only if a config entry doesn't already exist.
|
Triggered by async_setup only if a config entry doesn't already exist.
|
||||||
If ecobee.conf exists, we will attempt to validate the credentials
|
If ecobee.conf exists, we will attempt to validate the credentials
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Read temperature information from Eddystone beacons.
|
||||||
Read temperature information from Eddystone beacons.
|
|
||||||
|
|
||||||
Your beacons must be configured to transmit UID (for identification) and TLM
|
Your beacons must be configured to transmit UID (for identification) and TLM
|
||||||
(for temperature) frames.
|
(for temperature) frames.
|
||||||
|
|
|
@ -236,8 +236,7 @@ class EmbyDevice(MediaPlayerEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_position_updated_at(self):
|
def media_position_updated_at(self):
|
||||||
"""
|
"""When was the position of the current playing media valid.
|
||||||
When was the position of the current playing media valid.
|
|
||||||
|
|
||||||
Returns value from homeassistant.util.dt.utcnow().
|
Returns value from homeassistant.util.dt.utcnow().
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for Fido.
|
||||||
Support for Fido.
|
|
||||||
|
|
||||||
Get data from 'Usage Summary' page:
|
Get data from 'Usage Summary' page:
|
||||||
https://www.fido.ca/pages/#/my-account/wireless
|
https://www.fido.ca/pages/#/my-account/wireless
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Flux for Home-Assistant.
|
||||||
Flux for Home-Assistant.
|
|
||||||
|
|
||||||
The idea was taken from https://github.com/KpaBap/hue-flux/
|
The idea was taken from https://github.com/KpaBap/hue-flux/
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support to use FortiOS device like FortiGate as device tracker.
|
||||||
Support to use FortiOS device like FortiGate as device tracker.
|
|
||||||
|
|
||||||
This component is part of the device_tracker platform.
|
This component is part of the device_tracker platform.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -86,8 +86,7 @@ class FroniusCoordinatorBase(
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
entity_constructor: type[_FroniusEntityT],
|
entity_constructor: type[_FroniusEntityT],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""Add entities for received keys and registers listener for future seen keys.
|
||||||
Add entities for received keys and registers listener for future seen keys.
|
|
||||||
|
|
||||||
Called from a platforms `async_setup_entry`.
|
Called from a platforms `async_setup_entry`.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,8 +27,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _item_preset_payload(preset: Preset, player_mode: str) -> BrowseMedia:
|
def _item_preset_payload(preset: Preset, player_mode: str) -> BrowseMedia:
|
||||||
"""
|
"""Create response payload for a single media item.
|
||||||
Create response payload for a single media item.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
@ -47,8 +46,7 @@ def _item_preset_payload(preset: Preset, player_mode: str) -> BrowseMedia:
|
||||||
def _item_payload(
|
def _item_payload(
|
||||||
key, item: dict[str, str], player_mode: str, parent_keys: list[str]
|
key, item: dict[str, str], player_mode: str, parent_keys: list[str]
|
||||||
) -> BrowseMedia:
|
) -> BrowseMedia:
|
||||||
"""
|
"""Create response payload for a single media item.
|
||||||
Create response payload for a single media item.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
@ -76,8 +74,7 @@ def _item_payload(
|
||||||
|
|
||||||
|
|
||||||
async def browse_top_level(current_mode, afsapi: AFSAPI):
|
async def browse_top_level(current_mode, afsapi: AFSAPI):
|
||||||
"""
|
"""Create response payload to describe contents of a specific library.
|
||||||
Create response payload to describe contents of a specific library.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,8 +31,7 @@ async def async_setup_services(hass: HomeAssistant) -> None:
|
||||||
*args: list[str],
|
*args: list[str],
|
||||||
**kwargs: dict[str, Any],
|
**kwargs: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""Execute a Fully service call.
|
||||||
Execute a Fully service call.
|
|
||||||
|
|
||||||
:param call: {ServiceCall} HA service call.
|
:param call: {ServiceCall} HA service call.
|
||||||
:param fully_method: {Callable} A method of the FullyKiosk class.
|
:param fully_method: {Callable} A method of the FullyKiosk class.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Generic GeoRSS events service.
|
||||||
Generic GeoRSS events service.
|
|
||||||
|
|
||||||
Retrieves current events (typically incidents or alerts) in GeoRSS format, and
|
Retrieves current events (typically incidents or alerts) in GeoRSS format, and
|
||||||
shows information on events filtered by distance to the HA instance's location
|
shows information on events filtered by distance to the HA instance's location
|
||||||
|
|
|
@ -110,8 +110,7 @@ class InMemoryStorage:
|
||||||
self.mem: dict[str, bytes] = {}
|
self.mem: dict[str, bytes] = {}
|
||||||
|
|
||||||
def store_and_get_identifier(self, data: bytes) -> str:
|
def store_and_get_identifier(self, data: bytes) -> str:
|
||||||
"""
|
"""Temporarily store data and return identifier to be able to retrieve it.
|
||||||
Temporarily store data and return identifier to be able to retrieve it.
|
|
||||||
|
|
||||||
Data expires after 5 minutes.
|
Data expires after 5 minutes.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -25,8 +25,7 @@ LANG_TO_BROADCAST_COMMAND = {
|
||||||
|
|
||||||
|
|
||||||
def broadcast_commands(language_code: str):
|
def broadcast_commands(language_code: str):
|
||||||
"""
|
"""Get the commands for broadcasting a message for the given language code.
|
||||||
Get the commands for broadcasting a message for the given language code.
|
|
||||||
|
|
||||||
Return type is a tuple where [0] is for broadcasting to your entire home,
|
Return type is a tuple where [0] is for broadcasting to your entire home,
|
||||||
while [1] is for broadcasting to a specific target.
|
while [1] is for broadcasting to a specific target.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Growatt Sensor definitions for the TLX type.
|
||||||
Growatt Sensor definitions for the TLX type.
|
|
||||||
|
|
||||||
TLX Type is also shown on the UI as: "MIN/MIC/MOD/NEO"
|
TLX Type is also shown on the UI as: "MIN/MIC/MOD/NEO"
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -308,8 +308,7 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901
|
||||||
_LOGGER.info("Selected %s (%s)", call.data[ATTR_DEVICE], addr)
|
_LOGGER.info("Selected %s (%s)", call.data[ATTR_DEVICE], addr)
|
||||||
|
|
||||||
def _update(call: ServiceCall) -> None:
|
def _update(call: ServiceCall) -> None:
|
||||||
"""
|
"""Update if device update is needed.
|
||||||
Update if device update is needed.
|
|
||||||
|
|
||||||
Called by service, requests CEC network to update data.
|
Called by service, requests CEC network to update data.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -458,8 +458,7 @@ class SourceManager:
|
||||||
)
|
)
|
||||||
|
|
||||||
def connect_update(self, hass, controller):
|
def connect_update(self, hass, controller):
|
||||||
"""
|
"""Connect listener for when sources change and signal player update.
|
||||||
Connect listener for when sources change and signal player update.
|
|
||||||
|
|
||||||
EVENT_SOURCES_CHANGED is often raised multiple times in response to a
|
EVENT_SOURCES_CHANGED is often raised multiple times in response to a
|
||||||
physical event therefore throttle it. Retrieving sources immediately
|
physical event therefore throttle it. Retrieving sources immediately
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Manage allocation of accessory ID's.
|
||||||
Manage allocation of accessory ID's.
|
|
||||||
|
|
||||||
HomeKit needs to allocate unique numbers to each accessory. These need to
|
HomeKit needs to allocate unique numbers to each accessory. These need to
|
||||||
be stable between reboots and upgrades.
|
be stable between reboots and upgrades.
|
||||||
|
@ -60,8 +59,7 @@ def _generate_aids(unique_id: str | None, entity_id: str) -> Generator[int, None
|
||||||
|
|
||||||
|
|
||||||
class AccessoryAidStorage:
|
class AccessoryAidStorage:
|
||||||
"""
|
"""Holds a map of entity ID to HomeKit ID.
|
||||||
Holds a map of entity ID to HomeKit ID.
|
|
||||||
|
|
||||||
Will generate new ID's, ensure they are unique and store them to make sure they
|
Will generate new ID's, ensure they are unique and store them to make sure they
|
||||||
persist over reboots.
|
persist over reboots.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Manage allocation of instance ID's.
|
||||||
Manage allocation of instance ID's.
|
|
||||||
|
|
||||||
HomeKit needs to allocate unique numbers to each accessory. These need to
|
HomeKit needs to allocate unique numbers to each accessory. These need to
|
||||||
be stable between reboots and upgrades.
|
be stable between reboots and upgrades.
|
||||||
|
@ -61,8 +60,7 @@ class IIDStorage(Store):
|
||||||
|
|
||||||
|
|
||||||
class AccessoryIIDStorage:
|
class AccessoryIIDStorage:
|
||||||
"""
|
"""Provide stable allocation of IIDs for the lifetime of an accessory.
|
||||||
Provide stable allocation of IIDs for the lifetime of an accessory.
|
|
||||||
|
|
||||||
Will generate new ID's, ensure they are unique and store them to make sure they
|
Will generate new ID's, ensure they are unique and store them to make sure they
|
||||||
persist over reboots.
|
persist over reboots.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for Homekit buttons.
|
||||||
Support for Homekit buttons.
|
|
||||||
|
|
||||||
These are mostly used where a HomeKit accessory exposes additional non-standard
|
These are mostly used where a HomeKit accessory exposes additional non-standard
|
||||||
characteristics that don't map to a Home Assistant feature.
|
characteristics that don't map to a Home Assistant feature.
|
||||||
|
|
|
@ -91,8 +91,7 @@ def find_existing_host(
|
||||||
|
|
||||||
|
|
||||||
def ensure_pin_format(pin: str, allow_insecure_setup_codes: Any = None) -> str:
|
def ensure_pin_format(pin: str, allow_insecure_setup_codes: Any = None) -> str:
|
||||||
"""
|
"""Ensure a pin code is correctly formatted.
|
||||||
Ensure a pin code is correctly formatted.
|
|
||||||
|
|
||||||
Ensures a pin code is in the format 111-11-111. Handles codes with and without dashes.
|
Ensures a pin code is in the format 111-11-111. Handles codes with and without dashes.
|
||||||
|
|
||||||
|
|
|
@ -465,8 +465,7 @@ class HKDevice:
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_create_devices(self) -> None:
|
def async_create_devices(self) -> None:
|
||||||
"""
|
"""Build device registry entries for all accessories paired with the bridge.
|
||||||
Build device registry entries for all accessories paired with the bridge.
|
|
||||||
|
|
||||||
This is done as well as by the entities for 2 reasons. First, the bridge
|
This is done as well as by the entities for 2 reasons. First, the bridge
|
||||||
might not have any entities attached to it. Secondly there are stateless
|
might not have any entities attached to it. Secondly there are stateless
|
||||||
|
@ -536,8 +535,7 @@ class HKDevice:
|
||||||
self.unreliable_serial_numbers = unreliable_serial_numbers
|
self.unreliable_serial_numbers = unreliable_serial_numbers
|
||||||
|
|
||||||
async def async_process_entity_map(self) -> None:
|
async def async_process_entity_map(self) -> None:
|
||||||
"""
|
"""Process the entity map and load any platforms or entities that need adding.
|
||||||
Process the entity map and load any platforms or entities that need adding.
|
|
||||||
|
|
||||||
This is idempotent and will be called at startup and when we detect metadata changes
|
This is idempotent and will be called at startup and when we detect metadata changes
|
||||||
via the c# counter on the zeroconf record.
|
via the c# counter on the zeroconf record.
|
||||||
|
@ -759,8 +757,7 @@ class HKDevice:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
"""
|
"""Return a unique id for this accessory or bridge.
|
||||||
Return a unique id for this accessory or bridge.
|
|
||||||
|
|
||||||
This id is random and will change if a device undergoes a hard reset.
|
This id is random and will change if a device undergoes a hard reset.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -72,8 +72,7 @@ class HomeKitEntity(Entity):
|
||||||
self._accessory.remove_watchable_characteristics(self._aid)
|
self._accessory.remove_watchable_characteristics(self._aid)
|
||||||
|
|
||||||
async def async_put_characteristics(self, characteristics: dict[str, Any]) -> None:
|
async def async_put_characteristics(self, characteristics: dict[str, Any]) -> None:
|
||||||
"""
|
"""Write characteristics to the device.
|
||||||
Write characteristics to the device.
|
|
||||||
|
|
||||||
A characteristic type is unique within a service, but in order to write
|
A characteristic type is unique within a service, but in order to write
|
||||||
to a named characteristic on a bridge we need to turn its type into
|
to a named characteristic on a bridge we need to turn its type into
|
||||||
|
@ -195,8 +194,7 @@ class AccessoryEntity(HomeKitEntity):
|
||||||
|
|
||||||
|
|
||||||
class CharacteristicEntity(HomeKitEntity):
|
class CharacteristicEntity(HomeKitEntity):
|
||||||
"""
|
"""A HomeKit entity that is related to an single characteristic rather than a whole service.
|
||||||
A HomeKit entity that is related to an single characteristic rather than a whole service.
|
|
||||||
|
|
||||||
This is typically used to expose additional sensor, binary_sensor or number entities that don't belong with
|
This is typically used to expose additional sensor, binary_sensor or number entities that don't belong with
|
||||||
the service entity.
|
the service entity.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for Homekit number ranges.
|
||||||
Support for Homekit number ranges.
|
|
||||||
|
|
||||||
These are mostly used where a HomeKit accessory exposes additional non-standard
|
These are mostly used where a HomeKit accessory exposes additional non-standard
|
||||||
characteristics that don't map to a Home Assistant feature.
|
characteristics that don't map to a Home Assistant feature.
|
||||||
|
|
|
@ -55,8 +55,7 @@ class HomeKitSensorEntityDescription(SensorEntityDescription):
|
||||||
|
|
||||||
|
|
||||||
def thread_node_capability_to_str(char: Characteristic) -> str:
|
def thread_node_capability_to_str(char: Characteristic) -> str:
|
||||||
"""
|
"""Return the thread device type as a string.
|
||||||
Return the thread device type as a string.
|
|
||||||
|
|
||||||
The underlying value is a bitmask, but we want to turn that to
|
The underlying value is a bitmask, but we want to turn that to
|
||||||
a human readable string. Some devices will have multiple capabilities.
|
a human readable string. Some devices will have multiple capabilities.
|
||||||
|
@ -93,8 +92,7 @@ def thread_node_capability_to_str(char: Characteristic) -> str:
|
||||||
|
|
||||||
|
|
||||||
def thread_status_to_str(char: Characteristic) -> str:
|
def thread_status_to_str(char: Characteristic) -> str:
|
||||||
"""
|
"""Return the thread status as a string.
|
||||||
Return the thread status as a string.
|
|
||||||
|
|
||||||
The underlying value is a bitmask, but we want to turn that to
|
The underlying value is a bitmask, but we want to turn that to
|
||||||
a human readable string. So we check the flags in order. E.g. BORDER_ROUTER implies
|
a human readable string. So we check the flags in order. E.g. BORDER_ROUTER implies
|
||||||
|
@ -501,8 +499,7 @@ class HomeKitBatterySensor(HomeKitSensor):
|
||||||
|
|
||||||
|
|
||||||
class SimpleSensor(CharacteristicEntity, SensorEntity):
|
class SimpleSensor(CharacteristicEntity, SensorEntity):
|
||||||
"""
|
"""A simple sensor for a single characteristic.
|
||||||
A simple sensor for a single characteristic.
|
|
||||||
|
|
||||||
This may be an additional secondary entity that is part of another service. An
|
This may be an additional secondary entity that is part of another service. An
|
||||||
example is a switch that has an energy sensor.
|
example is a switch that has an energy sensor.
|
||||||
|
|
|
@ -19,8 +19,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EntityMapStorage:
|
class EntityMapStorage:
|
||||||
"""
|
"""Holds a cache of entity structure data from a paired HomeKit device.
|
||||||
Holds a cache of entity structure data from a paired HomeKit device.
|
|
||||||
|
|
||||||
HomeKit has a cacheable entity map that describes how an IP or BLE
|
HomeKit has a cacheable entity map that describes how an IP or BLE
|
||||||
endpoint is structured. This object holds the latest copy of that data.
|
endpoint is structured. This object holds the latest copy of that data.
|
||||||
|
|
|
@ -44,8 +44,7 @@ class HMCover(HMDevice, CoverEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
|
@ -126,8 +125,7 @@ class HMGarage(HMCover):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> None:
|
def current_cover_position(self) -> None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -131,8 +131,7 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_action(self) -> HVACAction | None:
|
def hvac_action(self) -> HVACAction | None:
|
||||||
"""
|
"""Return the current hvac_action.
|
||||||
Return the current hvac_action.
|
|
||||||
|
|
||||||
This is only relevant for radiator thermostats.
|
This is only relevant for radiator thermostats.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -256,8 +256,7 @@ class HomematicipNotificationLight(HomematicipGenericEntity, LightEntity):
|
||||||
|
|
||||||
|
|
||||||
def _convert_color(color: tuple) -> RGBColorState:
|
def _convert_color(color: tuple) -> RGBColorState:
|
||||||
"""
|
"""Convert the given color to the reduced RGBColorState color.
|
||||||
Convert the given color to the reduced RGBColorState color.
|
|
||||||
|
|
||||||
RGBColorStat contains only 8 colors including white and black,
|
RGBColorStat contains only 8 colors including white and black,
|
||||||
so a conversion is required.
|
so a conversion is required.
|
||||||
|
|
|
@ -139,8 +139,7 @@ async def async_setup_auth(hass: HomeAssistant, app: Application) -> None:
|
||||||
hass.data[STORAGE_KEY] = refresh_token.id
|
hass.data[STORAGE_KEY] = refresh_token.id
|
||||||
|
|
||||||
async def async_validate_auth_header(request: Request) -> bool:
|
async def async_validate_auth_header(request: Request) -> bool:
|
||||||
"""
|
"""Test authorization header against access token.
|
||||||
Test authorization header against access token.
|
|
||||||
|
|
||||||
Basic auth_type is legacy code, should be removed with api_password.
|
Basic auth_type is legacy code, should be removed with api_password.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -456,8 +456,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
)
|
)
|
||||||
|
|
||||||
def _update_router(*_: Any) -> None:
|
def _update_router(*_: Any) -> None:
|
||||||
"""
|
"""Update router data.
|
||||||
Update router data.
|
|
||||||
|
|
||||||
Separate passthrough function because lambdas don't work with track_time_interval.
|
Separate passthrough function because lambdas don't work with track_time_interval.
|
||||||
"""
|
"""
|
||||||
|
@ -496,8 +495,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
hass.data[DOMAIN] = HuaweiLteData(hass_config=config, routers={})
|
hass.data[DOMAIN] = HuaweiLteData(hass_config=config, routers={})
|
||||||
|
|
||||||
def service_handler(service: ServiceCall) -> None:
|
def service_handler(service: ServiceCall) -> None:
|
||||||
"""
|
"""Apply a service.
|
||||||
Apply a service.
|
|
||||||
|
|
||||||
We key this using the router URL instead of its unique id / serial number,
|
We key this using the router URL instead of its unique id / serial number,
|
||||||
because the latter is not available anywhere in the UI.
|
because the latter is not available anywhere in the UI.
|
||||||
|
|
|
@ -251,8 +251,7 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self._abort_if_unique_id_configured(updates={CONF_URL: url})
|
self._abort_if_unique_id_configured(updates={CONF_URL: url})
|
||||||
|
|
||||||
def _is_supported_device() -> bool:
|
def _is_supported_device() -> bool:
|
||||||
"""
|
"""See if we are looking at a possibly supported device.
|
||||||
See if we are looking at a possibly supported device.
|
|
||||||
|
|
||||||
Matching solely on SSDP data does not yield reliable enough results.
|
Matching solely on SSDP data does not yield reliable enough results.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -122,8 +122,7 @@ def _get_cumulative_value(
|
||||||
source_type: str,
|
source_type: str,
|
||||||
period_type: str,
|
period_type: str,
|
||||||
):
|
):
|
||||||
"""
|
"""Get the cumulative energy consumption for a certain period.
|
||||||
Get the cumulative energy consumption for a certain period.
|
|
||||||
|
|
||||||
:param current_measurements: The result from the Huisbaasje client
|
:param current_measurements: The result from the Huisbaasje client
|
||||||
:param source_type: The source of energy (electricity or gas)
|
:param source_type: The source of energy (electricity or gas)
|
||||||
|
|
|
@ -219,8 +219,7 @@ class EmailContentSensor(SensorEntity):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_msg_text(email_message):
|
def get_msg_text(email_message):
|
||||||
"""
|
"""Get the message text from the email.
|
||||||
Get the message text from the email.
|
|
||||||
|
|
||||||
Will look for text/plain or use text/html if not found.
|
Will look for text/plain or use text/html if not found.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -223,8 +223,7 @@ class ControllerDevice(ClimateEntity):
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def set_available(self, available: bool, ex: Exception | None = None) -> None:
|
def set_available(self, available: bool, ex: Exception | None = None) -> None:
|
||||||
"""
|
"""Set availability for the controller.
|
||||||
Set availability for the controller.
|
|
||||||
|
|
||||||
Also sets zone availability as they follow the same availability.
|
Also sets zone availability as they follow the same availability.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -114,8 +114,7 @@ ia_validator = vol.Any(
|
||||||
|
|
||||||
|
|
||||||
def ip_v4_validator(value: Any, multicast: bool | None = None) -> str:
|
def ip_v4_validator(value: Any, multicast: bool | None = None) -> str:
|
||||||
"""
|
"""Validate that value is parsable as IPv4 address.
|
||||||
Validate that value is parsable as IPv4 address.
|
|
||||||
|
|
||||||
Optionally check if address is in a reserved multicast block or is explicitly not.
|
Optionally check if address is in a reserved multicast block or is explicitly not.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -84,8 +84,7 @@ async def build_item_response(media_library, payload, get_thumbnail_url=None):
|
||||||
|
|
||||||
|
|
||||||
async def item_payload(item, get_thumbnail_url=None):
|
async def item_payload(item, get_thumbnail_url=None):
|
||||||
"""
|
"""Create response payload for a single media item.
|
||||||
Create response payload for a single media item.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
@ -179,8 +178,7 @@ def media_source_content_filter(item: BrowseMedia) -> bool:
|
||||||
|
|
||||||
|
|
||||||
async def library_payload(hass):
|
async def library_payload(hass):
|
||||||
"""
|
"""Create response payload to describe contents of a specific library.
|
||||||
Create response payload to describe contents of a specific library.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -42,8 +42,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
|
|
||||||
|
|
||||||
class LircInterface(threading.Thread):
|
class LircInterface(threading.Thread):
|
||||||
"""
|
"""This interfaces with the lirc daemon to read IR commands.
|
||||||
This interfaces with the lirc daemon to read IR commands.
|
|
||||||
|
|
||||||
When using lirc in blocking mode, sometimes repeated commands get produced
|
When using lirc in blocking mode, sometimes repeated commands get produced
|
||||||
in the next read of a command so we use a thread here to just wait
|
in the next read of a command so we use a thread here to just wait
|
||||||
|
|
|
@ -77,8 +77,7 @@ class LuciDeviceScanner(DeviceScanner):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def get_extra_attributes(self, device):
|
def get_extra_attributes(self, device):
|
||||||
"""
|
"""Get extra attributes of a device.
|
||||||
Get extra attributes of a device.
|
|
||||||
|
|
||||||
Some known extra attributes that may be returned in the device tuple
|
Some known extra attributes that may be returned in the device tuple
|
||||||
include MAC address (mac), network device (dev), IP address
|
include MAC address (mac), network device (dev), IP address
|
||||||
|
|
|
@ -174,8 +174,7 @@ def setup_platform(
|
||||||
|
|
||||||
|
|
||||||
class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
||||||
"""
|
"""Representation of an alarm status.
|
||||||
Representation of an alarm status.
|
|
||||||
|
|
||||||
When armed, will be arming for 'arming_time', after that armed.
|
When armed, will be arming for 'arming_time', after that armed.
|
||||||
When triggered, will be pending for the triggering state's 'delay_time'.
|
When triggered, will be pending for the triggering state's 'delay_time'.
|
||||||
|
@ -339,8 +338,7 @@ class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
||||||
self._async_update_state(STATE_ALARM_ARMED_CUSTOM_BYPASS)
|
self._async_update_state(STATE_ALARM_ARMED_CUSTOM_BYPASS)
|
||||||
|
|
||||||
async def async_alarm_trigger(self, code: str | None = None) -> None:
|
async def async_alarm_trigger(self, code: str | None = None) -> None:
|
||||||
"""
|
"""Send alarm trigger command.
|
||||||
Send alarm trigger command.
|
|
||||||
|
|
||||||
No code needed, a trigger time of zero for the current state
|
No code needed, a trigger time of zero for the current state
|
||||||
disables the alarm.
|
disables the alarm.
|
||||||
|
|
|
@ -216,8 +216,7 @@ def setup_platform(
|
||||||
|
|
||||||
|
|
||||||
class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
||||||
"""
|
"""Representation of an alarm status.
|
||||||
Representation of an alarm status.
|
|
||||||
|
|
||||||
When armed, will be pending for 'pending_time', after that armed.
|
When armed, will be pending for 'pending_time', after that armed.
|
||||||
When triggered, will be pending for the triggering state's 'delay_time'
|
When triggered, will be pending for the triggering state's 'delay_time'
|
||||||
|
@ -397,8 +396,7 @@ class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
||||||
self._async_update_state(STATE_ALARM_ARMED_CUSTOM_BYPASS)
|
self._async_update_state(STATE_ALARM_ARMED_CUSTOM_BYPASS)
|
||||||
|
|
||||||
async def async_alarm_trigger(self, code: str | None = None) -> None:
|
async def async_alarm_trigger(self, code: str | None = None) -> None:
|
||||||
"""
|
"""Send alarm trigger command.
|
||||||
Send alarm trigger command.
|
|
||||||
|
|
||||||
No code needed, a trigger time of zero for the current state
|
No code needed, a trigger time of zero for the current state
|
||||||
disables the alarm.
|
disables the alarm.
|
||||||
|
|
|
@ -276,8 +276,7 @@ class MatrixBot:
|
||||||
_LOGGER.error("Could not join room %s: %s", room_id, ex)
|
_LOGGER.error("Could not join room %s: %s", room_id, ex)
|
||||||
|
|
||||||
def _get_auth_tokens(self):
|
def _get_auth_tokens(self):
|
||||||
"""
|
"""Read sorted authentication tokens from disk.
|
||||||
Read sorted authentication tokens from disk.
|
|
||||||
|
|
||||||
Returns the auth_tokens dictionary.
|
Returns the auth_tokens dictionary.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -134,8 +134,7 @@ class MaxCubeClimate(ClimateEntity):
|
||||||
raise ValueError(f"unsupported HVAC mode {hvac_mode}")
|
raise ValueError(f"unsupported HVAC mode {hvac_mode}")
|
||||||
|
|
||||||
def _set_target(self, mode: int | None, temp: float | None) -> None:
|
def _set_target(self, mode: int | None, temp: float | None) -> None:
|
||||||
"""
|
"""Set the mode and/or temperature of the thermostat.
|
||||||
Set the mode and/or temperature of the thermostat.
|
|
||||||
|
|
||||||
@param mode: this is the mode to change to.
|
@param mode: this is the mode to change to.
|
||||||
@param temp: the temperature to target.
|
@param temp: the temperature to target.
|
||||||
|
|
|
@ -236,8 +236,7 @@ _ENTITY_IMAGE_CACHE = _ImageCache(images=collections.OrderedDict(), maxsize=16)
|
||||||
|
|
||||||
@bind_hass
|
@bind_hass
|
||||||
def is_on(hass: HomeAssistant, entity_id: str | None = None) -> bool:
|
def is_on(hass: HomeAssistant, entity_id: str | None = None) -> bool:
|
||||||
"""
|
"""Return true if specified media player entity_id is on.
|
||||||
Return true if specified media player entity_id is on.
|
|
||||||
|
|
||||||
Check all media player if no entity_id specified.
|
Check all media player if no entity_id specified.
|
||||||
"""
|
"""
|
||||||
|
@ -591,8 +590,7 @@ class MediaPlayerEntity(Entity):
|
||||||
media_content_id: str,
|
media_content_id: str,
|
||||||
media_image_id: str | None = None,
|
media_image_id: str | None = None,
|
||||||
) -> tuple[bytes | None, str | None]:
|
) -> tuple[bytes | None, str | None]:
|
||||||
"""
|
"""Optionally fetch internally accessible image for media browser.
|
||||||
Optionally fetch internally accessible image for media browser.
|
|
||||||
|
|
||||||
Must be implemented by integration.
|
Must be implemented by integration.
|
||||||
"""
|
"""
|
||||||
|
@ -1198,8 +1196,7 @@ async def websocket_browse_media(
|
||||||
connection: websocket_api.connection.ActiveConnection,
|
connection: websocket_api.connection.ActiveConnection,
|
||||||
msg: dict[str, Any],
|
msg: dict[str, Any],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""Browse media available to the media_player entity.
|
||||||
Browse media available to the media_player entity.
|
|
||||||
|
|
||||||
To use, media_player integrations can implement
|
To use, media_player integrations can implement
|
||||||
MediaPlayerEntity.async_browse_media()
|
MediaPlayerEntity.async_browse_media()
|
||||||
|
|
|
@ -192,8 +192,7 @@ class LocalSource(MediaSource):
|
||||||
|
|
||||||
|
|
||||||
class LocalMediaView(http.HomeAssistantView):
|
class LocalMediaView(http.HomeAssistantView):
|
||||||
"""
|
"""Local Media Finder View.
|
||||||
Local Media Finder View.
|
|
||||||
|
|
||||||
Returns media files in config/media.
|
Returns media files in config/media.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -187,8 +187,7 @@ class MinioEventThread(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
def iterate_objects(event):
|
def iterate_objects(event):
|
||||||
"""
|
"""Iterate over file records of notification event.
|
||||||
Iterate over file records of notification event.
|
|
||||||
|
|
||||||
Most of the time it should still be only one record.
|
Most of the time it should still be only one record.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -230,8 +230,7 @@ class MotionPositionDevice(CoordinatorEntity, CoverEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is open, 100 is closed.
|
None is unknown, 0 is open, 100 is closed.
|
||||||
"""
|
"""
|
||||||
|
@ -343,8 +342,7 @@ class MotionTiltDevice(MotionPositionDevice):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_tilt_position(self) -> int | None:
|
def current_cover_tilt_position(self) -> int | None:
|
||||||
"""
|
"""Return current angle of cover.
|
||||||
Return current angle of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed/minimum tilt, 100 is fully open/maximum tilt.
|
None is unknown, 0 is closed/minimum tilt, 100 is fully open/maximum tilt.
|
||||||
"""
|
"""
|
||||||
|
@ -440,8 +438,7 @@ class MotionTDBUDevice(MotionPositionDevice):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is open, 100 is closed.
|
None is unknown, 0 is open, 100 is closed.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -748,8 +748,7 @@ class MqttCover(MqttEntity, CoverEntity):
|
||||||
def find_in_range_from_percent(
|
def find_in_range_from_percent(
|
||||||
self, percentage: float, range_type: str = TILT_PAYLOAD
|
self, percentage: float, range_type: str = TILT_PAYLOAD
|
||||||
) -> int:
|
) -> int:
|
||||||
"""
|
"""Find the adjusted value for 0-100% within the specified range.
|
||||||
Find the adjusted value for 0-100% within the specified range.
|
|
||||||
|
|
||||||
if the range is 80-180 and the percentage is 90
|
if the range is 80-180 and the percentage is 90
|
||||||
this method would determine the value to send on the topic
|
this method would determine the value to send on the topic
|
||||||
|
|
|
@ -168,8 +168,7 @@ class NAD(MediaPlayerEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
def calc_volume(self, decibel):
|
def calc_volume(self, decibel):
|
||||||
"""
|
"""Calculate the volume given the decibel.
|
||||||
Calculate the volume given the decibel.
|
|
||||||
|
|
||||||
Return the volume (0..1).
|
Return the volume (0..1).
|
||||||
"""
|
"""
|
||||||
|
@ -178,8 +177,7 @@ class NAD(MediaPlayerEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
def calc_db(self, volume):
|
def calc_db(self, volume):
|
||||||
"""
|
"""Calculate the decibel given the volume.
|
||||||
Calculate the decibel given the volume.
|
|
||||||
|
|
||||||
Return the dB.
|
Return the dB.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -82,8 +82,7 @@ CANCEL_ETA_SCHEMA = vol.Schema(
|
||||||
|
|
||||||
|
|
||||||
def nest_update_event_broker(hass, nest):
|
def nest_update_event_broker(hass, nest):
|
||||||
"""
|
"""Dispatch SIGNAL_NEST_UPDATE to devices when nest stream API received data.
|
||||||
Dispatch SIGNAL_NEST_UPDATE to devices when nest stream API received data.
|
|
||||||
|
|
||||||
Used for the legacy nest API.
|
Used for the legacy nest API.
|
||||||
|
|
||||||
|
|
|
@ -156,8 +156,7 @@ class NetatmoDataHandler:
|
||||||
await self.async_dispatch()
|
await self.async_dispatch()
|
||||||
|
|
||||||
async def async_update(self, event_time: datetime) -> None:
|
async def async_update(self, event_time: datetime) -> None:
|
||||||
"""
|
"""Update device.
|
||||||
Update device.
|
|
||||||
|
|
||||||
We do up to BATCH_SIZE calls in one update in order
|
We do up to BATCH_SIZE calls in one update in order
|
||||||
to minimize the calls on the api service.
|
to minimize the calls on the api service.
|
||||||
|
|
|
@ -163,8 +163,7 @@ class NukiCoordinator(DataUpdateCoordinator[None]):
|
||||||
self.hass.bus.async_fire("nuki_event", event_data)
|
self.hass.bus.async_fire("nuki_event", event_data)
|
||||||
|
|
||||||
def update_devices(self, devices: list[NukiDevice]) -> dict[str, set[str]]:
|
def update_devices(self, devices: list[NukiDevice]) -> dict[str, set[str]]:
|
||||||
"""
|
"""Update the Nuki devices.
|
||||||
Update the Nuki devices.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A dict with the events to be fired. The event type is the key and the device ids are the value
|
A dict with the events to be fired. The event type is the key and the device ids are the value
|
||||||
|
|
|
@ -43,8 +43,7 @@ def base_unique_id(latitude: float, longitude: float) -> str:
|
||||||
|
|
||||||
|
|
||||||
class NwsDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
class NwsDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""
|
"""NWS data update coordinator.
|
||||||
NWS data update coordinator.
|
|
||||||
|
|
||||||
Implements faster data update intervals for failed updates and exposes a last successful update time.
|
Implements faster data update intervals for failed updates and exposes a last successful update time.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -55,8 +55,7 @@ PARALLEL_UPDATES = 0
|
||||||
def convert_condition(
|
def convert_condition(
|
||||||
time: str, weather: tuple[tuple[str, int | None], ...]
|
time: str, weather: tuple[tuple[str, int | None], ...]
|
||||||
) -> tuple[str, int | None]:
|
) -> tuple[str, int | None]:
|
||||||
"""
|
"""Convert NWS codes to HA condition.
|
||||||
Convert NWS codes to HA condition.
|
|
||||||
|
|
||||||
Choose first condition in CONDITION_CLASSES that exists in weather code.
|
Choose first condition in CONDITION_CLASSES that exists in weather code.
|
||||||
If no match is found, return first condition from NWS
|
If no match is found, return first condition from NWS
|
||||||
|
|
|
@ -355,8 +355,7 @@ class OnkyoDevice(MediaPlayerEntity):
|
||||||
self.command("system-power standby")
|
self.command("system-power standby")
|
||||||
|
|
||||||
def set_volume_level(self, volume: float) -> None:
|
def set_volume_level(self, volume: float) -> None:
|
||||||
"""
|
"""Set volume level, input is range 0..1.
|
||||||
Set volume level, input is range 0..1.
|
|
||||||
|
|
||||||
However full volume on the amp is usually far too loud so allow the user to specify the upper range
|
However full volume on the amp is usually far too loud so allow the user to specify the upper range
|
||||||
with CONF_MAX_VOLUME. we change as per max_volume set by user. This means that if max volume is 80 then full
|
with CONF_MAX_VOLUME. we change as per max_volume set by user. This means that if max volume is 80 then full
|
||||||
|
@ -523,8 +522,7 @@ class OnkyoDeviceZone(OnkyoDevice):
|
||||||
self.command(f"zone{self._zone}.power=standby")
|
self.command(f"zone{self._zone}.power=standby")
|
||||||
|
|
||||||
def set_volume_level(self, volume: float) -> None:
|
def set_volume_level(self, volume: float) -> None:
|
||||||
"""
|
"""Set volume level, input is range 0..1.
|
||||||
Set volume level, input is range 0..1.
|
|
||||||
|
|
||||||
However full volume on the amp is usually far too loud so allow the user to specify the upper range
|
However full volume on the amp is usually far too loud so allow the user to specify the upper range
|
||||||
with CONF_MAX_VOLUME. we change as per max_volume set by user. This means that if max volume is 80 then full
|
with CONF_MAX_VOLUME. we change as per max_volume set by user. This means that if max volume is 80 then full
|
||||||
|
|
|
@ -86,8 +86,7 @@ class OpenThermGwConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
return await self.async_step_init(user_input)
|
return await self.async_step_init(user_input)
|
||||||
|
|
||||||
async def async_step_import(self, import_config):
|
async def async_step_import(self, import_config):
|
||||||
"""
|
"""Import an OpenTherm Gateway device as a config entry.
|
||||||
Import an OpenTherm Gateway device as a config entry.
|
|
||||||
|
|
||||||
This flow is triggered by `async_setup` for configured devices.
|
This flow is triggered by `async_setup` for configured devices.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -45,8 +45,7 @@ class Awning(OverkizGenericCover):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -75,8 +75,7 @@ class VerticalCover(OverkizGenericCover):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self) -> int | None:
|
def current_cover_position(self) -> int | None:
|
||||||
"""
|
"""Return current position of cover.
|
||||||
Return current position of cover.
|
|
||||||
|
|
||||||
None is unknown, 0 is closed, 100 is fully open.
|
None is unknown, 0 is closed, 100 is fully open.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -152,8 +152,7 @@ class OverkizExecutor:
|
||||||
await self.coordinator.client.cancel_command(exec_id)
|
await self.coordinator.client.cancel_command(exec_id)
|
||||||
|
|
||||||
def get_gateway_id(self) -> str:
|
def get_gateway_id(self) -> str:
|
||||||
"""
|
"""Retrieve gateway id from device url.
|
||||||
Retrieve gateway id from device url.
|
|
||||||
|
|
||||||
device URL (<protocol>://<gatewayId>/<deviceAddress>[#<subsystemId>])
|
device URL (<protocol>://<gatewayId>/<deviceAddress>[#<subsystemId>])
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -91,8 +91,7 @@ class PanasonicBluRay(MediaPlayerEntity):
|
||||||
self._attr_media_duration = state[2]
|
self._attr_media_duration = state[2]
|
||||||
|
|
||||||
def turn_off(self) -> None:
|
def turn_off(self) -> None:
|
||||||
"""
|
"""Instruct the device to turn standby.
|
||||||
Instruct the device to turn standby.
|
|
||||||
|
|
||||||
Sending the "POWER" button will turn the device to standby - there
|
Sending the "POWER" button will turn the device to standby - there
|
||||||
is no way to turn it completely off remotely. However this works in
|
is no way to turn it completely off remotely. However this works in
|
||||||
|
|
|
@ -255,8 +255,7 @@ class PandoraMediaPlayer(MediaPlayerEntity):
|
||||||
|
|
||||||
@util.Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@util.Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def _update_song_position(self):
|
def _update_song_position(self):
|
||||||
"""
|
"""Get the song position and duration.
|
||||||
Get the song position and duration.
|
|
||||||
|
|
||||||
It's hard to predict whether or not the music will start during init
|
It's hard to predict whether or not the music will start during init
|
||||||
so we have to detect state by checking the ticker.
|
so we have to detect state by checking the ticker.
|
||||||
|
@ -312,8 +311,7 @@ class PandoraMediaPlayer(MediaPlayerEntity):
|
||||||
self._pianobar.sendcontrol("m") # do it twice in case an 'i' got in
|
self._pianobar.sendcontrol("m") # do it twice in case an 'i' got in
|
||||||
|
|
||||||
def _clear_buffer(self):
|
def _clear_buffer(self):
|
||||||
"""
|
"""Clear buffer from pexpect.
|
||||||
Clear buffer from pexpect.
|
|
||||||
|
|
||||||
This is necessary because there are a bunch of 00:00 in the buffer
|
This is necessary because there are a bunch of 00:00 in the buffer
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,7 @@ def _base_gw_schema(discovery_info: ZeroconfServiceInfo | None) -> vol.Schema:
|
||||||
|
|
||||||
|
|
||||||
async def validate_gw_input(hass: HomeAssistant, data: dict[str, Any]) -> Smile:
|
async def validate_gw_input(hass: HomeAssistant, data: dict[str, Any]) -> Smile:
|
||||||
"""
|
"""Validate whether the user input allows us to connect to the gateway.
|
||||||
Validate whether the user input allows us to connect to the gateway.
|
|
||||||
|
|
||||||
Data has the keys from _base_gw_schema() with values provided by the user.
|
Data has the keys from _base_gw_schema() with values provided by the user.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -349,8 +349,7 @@ def get_significant_states_with_session(
|
||||||
no_attributes: bool = False,
|
no_attributes: bool = False,
|
||||||
compressed_state_format: bool = False,
|
compressed_state_format: bool = False,
|
||||||
) -> MutableMapping[str, list[State | dict[str, Any]]]:
|
) -> MutableMapping[str, list[State | dict[str, Any]]]:
|
||||||
"""
|
"""Return states changes during UTC period start_time - end_time.
|
||||||
Return states changes during UTC period start_time - end_time.
|
|
||||||
|
|
||||||
entity_ids is an optional iterable of entities to include in the results.
|
entity_ids is an optional iterable of entities to include in the results.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""Support for Rejseplanen information from rejseplanen.dk.
|
||||||
Support for Rejseplanen information from rejseplanen.dk.
|
|
||||||
|
|
||||||
For more info on the API see:
|
For more info on the API see:
|
||||||
https://help.rejseplanen.dk/hc/en-us/articles/214174465-Rejseplanen-s-API
|
https://help.rejseplanen.dk/hc/en-us/articles/214174465-Rejseplanen-s-API
|
||||||
|
|
|
@ -222,8 +222,7 @@ def item_payload(
|
||||||
coordinator: RokuDataUpdateCoordinator,
|
coordinator: RokuDataUpdateCoordinator,
|
||||||
get_browse_image_url: GetBrowseImageUrlType,
|
get_browse_image_url: GetBrowseImageUrlType,
|
||||||
) -> BrowseMedia:
|
) -> BrowseMedia:
|
||||||
"""
|
"""Create response payload for a single media item.
|
||||||
Create response payload for a single media item.
|
|
||||||
|
|
||||||
Used by async_browse_media.
|
Used by async_browse_media.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""
|
"""A sensor platform which detects underruns and capped status from the official Raspberry Pi Kernel.
|
||||||
A sensor platform which detects underruns and capped status from the official Raspberry Pi Kernel.
|
|
||||||
|
|
||||||
Minimal Kernel needed is 4.14+
|
Minimal Kernel needed is 4.14+
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -145,8 +145,7 @@ async def migrate_unique_id(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_migrate_callback(entity_entry: RegistryEntry) -> dict | None:
|
def async_migrate_callback(entity_entry: RegistryEntry) -> dict | None:
|
||||||
"""
|
"""Define a callback to migrate appropriate SabnzbdSensor entities to new unique IDs.
|
||||||
Define a callback to migrate appropriate SabnzbdSensor entities to new unique IDs.
|
|
||||||
|
|
||||||
Old: description.key
|
Old: description.key
|
||||||
New: {entry_id}_description.key
|
New: {entry_id}_description.key
|
||||||
|
|
|
@ -153,8 +153,7 @@ class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuum
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self) -> str | None:
|
def state(self) -> str | None:
|
||||||
"""
|
"""Get the current vacuum state.
|
||||||
Get the current vacuum state.
|
|
||||||
|
|
||||||
NB: Currently, we do not return an error state because they can be very, very stale.
|
NB: Currently, we do not return an error state because they can be very, very stale.
|
||||||
In the app, these are (usually) handled by showing the robot as stopped and sending the
|
In the app, these are (usually) handled by showing the robot as stopped and sending the
|
||||||
|
|
|
@ -59,8 +59,7 @@ class SirenTurnOnServiceParameters(TypedDict, total=False):
|
||||||
def process_turn_on_params(
|
def process_turn_on_params(
|
||||||
siren: SirenEntity, params: SirenTurnOnServiceParameters
|
siren: SirenEntity, params: SirenTurnOnServiceParameters
|
||||||
) -> SirenTurnOnServiceParameters:
|
) -> SirenTurnOnServiceParameters:
|
||||||
"""
|
"""Process turn_on service params.
|
||||||
Process turn_on service params.
|
|
||||||
|
|
||||||
Filters out unsupported params and validates the rest.
|
Filters out unsupported params and validates the rest.
|
||||||
"""
|
"""
|
||||||
|
@ -178,8 +177,7 @@ class SirenEntity(ToggleEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available_tones(self) -> list[int | str] | dict[int, str] | None:
|
def available_tones(self) -> list[int | str] | dict[int, str] | None:
|
||||||
"""
|
"""Return a list of available tones.
|
||||||
Return a list of available tones.
|
|
||||||
|
|
||||||
Requires SirenEntityFeature.TONES.
|
Requires SirenEntityFeature.TONES.
|
||||||
"""
|
"""
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue