mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-12-06 18:44:14 -05:00
Fix formatting in device.py
This commit is contained in:
@@ -254,16 +254,16 @@ class OasisDevice:
|
|||||||
Expects a semicolon-separated string containing at least 18 fields (device status format returned by the device: e.g., HTTP GETSTATUS or MQTT FULLSTATUS). Returns None for empty input or if the string cannot be parsed into the expected fields.
|
Expects a semicolon-separated string containing at least 18 fields (device status format returned by the device: e.g., HTTP GETSTATUS or MQTT FULLSTATUS). Returns None for empty input or if the string cannot be parsed into the expected fields.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
raw_status (str): Semicolon-separated status string from the device.
|
raw_status (str): Semicolon-separated status string from the device.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict[str, Any] | None: A dictionary with these keys on success:
|
dict[str, Any] | None: A dictionary with these keys on success:
|
||||||
- `status_code`, `error`, `ball_speed`, `playlist` (list[int]), `playlist_index`,
|
- `status_code`, `error`, `ball_speed`, `playlist` (list[int]), `playlist_index`,
|
||||||
`progress`, `led_effect`, `led_color_id`, `led_speed`, `brightness`, `color`,
|
`progress`, `led_effect`, `led_color_id`, `led_speed`, `brightness`, `color`,
|
||||||
`busy`, `download_progress`, `brightness_max`, `wifi_connected`, `repeat_playlist`,
|
`busy`, `download_progress`, `brightness_max`, `wifi_connected`, `repeat_playlist`,
|
||||||
`autoplay`, `auto_clean`
|
`autoplay`, `auto_clean`
|
||||||
- `software_version` (str) is included if an additional trailing field is present.
|
- `software_version` (str) is included if an additional trailing field is present.
|
||||||
Returns `None` if the input is empty or parsing fails.
|
Returns `None` if the input is empty or parsing fails.
|
||||||
"""
|
"""
|
||||||
if not raw_status:
|
if not raw_status:
|
||||||
return None
|
return None
|
||||||
@@ -543,14 +543,14 @@ class OasisDevice:
|
|||||||
Set the device LED effect, color, speed, and brightness.
|
Set the device LED effect, color, speed, and brightness.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
led_effect (str | None): LED effect name; if None, the device's current effect is used. Must be one of the supported LED effects.
|
led_effect (str | None): LED effect name; if None, the device's current effect is used. Must be one of the supported LED effects.
|
||||||
color (str | None): Hex color string (e.g. "#rrggbb"); if None, the device's current color is used or `#ffffff` if unset.
|
color (str | None): Hex color string (e.g. "#rrggbb"); if None, the device's current color is used or `#ffffff` if unset.
|
||||||
led_speed (int | None): LED animation speed; if None, the device's current speed is used. Must be within the allowed LED speed range.
|
led_speed (int | None): LED animation speed; if None, the device's current speed is used. Must be within the allowed LED speed range.
|
||||||
brightness (int | None): Brightness level; if None, the device's current brightness is used. Must be between 0 and the device's `brightness_max`.
|
brightness (int | None): Brightness level; if None, the device's current brightness is used. Must be between 0 and the device's `brightness_max`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
ValueError: If `led_effect` is not supported, or `led_speed` or `brightness` are outside their valid ranges.
|
ValueError: If `led_effect` is not supported, or `led_speed` or `brightness` are outside their valid ranges.
|
||||||
RuntimeError: If no transport client is attached to the device.
|
RuntimeError: If no transport client is attached to the device.
|
||||||
"""
|
"""
|
||||||
if led_effect is None:
|
if led_effect is None:
|
||||||
led_effect = self.led_effect
|
led_effect = self.led_effect
|
||||||
@@ -590,8 +590,8 @@ class OasisDevice:
|
|||||||
Move a track within the device's playlist from one index to another.
|
Move a track within the device's playlist from one index to another.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
from_index (int): Index of the track to move within the current playlist.
|
from_index (int): Index of the track to move within the current playlist.
|
||||||
to_index (int): Destination index where the track should be placed.
|
to_index (int): Destination index where the track should be placed.
|
||||||
"""
|
"""
|
||||||
client = self._require_client()
|
client = self._require_client()
|
||||||
await client.async_send_move_job_command(self, from_index, to_index)
|
await client.async_send_move_job_command(self, from_index, to_index)
|
||||||
@@ -666,7 +666,7 @@ class OasisDevice:
|
|||||||
Initiates a firmware upgrade on the device.
|
Initiates a firmware upgrade on the device.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
beta (bool): If True, request a beta (pre-release) firmware; otherwise request the stable firmware.
|
beta (bool): If True, request a beta (pre-release) firmware; otherwise request the stable firmware.
|
||||||
"""
|
"""
|
||||||
client = self._require_client()
|
client = self._require_client()
|
||||||
await client.async_send_upgrade_command(self, beta)
|
await client.async_send_upgrade_command(self, beta)
|
||||||
|
|||||||
Reference in New Issue
Block a user