mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-12-06 18:44:14 -05:00
Add noqa: ARG001 on unused hass
This commit is contained in:
@@ -249,7 +249,9 @@ async def async_migrate_entry(hass: HomeAssistant, entry: OasisDeviceConfigEntry
|
|||||||
|
|
||||||
|
|
||||||
async def async_remove_config_entry_device(
|
async def async_remove_config_entry_device(
|
||||||
hass: HomeAssistant, config_entry: OasisDeviceConfigEntry, device_entry: DeviceEntry
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
|
config_entry: OasisDeviceConfigEntry,
|
||||||
|
device_entry: DeviceEntry,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""
|
"""
|
||||||
Determine whether the config entry is no longer associated with the given device.
|
Determine whether the config entry is no longer associated with the given device.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from .pyoasiscontrol import OasisDevice
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from .pyoasiscontrol.const import TRACKS
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ def create_client(hass: HomeAssistant, data: dict[str, Any]) -> OasisCloudClient
|
|||||||
Create an Oasis cloud client configured with the Home Assistant HTTP session and access token.
|
Create an Oasis cloud client configured with the Home Assistant HTTP session and access token.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
hass: Home Assistant instance used to obtain the shared HTTP client session.
|
hass (HomeAssistant): Home Assistant instance used to obtain the shared HTTP client session.
|
||||||
data: Configuration mapping; the function reads the `CONF_ACCESS_TOKEN` key for the cloud access token.
|
data (dict[str, Any]): Configuration mapping; the function reads the `CONF_ACCESS_TOKEN` key for the cloud access token.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
An `OasisCloudClient` initialized with the Home Assistant HTTP session and the configured access token.
|
An `OasisCloudClient` initialized with the Home Assistant HTTP session and the configured access token.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from .pyoasiscontrol import OasisDevice
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ from .pyoasiscontrol.const import LED_EFFECTS
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ from .pyoasiscontrol import OasisDevice
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from .pyoasiscontrol.device import (
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -31,6 +31,11 @@ async def async_setup_entry(
|
|||||||
Set up number entities for Oasis devices from a configuration entry.
|
Set up number entities for Oasis devices from a configuration entry.
|
||||||
|
|
||||||
Creates number entities for each discovered Oasis device and each descriptor in DESCRIPTORS, then registers those entities with the platform coordinator so they are added to Home Assistant.
|
Creates number entities for each discovered Oasis device and each descriptor in DESCRIPTORS, then registers those entities with the platform coordinator so they are added to Home Assistant.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
hass (HomeAssistant): Home Assistant core object.
|
||||||
|
entry (OasisDeviceConfigEntry): Configuration entry containing runtime data and devices to expose.
|
||||||
|
async_add_entities (AddEntitiesCallback): Callback to add created entities to Home Assistant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def make_entities(new_devices: list[OasisDevice]):
|
def make_entities(new_devices: list[OasisDevice]):
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class OasisDevice:
|
|||||||
model (str | None): Device model identifier.
|
model (str | None): Device model identifier.
|
||||||
serial_number (str | None): Device serial number.
|
serial_number (str | None): Device serial number.
|
||||||
name (str | None): Human-readable device name; if omitted, defaults to "<model> <serial_number>".
|
name (str | None): Human-readable device name; if omitted, defaults to "<model> <serial_number>".
|
||||||
ssid (str | None): Last-known Wi‑Fi SSID for the device.
|
ssid (str | None): Last-known Wi-Fi SSID for the device.
|
||||||
ip_address (str | None): Last-known IP address for the device.
|
ip_address (str | None): Last-known IP address for the device.
|
||||||
cloud (OasisCloudClient | None): Optional cloud client used to fetch track metadata and remote data.
|
cloud (OasisCloudClient | None): Optional cloud client used to fetch track metadata and remote data.
|
||||||
client (OasisClientProtocol | None): Optional transport client used to send commands to the device.
|
client (OasisClientProtocol | None): Optional transport client used to send commands to the device.
|
||||||
@@ -436,11 +436,11 @@ class OasisDevice:
|
|||||||
Returns:
|
Returns:
|
||||||
dict[int, dict[str, str]]: A mapping from track ID to a details dictionary (contains at least a `'name'` key). If track metadata is available from the device cache or built-in TRACKS it is used; otherwise a fallback `{"name": "Unknown Title (#<id>)"}` is provided.
|
dict[int, dict[str, str]]: A mapping from track ID to a details dictionary (contains at least a `'name'` key). If track metadata is available from the device cache or built-in TRACKS it is used; otherwise a fallback `{"name": "Unknown Title (#<id>)"}` is provided.
|
||||||
"""
|
"""
|
||||||
|
base = dict(TRACKS)
|
||||||
|
if (current_id := self.track_id) is not None and self.track:
|
||||||
|
base[current_id] = self.track
|
||||||
return {
|
return {
|
||||||
track_id: {self.track_id: self.track or {}, **TRACKS}.get(
|
track_id: base.get(track_id, {"name": f"Unknown Title (#{track_id})"})
|
||||||
track_id,
|
|
||||||
{"name": f"Unknown Title (#{track_id})"},
|
|
||||||
)
|
|
||||||
for track_id in self.playlist
|
for track_id in self.playlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import base64
|
|||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
from typing import Any
|
||||||
from xml.etree.ElementTree import Element, SubElement, tostring
|
from xml.etree.ElementTree import Element, SubElement, tostring
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
@@ -27,12 +28,12 @@ def _bit_to_bool(val: str) -> bool:
|
|||||||
return val == "1"
|
return val == "1"
|
||||||
|
|
||||||
|
|
||||||
def _parse_int(val: str) -> int:
|
def _parse_int(val: Any | None) -> int:
|
||||||
"""
|
"""
|
||||||
Parse a string into an integer, falling back to 0 when conversion fails.
|
Parse a string into an integer, falling back to 0 when conversion fails.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
val (str): String potentially containing an integer value.
|
val (Any | None): String potentially containing an integer value.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: The parsed integer, or 0 if `val` cannot be converted.
|
int: The parsed integer, or 0 if `val` cannot be converted.
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ def queue_update_handler(entity: OasisDeviceSelectEntity) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -92,9 +92,9 @@ async def async_setup_entry(
|
|||||||
Creates OasisDeviceSelectEntity instances for every device and descriptor and registers them with Home Assistant via the platform setup.
|
Creates OasisDeviceSelectEntity instances for every device and descriptor and registers them with Home Assistant via the platform setup.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
hass: Home Assistant instance.
|
hass (HomeAssistant): Home Assistant core object.
|
||||||
entry: Oasis device config entry used to locate coordinator and runtime data.
|
entry (OasisDeviceConfigEntry): Configuration entry containing runtime data and devices to expose.
|
||||||
async_add_entities: Callback to add created entities to Home Assistant.
|
async_add_entities (AddEntitiesCallback): Callback to add created entities to Home Assistant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def make_entities(new_devices: list[OasisDevice]):
|
def make_entities(new_devices: list[OasisDevice]):
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from .pyoasiscontrol import OasisDevice
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from .pyoasiscontrol import OasisDevice
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -25,9 +25,9 @@ async def async_setup_entry(
|
|||||||
Creates an OasisDeviceSwitchEntity for each OasisDevice associated with the given config entry (one entity per descriptor in DESCRIPTORS) and registers them with Home Assistant via the coordinator helper.
|
Creates an OasisDeviceSwitchEntity for each OasisDevice associated with the given config entry (one entity per descriptor in DESCRIPTORS) and registers them with Home Assistant via the coordinator helper.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
hass: Home Assistant core instance.
|
hass (HomeAssistant): Home Assistant core instance.
|
||||||
entry: OasisDeviceConfigEntry containing runtime data and the devices to expose as switch entities.
|
entry (OasisDeviceConfigEntry): Config entry containing runtime data used to create device update entities.
|
||||||
async_add_entities: Callback used to register created entities with Home Assistant.
|
async_add_entities (AddEntitiesCallback): Callback to add created entities to Home Assistant.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def make_entities(new_devices: list[OasisDevice]):
|
def make_entities(new_devices: list[OasisDevice]):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ SCAN_INTERVAL = timedelta(hours=6)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, # noqa: ARG001
|
||||||
entry: OasisDeviceConfigEntry,
|
entry: OasisDeviceConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user