theneweinstein / somneo

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

Fix set_sound_alarm service parameters #26

Closed anttilip closed 1 year ago

anttilip commented 1 year ago

The set_sound_alarm service is currently broken and calling it with parameters following parameters:

source: wake-up
channel: forest birds
level: 10

raises KeyError: 10. This is caused by pysomneo defining the order of arguments in a different order than async_set_sound_alarm calling it (level and channel are in the opposite order).

This PR fixes the issue by setting async_set_sound_alarm to call self.set_sound_alarm instead of directly calling pysomneo function. set_sound_alarm avoids this issue by using keyworded arguments.

Additionally, the README example for somneo.set_sound_alarm had the wrong parameters so this fixes them too.

Tested on my hass setup and seems to be working fine.