1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-11-13 15:43:52 -05:00

Add sleep button

This commit is contained in:
Nathan Spencer
2025-07-22 23:36:33 +00:00
parent 06008e8f4c
commit d2bc89bdd7
4 changed files with 21 additions and 0 deletions

View File

@@ -61,6 +61,11 @@ DESCRIPTORS = (
translation_key="random_track",
press_fn=play_random_track,
),
OasisMiniButtonEntityDescription(
key="sleep",
translation_key="sleep",
press_fn=lambda device: device.async_sleep(),
),
)

View File

@@ -20,9 +20,11 @@ STATUS_CODE_MAP = {
3: "centering",
4: "playing",
5: "paused",
6: "sleeping",
9: "error",
11: "updating",
13: "downloading",
14: "busy",
15: "live",
}
@@ -331,6 +333,10 @@ class OasisMini:
"""Set repeat playlist."""
await self._async_command(params={"WRIREPEATJOB": 1 if repeat else 0})
async def async_sleep(self) -> None:
"""Send sleep command."""
await self._async_command(params={"CMDSLEEP": ""})
async def async_stop(self) -> None:
"""Send stop command."""
await self._async_command(params={"CMDSTOP": ""})

View File

@@ -41,6 +41,9 @@
"button": {
"random_track": {
"name": "Play random track"
},
"sleep": {
"name": "Sleep"
}
},
"binary_sensor": {
@@ -93,9 +96,11 @@
"centering": "Centering",
"playing": "Playing",
"paused": "Paused",
"sleeping": "Sleeping",
"error": "Error",
"updating": "Updating",
"downloading": "Downloading",
"busy": "Busy",
"live": "Live drawing"
}
}

View File

@@ -41,6 +41,9 @@
"button": {
"random_track": {
"name": "Play random track"
},
"sleep": {
"name": "Sleep"
}
},
"binary_sensor": {
@@ -93,9 +96,11 @@
"centering": "Centering",
"playing": "Playing",
"paused": "Paused",
"sleeping": "Sleeping",
"error": "Error",
"updating": "Updating",
"downloading": "Downloading",
"busy": "Busy",
"live": "Live drawing"
}
}