theneweinstein / somneo

Home Assistant custom component for Philips Someo
32 stars 18 forks source link

Add sunset functionality - is it possible? #49

Closed cbundy closed 6 months ago

cbundy commented 7 months ago

Hi,

I typically use the sunset function via the app in the evenings - is it possible to start this function via this integration? I saw this PR but it was closed without any comments https://github.com/theneweinstein/somneo/pull/28

If it can be done, but you don't have time, I will try to add this myself but I may need some guidance first on how you are finding the APIs (decompile the app?) and any pointers on the device that may be helpful.

cbundy commented 7 months ago

I have dug into the integration today and I realize you are using the pysomneo library - this does include some functionality for the sunset functionality.

I've tested an easy version of this with a button to begin the sunset feature, I'm open to other UX for it as well (e.g. does it make sense to represent it as a switch?).

theneweinstein commented 7 months ago

Indeed, the pysomneo library (partially) supports this. I'm not sure if you also need to set a timer for the sunset function, that cannot be done yet with pysomneo. Secondly, the status (whether sunset is on or off) is not made available in the data structure send to home assistant, that needs to be added too. I think a switch might be better so you also can turn the sunset off. I will see if I have some time the coming days to implement this, but feel free to start already I can build upon that work.

cbundy commented 7 months ago

Thanks, I'll get a PR up this week with something to start.

The library contains enough to start and stop sunset, and from this it can also derive whether its active from my quick test yesterday.

Additionally, starting requires no parameters, there are settings for sunset but these are configured separately. If you ask it to start, it starts with your last used settings.

Ideally I'd enjoy having them configurable, it's actually something that would suit a service call like the built-in turn on lights service - where you can override properties such as starting volume, starting brightness before it begins. But this is my first work on a HA integration so I'll start off slowly...

theneweinstein commented 7 months ago

Hi, I've been working on the pysomneo library and added support for changing the settings (next to a big rewrite of the code). I've also make a first attempt to integrate this into the component, but only did some basic tests so far. I released it as a beta version (v6.0.0beta2). You can have a look and test for yourself as well, but there might be bugs left in the code.

theneweinstein commented 6 months ago

Added in v2024.1.0

cbundy commented 6 months ago

Thank you so much - I made some progress but haven't been able to come back to it and now I see you've added it 🙏