mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-11-14 08:03:52 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3014f0f11c | ||
|
|
a44c035828 | ||
|
|
31276048dc | ||
|
|
742fc26a4f | ||
|
|
3acd45da9d | ||
|
|
a736c72c8e | ||
|
|
c87bb241ef |
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "pip" # See documentation for possible values
|
||||||
|
directory: "/" # Location of package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
@@ -1,6 +1,9 @@
|
|||||||

|
[](https://github.com/natekspencer/hacs-oasis_mini/releases)
|
||||||
[](https://ko-fi.com/natekspencer)
|
[](https://ko-fi.com/natekspencer)
|
||||||
[](https://github.com/hacs/integration)
|
[](https://github.com/hacs/integration)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://brands.home-assistant.io/oasis_mini/dark_logo.png">
|
<source media="(prefers-color-scheme: dark)" srcset="https://brands.home-assistant.io/oasis_mini/dark_logo.png">
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ async def add_and_play_track(device: OasisMini, track: int) -> None:
|
|||||||
|
|
||||||
# Move track to next item in the playlist and then select it
|
# Move track to next item in the playlist and then select it
|
||||||
if (index := device.playlist.index(track)) != device.playlist_index:
|
if (index := device.playlist.index(track)) != device.playlist_index:
|
||||||
if index != (_next := min(device.playlist_index + 1, len(device.playlist))):
|
if index != (_next := min(device.playlist_index + 1, len(device.playlist) - 1)):
|
||||||
await device.async_move_track(index, _next)
|
await device.async_move_track(index, _next)
|
||||||
await device.async_change_track(_next)
|
await device.async_change_track(_next)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from typing import Any, Awaitable, Callable, Final
|
|||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from aiohttp import ClientResponseError, ClientSession
|
from aiohttp import ClientResponseError, ClientSession
|
||||||
import async_timeout
|
|
||||||
|
|
||||||
from .utils import _bit_to_bool
|
from .utils import _bit_to_bool
|
||||||
|
|
||||||
@@ -177,12 +176,16 @@ class OasisMini:
|
|||||||
|
|
||||||
async def async_add_track_to_playlist(self, track: int) -> None:
|
async def async_add_track_to_playlist(self, track: int) -> None:
|
||||||
"""Add track to playlist."""
|
"""Add track to playlist."""
|
||||||
if track and 0 in self.playlist:
|
if not track:
|
||||||
|
return
|
||||||
|
|
||||||
|
if 0 in self.playlist:
|
||||||
playlist = [t for t in self.playlist if t] + [track]
|
playlist = [t for t in self.playlist if t] + [track]
|
||||||
await self.async_set_playlist(playlist)
|
return await self.async_set_playlist(playlist)
|
||||||
else:
|
|
||||||
await self._async_command(params={"ADDJOBLIST": track})
|
_LOGGER.debug("Adding track %s to playlist", track)
|
||||||
self.playlist.append(track)
|
await self._async_command(params={"ADDJOBLIST": track})
|
||||||
|
self.playlist.append(track)
|
||||||
|
|
||||||
async def async_change_track(self, index: int) -> None:
|
async def async_change_track(self, index: int) -> None:
|
||||||
"""Change the track."""
|
"""Change the track."""
|
||||||
@@ -192,7 +195,7 @@ class OasisMini:
|
|||||||
|
|
||||||
async def async_clear_playlist(self) -> None:
|
async def async_clear_playlist(self) -> None:
|
||||||
"""Clear the playlist."""
|
"""Clear the playlist."""
|
||||||
await self.async_set_playlist([0])
|
await self.async_set_playlist([])
|
||||||
|
|
||||||
async def async_get_ip_address(self) -> str | None:
|
async def async_get_ip_address(self) -> str | None:
|
||||||
"""Get the ip address."""
|
"""Get the ip address."""
|
||||||
@@ -400,11 +403,8 @@ class OasisMini:
|
|||||||
|
|
||||||
async def _async_command(self, **kwargs: Any) -> str | None:
|
async def _async_command(self, **kwargs: Any) -> str | None:
|
||||||
"""Send a command to the device."""
|
"""Send a command to the device."""
|
||||||
with async_timeout.timeout(5):
|
result = await self._async_get(**kwargs)
|
||||||
while self.busy:
|
_LOGGER.debug("Result: %s", result)
|
||||||
await asyncio.sleep(0.1)
|
|
||||||
result = await self._async_get(**kwargs)
|
|
||||||
_LOGGER.debug("Result: %s", result)
|
|
||||||
|
|
||||||
async def _async_get(self, **kwargs: Any) -> str | None:
|
async def _async_get(self, **kwargs: Any) -> str | None:
|
||||||
"""Perform a GET request."""
|
"""Perform a GET request."""
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"description": "Add your cloud credentials to get additional information about your Oasis Mini",
|
"description": "Add your cloud credentials to get additional information about your device",
|
||||||
"data": {
|
"data": {
|
||||||
"email": "[%key:common::config_flow::data::email%]",
|
"email": "[%key:common::config_flow::data::email%]",
|
||||||
"password": "[%key:common::config_flow::data::password%]"
|
"password": "[%key:common::config_flow::data::password%]"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"description": "Add your cloud credentials to get additional information about your Oasis Mini",
|
"description": "Add your cloud credentials to get additional information about your device",
|
||||||
"data": {
|
"data": {
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"password": "Password"
|
"password": "Password"
|
||||||
|
|||||||
Reference in New Issue
Block a user