theneweinstein / somneo

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

No way to select specific days #42

Closed wleese closed 10 months ago

wleese commented 10 months ago

When I used SleepMapper to set an alarm, I select certain days for that alarm. I've just added the integration, but see that for my alarm select.somneo_wakeup_light_alarm0_days has value Unknown.

I'd expect to see the day I selected for this alarm, and the ability to change it via this integration.

If there's anything I can do to help debug, let me know :)

theneweinstein commented 10 months ago

That is indeed true, as I haven't found a nice way around it. HomeAssistant does not support multi-selects. So if I want to allow all possible combination of days, that would end-up at 127 possibilities per alarm. I choose to support a limited set (weekdays, weekends, everyday and tomorrow) which I think suits most needs. I could add the individual days (so 7 extra possibilities), but adding all combinations I don't see as a good option.

If HomeAssistant supports multi-select entities, I will implement this for the alarm days (see e.g. https://community.home-assistant.io/t/wth-dont-we-have-a-helper-selector-that-allows-multiple-selections/467657).

Maybe you have other ideas how to implement this (without breaking current functionality).

wleese commented 10 months ago

Perhaps an additional text input field/entity (accepting day numbers where 0 = Monday, or strings such as MON, TUE, all comma separated) that gets used when the current days value == “custom”? I guess because you’ve already implemented several possibilities already, an additional field focussing on the last missing feature would be fair.

My use case is that I need to set an alarm for different times depending on the day. So the Monday and Tuesday alarm differs from the Wednesday alarm, which again differs from Thursday and Friday. SleepMapper does this fine obviously with its dropdown+checkbox widget.

theneweinstein commented 10 months ago

I was thinking something similar yesterday, if I find some time I will try to implement this. Likely it will be a comma-seperated list of days.

wleese commented 10 months ago

That’d be awesome. If you manage it and have a digital tip jar, I’d love to leave a tip.

theneweinstein commented 10 months ago

I've been playing around with it today and update the master tree. I created a text input where you can list the days (3 letter abbreviations) the alarm should be ringing. This list should be comma-seperated without white-spaces. I did some quick checks at home and it seems to be working. Could you have a look if it works fine like this (download the master version)? Let me know if it works, I will create a new release with this function.

wleese commented 10 months ago

It looks great! I tested it by using the entities in HA, checking to see if the changes were reflected in SleepMapper, and then reverse: were changes in SleepMapper reflected in HA. And it works perfectly so far.

Thank you!