Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"set sleep auto off" #37

Merged
merged 5 commits into from
Jun 22, 2024
Merged

"set sleep auto off" #37

merged 5 commits into from
Jun 22, 2024

Conversation

vincentezw
Copy link
Contributor

@vincentezw vincentezw commented Jun 3, 2024

Thanks so much for your work on this. So far, it's working great. I was missing options for the "sleep" function though, which plays soothing sounds like a river, rain etc. for a set period of time.

This PR adds the two commands "set sleep auto off" and "set sleepscene listen".

The difference between the two, is that "sleep auto off" shows a "sleep light" and switches off after the set timeout.

I have no idea what devices support this, or don't, so I added this in the generic Divoom class. So far so good on my Timebox Evo.

@vincentezw vincentezw changed the title "set sleepscene listen" and "set sleep auto off" "set sleep auto off" Jun 4, 2024
@vincentezw
Copy link
Contributor Author

Update: I removed set sleepscene listen from the PR. This only plays a sound once. I think the app repeatedly calls this when navigating the different sound options.

The set sleep auto off works well on my Timebox. I did note that in the app, one can choose "standby" or "poweroff" after the time runs out. Whichever you've selected in the app, is what this command does. I'm not sure how we can influence that from the API. The set sleepscene (0x41) command does not work correctly on my device.

I correlated the "sleepmode" option to the following sounds:

1 Music
2 Midnight
3 Seashore
4 Cave
5 Music box
6 Fire
7 Meditation
8 Thunderstorm
9 Nightfall
10 Countryside
11 Creeks
12 wind
13 Relax
14 Birds
15 Frog
16 Lullaby
17 Rain 
18 Underwater
19 Garden
20 white noise?
21 Whisper?
22 Immerse 
23 Crystal

@d03n3rfr1tz3 d03n3rfr1tz3 self-assigned this Jun 5, 2024
@d03n3rfr1tz3
Copy link
Owner

Looks good. Thank you already for your contribution.

I'll test it as soon as I have a bit more time and maybe even add the FM frequency option. Might also be a good idea to also add it to my ESP32 thingy.
Regarding the support I would also have to guess. All audio-supported Divoom devices probably have that feature, which basically rules out the original Pixoo, which only has a buzzer.

@vincentezw
Copy link
Contributor Author

I'm happy to add an input for the FM frequency, if you like. I just wasn't sure what it would do here, or how it would be relevant, which is why I hardcoded it to 0x00.

@d03n3rfr1tz3
Copy link
Owner

well I'd probably just reuse the part from the alarm mode for example. I can't actually test it, but it should fit.

args += [int(frequency - 1000), int(frequency / 100)]

@vincentezw
Copy link
Contributor Author

well I'd probably just reuse the part from the alarm mode for example. I can't actually test it, but it should fit.

args += [int(frequency - 1000), int(frequency / 100)]

what I meant was: I didn't understand the purpose of the parameter on a mode for playing soothing sounds. I realise only now that falling asleep listening to the radio is a valid use-case too 😄
My unit does not have an FM radio, so I can't tophat this fully. But I abstracted the input parsing from the "alarm" into a shared method so this should be fine.

@d03n3rfr1tz3 d03n3rfr1tz3 merged commit 75f0521 into d03n3rfr1tz3:main Jun 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants