From bfc20016e98813a590b77bb899b721550a6aaa4a Mon Sep 17 00:00:00 2001 From: 0x4d4d <20473294+0x4d4d@users.noreply.github.com> Date: Sat, 17 Jun 2023 12:55:27 +0200 Subject: [PATCH] [somneo] Add alarm support and other improvements (#14882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [somneo] Add alarm clock channels Signed-off-by: Michael Myrcik Signed-off-by: Jørgen Austvik --- bundles/org.openhab.binding.somneo/README.md | 219 +++++++-- .../internal/SomneoBindingConstants.java | 19 + .../somneo/internal/SomneoConfiguration.java | 1 + .../somneo/internal/SomneoHandler.java | 428 +++++++++++++++--- .../somneo/internal/SomneoHttpConnector.java | 175 ++++++- .../internal/model/AlarmSchedulesData.java | 89 ++++ .../internal/model/AlarmSettingsData.java | 352 ++++++++++++++ .../somneo/internal/model/AlarmStateData.java | 116 +++++ .../somneo/internal/model/RelaxData.java | 4 +- .../somneo/internal/model/SunsetData.java | 4 +- .../resources/OH-INF/i18n/somneo.properties | 120 ++++- .../resources/OH-INF/thing/thing-types.xml | 296 +++++++++++- .../main/resources/OH-INF/update/update.xml | 69 +++ 13 files changed, 1737 insertions(+), 155 deletions(-) create mode 100644 bundles/org.openhab.binding.somneo/src/main/java/org/openhab/binding/somneo/internal/model/AlarmSchedulesData.java create mode 100644 bundles/org.openhab.binding.somneo/src/main/java/org/openhab/binding/somneo/internal/model/AlarmSettingsData.java create mode 100644 bundles/org.openhab.binding.somneo/src/main/java/org/openhab/binding/somneo/internal/model/AlarmStateData.java create mode 100644 bundles/org.openhab.binding.somneo/src/main/resources/OH-INF/update/update.xml diff --git a/bundles/org.openhab.binding.somneo/README.md b/bundles/org.openhab.binding.somneo/README.md index 96887d9bc0c08..f2da92dc0ea4f 100644 --- a/bundles/org.openhab.binding.somneo/README.md +++ b/bundles/org.openhab.binding.somneo/README.md @@ -13,47 +13,62 @@ This binding does only support one Thing: The Philips Somneo thing requires the `hostname` it can connect to. Its API only allows HTTPS access, but unfortunately the SSL certificate is not trusted and must be ignored by the parameter. -| Parameter | Values | Default | -| --------------- | ------------------------------------ | ------- | -| hostname | Hostname or IP address of the device | - | -| port | Port number | 443 | -| refreshInterval | Interval the device is polled in sec | 30 | -| ignoreSSLErrors | Ignore SSL Errors | true | +| Parameter | Values | Default | +| ---------------------------- | ----------------------------------------------------------- | ------- | +| hostname | Hostname or IP address of the device | - | +| port | Port number | 443 | +| refreshInterval | Interval the device is polled in sec | 30 | +| refreshIntervalAlarmExtended | Interval the device is polled in sec (alarm clock settings) | 30 | +| ignoreSSLErrors | Ignore SSL Errors | true | ## Channels -| Channel | Type | Read/Write | Description | -| --------------------- | -------------------- | ---------- | ------------------------------------------------------ | -| _Sensor_ | | | | -| sensor#illuminance | Number:Illuminance | R | The current illuminance in lux | -| sensor#temperature | Number:Temperature | R | The current temperature | -| sensor#humidity | Number:Dimensionless | R | The current humidity in % | -| sensor#noise | Number:Dimensionless | R | The current noise in dB | -| _Light_ | | | | -| light#main | Switch | RW | Turn the light on, off and set the brightness | -| light#night | Switch | RW | Turn the night light on or off | -| _Sunset_ | | | | -| sunset#switch | Switch | RW | Turn the sunset program on or off | -| sunset#remainingTime | Number:Time | R | Remaining time from an activated program | -| sunset#lightIntensity | Dimmer | RW | Set the brightness during the sunset programme | -| sunset#duration | Number:Time | RW | The duration of sunset program in minutes | -| sunset#colorSchema | Number | RW | Choose a personal sunset | -| sunset#ambientNoise | String | RW | Ambient noise played during the sunset | -| sunset#volume | Dimmer | RW | Set the volume during the sunset programme | -| _Relax_ | | | | -| relax#switch | Switch | RW | Turn the relax breathe program on or off | -| relax#remainingTime | Number:Time | R | Remaining time from an activated program | -| relax#breathingRate | Number | RW | Breathing rate per minute during the relax program | -| relax#duration | Number:Time | RW | The duration of breathe program in minutes | -| relax#guidanceType | Number | RW | Select a breath guidance type during the relax program | -| relax#lightIntensity | Dimmer | RW | Set the brightness during the breathe programme | -| relax#volume | Dimmer | RW | Set the volume during the breathe programme | -| _Audio_ | | | | -| audio#radio | Player | RW | Controlling the radio and seeking for a frequency | -| audio#aux | Switch | RW | Turn the AUX input on or off | -| audio#volume | Dimmer | RW | Change the sound volume of the device | -| audio#preset | String | RW | The Device has 5 presets to store radio frequencies | -| audio#frequency | String | R | The currently selected radio frequency | +| Channel | Type | Read/Write | Description | +| ------------------------- | -------------------- | ---------- | ------------------------------------------------------- | +| _Sensor_ | | | | +| sensor#illuminance | Number:Illuminance | R | The current illuminance in lux | +| sensor#temperature | Number:Temperature | R | The current temperature | +| sensor#humidity | Number:Dimensionless | R | The current humidity in % | +| sensor#noise | Number:Dimensionless | R | The current noise in dB | +| _Light_ | | | | +| light#main | Switch | RW | Turn the light on, off and set the brightness | +| light#night | Switch | RW | Turn the night light on or off | +| _Sunset_ | | | | +| sunset#switch | Switch | RW | Turn the sunset program on or off | +| sunset#remainingTime | Number:Time | R | Remaining time from an activated program | +| sunset#lightIntensity | Dimmer | RW | Set the brightness during the sunset programme | +| sunset#duration | Number:Time | RW | The duration of sunset program in minutes | +| sunset#colorSchema | Number | RW | Choose a personal sunset | +| sunset#ambientNoise | String | RW | Ambient noise played during the sunset | +| sunset#volume | Dimmer | RW | Set the volume during the sunset programme | +| _Relax_ | | | | +| relax#switch | Switch | RW | Turn the relax breathe program on or off | +| relax#remainingTime | Number:Time | R | Remaining time from an activated program | +| relax#breathingRate | Number | RW | Breathing rate per minute during the relax program | +| relax#duration | Number:Time | RW | The duration of breathe program in minutes | +| relax#guidanceType | Number | RW | Select a breath guidance type during the relax program | +| relax#lightIntensity | Dimmer | RW | Set the brightness during the breathe programme | +| relax#volume | Dimmer | RW | Set the volume during the breathe programme | +| _Audio_ | | | | +| audio#radio | Player | RW | Controlling the radio and seeking for a frequency | +| audio#aux | Switch | RW | Turn the AUX input on or off | +| audio#volume | Dimmer | RW | Change the sound volume of the device | +| audio#preset | String | RW | The Device has 5 presets to store radio frequencies | +| audio#frequency | String | R | The currently selected radio frequency | +| _Alarm_ | | | | +| alarm#snooze | Number:Time | RW | The duration of the snooze function in minutes | +| _Alarm[1...16]_ | | | | +| alarm[]#configured | Switch | RW | The duration of the snooze function in minutes | +| alarm[]#switch | Switch | RW | Turn the alarm clock on or off | +| alarm[]#repeatDay | Number | RW | The days on which the alarm is repeated | +| alarm[]#alarmTime | DateTime | RW | Alarm clock time | +| alarm[]#powerWake | Switch | RW | Turn the power wake on or off | +| alarm[]#powerWakeDelay | Number:Time | RW | How long after the normal alarm should Power Wake start | +| alarm[]#sunriseDuration | Number:Time | RW | The duration of sunrise program in minutes | +| alarm[]#sunriseBrightness | Dimmer | RW | The channel allows to set the sunrise light intensity | +| alarm[]#sunriseSchema | Number | RW | Choose a personal sunrise | +| alarm[]#sound | String | RW | The type of sound used for the alarm sound | +| alarm[]#volume | Dimmer | RW | Change the sound volume of the alarm clock | ## Full Example @@ -96,6 +111,59 @@ Switch PhilipsSomneo_AudioAux "AUX-Input" ["Switch", "P Dimmer PhilipsSomneo_AudioVolume "Volume" ["Control", "SoundVolume"] { channel="somneo:hf367x:1:audio#volume" } String PhilipsSomneo_AudioPreset "FM Preset" ["Control"] { channel="somneo:hf367x:1:audio#preset" } String PhilipsSomneo_AudioFrequency "FM Frequency" ["Status"] { channel="somneo:hf367x:1:audio#frequency" } +// Alarm +Number:Time PhilipsSomneo_AlarmSnooze "Alarm Snooze" ["Control", "Duration"] { channel="somneo:hf367x:1:alarm#snooze" } + +Switch PhilipsSomneo_Alarm1Switch "Alarm Clock" ["Switch", "Power"] { channel="somneo:hf367x:1:alarm1#switch" } +DateTime PhilipsSomneo_Alarm1Time "Alarm Clock Time"