1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-12-06 18:44:14 -05:00

Formatting

This commit is contained in:
Nathan Spencer
2025-11-24 04:37:10 +00:00
parent 14223bd1c9
commit 04be6626a7
11 changed files with 61 additions and 62 deletions

View File

@@ -21,11 +21,11 @@ _LOGGER = logging.getLogger(__name__)
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.
Parameters:
hass: 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.
Returns:
An `OasisCloudClient` initialized with the Home Assistant HTTP session and the configured access token.
"""
@@ -36,13 +36,13 @@ def create_client(hass: HomeAssistant, data: dict[str, Any]) -> OasisCloudClient
async def add_and_play_track(device: OasisDevice, track: int) -> None:
"""
Ensure a track is present in the device playlist, position it as the next item, select it, and start playback if necessary.
Adds the specified track to the device playlist if missing, waits up to 10 seconds for the track to appear, moves it to be the next item after the current playlist index if needed, selects that track, and starts playback when the device is not already playing.
Parameters:
device (OasisDevice): The target Oasis device.
track (int): The track id to add and play.
Raises:
async_timeout.TimeoutError: If the operation does not complete within 10 seconds.
"""
@@ -68,10 +68,10 @@ async def add_and_play_track(device: OasisDevice, track: int) -> None:
def get_track_id(track: str) -> int | None:
"""
Convert a track identifier or title to its integer track id.
Parameters:
track: A track reference, either a numeric id as a string or a track title.
Returns:
The integer track id if the input is a valid id or matches a known title, `None` if the input is invalid.
"""
@@ -85,4 +85,4 @@ def get_track_id(track: str) -> int | None:
return int(track)
except ValueError:
_LOGGER.warning("Invalid track: %s", track)
return None
return None