homebridge-sleep-wake 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +371 -0
- package/config.schema.json +1193 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/requestedAccessory.d.ts +14 -0
- package/dist/lib/requestedAccessory.d.ts.map +1 -0
- package/dist/lib/requestedAccessory.js +18 -0
- package/dist/lib/requestedAccessory.js.map +1 -0
- package/dist/lib/somneoAccessory.d.ts +15 -0
- package/dist/lib/somneoAccessory.d.ts.map +1 -0
- package/dist/lib/somneoAccessory.js +19 -0
- package/dist/lib/somneoAccessory.js.map +1 -0
- package/dist/lib/somneoAudioAccessory.d.ts +31 -0
- package/dist/lib/somneoAudioAccessory.d.ts.map +1 -0
- package/dist/lib/somneoAudioAccessory.js +238 -0
- package/dist/lib/somneoAudioAccessory.js.map +1 -0
- package/dist/lib/somneoBinaryAccessory.d.ts +14 -0
- package/dist/lib/somneoBinaryAccessory.d.ts.map +1 -0
- package/dist/lib/somneoBinaryAccessory.js +59 -0
- package/dist/lib/somneoBinaryAccessory.js.map +1 -0
- package/dist/lib/somneoClock.d.ts +57 -0
- package/dist/lib/somneoClock.d.ts.map +1 -0
- package/dist/lib/somneoClock.js +285 -0
- package/dist/lib/somneoClock.js.map +1 -0
- package/dist/lib/somneoConfigDataTypes.d.ts +63 -0
- package/dist/lib/somneoConfigDataTypes.d.ts.map +1 -0
- package/dist/lib/somneoConfigDataTypes.js +3 -0
- package/dist/lib/somneoConfigDataTypes.js.map +1 -0
- package/dist/lib/somneoConstants.d.ts +85 -0
- package/dist/lib/somneoConstants.d.ts.map +1 -0
- package/dist/lib/somneoConstants.js +121 -0
- package/dist/lib/somneoConstants.js.map +1 -0
- package/dist/lib/somneoDimmableLightAccessory.d.ts +14 -0
- package/dist/lib/somneoDimmableLightAccessory.d.ts.map +1 -0
- package/dist/lib/somneoDimmableLightAccessory.js +44 -0
- package/dist/lib/somneoDimmableLightAccessory.js.map +1 -0
- package/dist/lib/somneoLightAccessory.d.ts +13 -0
- package/dist/lib/somneoLightAccessory.d.ts.map +1 -0
- package/dist/lib/somneoLightAccessory.js +32 -0
- package/dist/lib/somneoLightAccessory.js.map +1 -0
- package/dist/lib/somneoMainLightAccessory.d.ts +14 -0
- package/dist/lib/somneoMainLightAccessory.d.ts.map +1 -0
- package/dist/lib/somneoMainLightAccessory.js +66 -0
- package/dist/lib/somneoMainLightAccessory.js.map +1 -0
- package/dist/lib/somneoMomentarySwitchAccessory.d.ts +11 -0
- package/dist/lib/somneoMomentarySwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoMomentarySwitchAccessory.js +43 -0
- package/dist/lib/somneoMomentarySwitchAccessory.js.map +1 -0
- package/dist/lib/somneoNightLightAccessory.d.ts +13 -0
- package/dist/lib/somneoNightLightAccessory.d.ts.map +1 -0
- package/dist/lib/somneoNightLightAccessory.js +54 -0
- package/dist/lib/somneoNightLightAccessory.js.map +1 -0
- package/dist/lib/somneoRelaxBreatheSwitchAccessory.d.ts +8 -0
- package/dist/lib/somneoRelaxBreatheSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoRelaxBreatheSwitchAccessory.js +52 -0
- package/dist/lib/somneoRelaxBreatheSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoSensorAccessory.d.ts +25 -0
- package/dist/lib/somneoSensorAccessory.d.ts.map +1 -0
- package/dist/lib/somneoSensorAccessory.js +142 -0
- package/dist/lib/somneoSensorAccessory.js.map +1 -0
- package/dist/lib/somneoService.d.ts +36 -0
- package/dist/lib/somneoService.d.ts.map +1 -0
- package/dist/lib/somneoService.js +161 -0
- package/dist/lib/somneoService.js.map +1 -0
- package/dist/lib/somneoServiceDataTypes.d.ts +69 -0
- package/dist/lib/somneoServiceDataTypes.d.ts.map +1 -0
- package/dist/lib/somneoServiceDataTypes.js +3 -0
- package/dist/lib/somneoServiceDataTypes.js.map +1 -0
- package/dist/lib/somneoSunsetSwitchAccessory.d.ts +8 -0
- package/dist/lib/somneoSunsetSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoSunsetSwitchAccessory.js +52 -0
- package/dist/lib/somneoSunsetSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoSwitchAccessory.d.ts +13 -0
- package/dist/lib/somneoSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoSwitchAccessory.js +32 -0
- package/dist/lib/somneoSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoWakeAlarmDismissSwitchAccessory.d.ts +6 -0
- package/dist/lib/somneoWakeAlarmDismissSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoWakeAlarmDismissSwitchAccessory.js +15 -0
- package/dist/lib/somneoWakeAlarmDismissSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoWakeAlarmSnoozeSwitchAccessory.d.ts +6 -0
- package/dist/lib/somneoWakeAlarmSnoozeSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoWakeAlarmSnoozeSwitchAccessory.js +15 -0
- package/dist/lib/somneoWakeAlarmSnoozeSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoWakeAlarmSwitchAccessory.d.ts +9 -0
- package/dist/lib/somneoWakeAlarmSwitchAccessory.d.ts.map +1 -0
- package/dist/lib/somneoWakeAlarmSwitchAccessory.js +43 -0
- package/dist/lib/somneoWakeAlarmSwitchAccessory.js.map +1 -0
- package/dist/lib/somneoWebhookServer.d.ts +36 -0
- package/dist/lib/somneoWebhookServer.d.ts.map +1 -0
- package/dist/lib/somneoWebhookServer.js +576 -0
- package/dist/lib/somneoWebhookServer.js.map +1 -0
- package/dist/lib/userSettings.d.ts +16 -0
- package/dist/lib/userSettings.d.ts.map +1 -0
- package/dist/lib/userSettings.js +65 -0
- package/dist/lib/userSettings.js.map +1 -0
- package/dist/settings.d.ts +9 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +12 -0
- package/dist/settings.js.map +1 -0
- package/dist/somneoPlatform.d.ts +22 -0
- package/dist/somneoPlatform.d.ts.map +1 -0
- package/dist/somneoPlatform.js +131 -0
- package/dist/somneoPlatform.js.map +1 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
# homebridge-sleep-wake
|
|
2
|
+
|
|
3
|
+
## What This Plugin Is
|
|
4
|
+
This is a plugin for [homebridge](https://github.com/homebridge/homebridge). It allows for management of the [Philips Somneo HF3670/60](https://www.usa.philips.com/c-p/HF3670_60/smartsleep-connected-sleep-and-wake-up-light). Additionally, it provides sensor data from the clock.
|
|
5
|
+
|
|
6
|
+
## How the Plugin Works
|
|
7
|
+
The Somneo Clock has a small HTTP server running inside with a limited API. Through Googling and trial-and-error, I've found commands that work to replicate the SleepMapper app.
|
|
8
|
+
|
|
9
|
+
This server is very low powered though and if you see error messages in your logs it's most likely that two connections were trying to be processed at once.
|
|
10
|
+
|
|
11
|
+
### Conflicting Accessories
|
|
12
|
+
|
|
13
|
+
In the physical world, the Somneo clock is a single device. But in the HomeBridge world, it is multiple. For this reason, I've created the concept of *Conflicting Accessories*.
|
|
14
|
+
|
|
15
|
+
A *Conflicting Accessory* means an accessory that needs full control over a physical device. In the case of the Somneo clock, there are two physical devices:
|
|
16
|
+
|
|
17
|
+
1. The LED light.
|
|
18
|
+
2. The audio speaker.
|
|
19
|
+
|
|
20
|
+
If a program requires light, it will turn off all other devices that require light. If it requires audio it will turn off all that require audio.
|
|
21
|
+
|
|
22
|
+
Below, is a chart explaining what will be turned off (if on) when an accessory is turned on.
|
|
23
|
+
|
|
24
|
+
| | Main Light | Night Light | Sunset Program | RelaxBreathe Program | Audio |
|
|
25
|
+
| --- | :---: | :----------: | :------------: | :------------------: | :---: |
|
|
26
|
+
| Main Light<br />Turns On | N/A | **Turns Off** | **Turns Off** | **Turns Off** | Unaffected |
|
|
27
|
+
| Night Light<br />Turns On| **Turns Off** | N/A | **Turns Off** | **Turns Off** | Unaffected |
|
|
28
|
+
| Sunset <br />Turns On | **Turns Off** | **Turns Off** | N/A | **Turns Off** | **Turns Off**
|
|
29
|
+
| RelaxBreathe<br />Turns On | **Turns Off** | **Turns Off** | **Turns Off** | N/A | **Turns Off**|
|
|
30
|
+
| Audio<br/>Turns On | Unaffected | Unaffected | **Turns Off** | **Turns Off** | N/A
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Before installing this plugin, you should install Homebridge using the [official instructions](https://github.com/homebridge/homebridge/wiki).
|
|
35
|
+
|
|
36
|
+
### Install via Homebridge Config UI X
|
|
37
|
+
|
|
38
|
+
1. Search for `Homebridge Sleep Wake` on the Plugins tab of [Config UI X](https://www.npmjs.com/package/homebridge-config-ui-x).
|
|
39
|
+
2. Install the `Homebridge Sleep Wake` plugin and use the form to enter your configuration.
|
|
40
|
+
|
|
41
|
+
### Manual Installation
|
|
42
|
+
|
|
43
|
+
1. Install this plugin using: `sudo npm install -g homebridge-sleep-wake --unsafe-perm`.
|
|
44
|
+
2. Edit `config.json` manually to add your information. See below for instructions on that.
|
|
45
|
+
|
|
46
|
+
## Manual Configuration
|
|
47
|
+
|
|
48
|
+
### Platform Schema
|
|
49
|
+
|
|
50
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
51
|
+
| ------| :------: | :--------: | ----------------------------- | :----------: |
|
|
52
|
+
| **platform** | *Yes* | string | Must always be set to `HomebridgeSomneo`.| N/A |
|
|
53
|
+
| **name** | *Yes* | string | Set the platform name for display in the Homebridge logs. | `Homebridge Sleep Wake` |
|
|
54
|
+
| **somneos** | *Yes* | object[] | An array of configurations for Somneo clocks | N/A |
|
|
55
|
+
| **pollingSeconds**| No | number | Time in seconds for how often to ping the clock. | `30` (30000 milliseconds) |
|
|
56
|
+
| **webhookApi**| No | object | Optional local HTTP API for Shortcuts and other LAN automations. | Disabled |
|
|
57
|
+
|
|
58
|
+
#### WebhookApi Schema
|
|
59
|
+
|
|
60
|
+
Use this when you want iPhone Shortcuts to control alarms. The Somneo itself uses self-signed HTTPS, so iPhone Shortcuts cannot call it directly. This local HTTP API runs on the Homebridge machine and proxies simple alarm requests to the native Somneo wake endpoints.
|
|
61
|
+
|
|
62
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
63
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
64
|
+
| **isEnabled** | No | boolean | Enables the local webhook API. | `false` |
|
|
65
|
+
| **bindHost** | No | string | Host/IP address to bind the local API to. Use `0.0.0.0` to allow requests from your iPhone on the same LAN. | `0.0.0.0` |
|
|
66
|
+
| **port** | No | number | TCP port for the local API server. | `8585` |
|
|
67
|
+
| **token** | No | string | Optional shared secret. If set, send it as a Bearer token, `X-Somneo-Token` header, or `token` query parameter. | Unset |
|
|
68
|
+
|
|
69
|
+
#### Somneo Schema
|
|
70
|
+
|
|
71
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
72
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
73
|
+
| **name** | *Yes* | string | The name of the clock. It will be used as a prefix for all of the accessories it exposes. | N/A |
|
|
74
|
+
| **host** | *Yes* | string | IP address or hostname of the Somneo clock. | N/A |
|
|
75
|
+
| **sensors** | *Yes* | object | Settings for sensors in the Somneo clock. | N/A |
|
|
76
|
+
| **lights** | *Yes* | object | Settings for lights in the Somneo clock. | N/A |
|
|
77
|
+
| **switches** | *Yes* | object | Settings for switches in the Somneo clock. | N/A |
|
|
78
|
+
| **audio** | *Yes* | object | Settings for the audio device in the Somneo clock. | N/A |
|
|
79
|
+
|
|
80
|
+
##### Sensors Schema
|
|
81
|
+
|
|
82
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
83
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
84
|
+
| **humidity** | *Yes* | object | Settings for the humidity sensor. | N/A |
|
|
85
|
+
| **lux** | *Yes* | object | Settings for the lux (light) sensor. | N/A |
|
|
86
|
+
| **temperature** | *Yes* | object | Settings for the temperature sensor. | N/A |
|
|
87
|
+
|
|
88
|
+
###### Humidity Schema
|
|
89
|
+
|
|
90
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
91
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
92
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the humidity sensor. | `true` |
|
|
93
|
+
|
|
94
|
+
###### Lux Schema
|
|
95
|
+
|
|
96
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
97
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
98
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the lux (light) sensor. | `true` |
|
|
99
|
+
|
|
100
|
+
###### Temperature Schema
|
|
101
|
+
|
|
102
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
103
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
104
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the temperature sensor. | `true` |
|
|
105
|
+
|
|
106
|
+
##### Lights Schema
|
|
107
|
+
|
|
108
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
109
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
110
|
+
| **mainLight** | *Yes* | object | Settings for the main (dimmable) light. | N/A |
|
|
111
|
+
| **nightLight** | *Yes* | object | Settings for the (on/off) night light. | N/A |
|
|
112
|
+
|
|
113
|
+
###### MainLight Schema
|
|
114
|
+
|
|
115
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
116
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
117
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the main light. | `true` |
|
|
118
|
+
|
|
119
|
+
###### NightLight Schema
|
|
120
|
+
|
|
121
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
122
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
123
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the night light. | `true` |
|
|
124
|
+
|
|
125
|
+
##### Switches Schema
|
|
126
|
+
|
|
127
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
128
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
129
|
+
| **relaxBreathe** | *Yes* | object | Settings for the RelaxBreathe Program switch. | N/A |
|
|
130
|
+
| **sunset** | *Yes* | object | Settings for the Sunset Program switch. | N/A |
|
|
131
|
+
| **wakeAlarm** | No | object | Settings for native wake alarm controls. | Disabled |
|
|
132
|
+
|
|
133
|
+
###### RelaxBreathe Schema
|
|
134
|
+
|
|
135
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
136
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
137
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the RelaxBreathe Program switch. | `true` |
|
|
138
|
+
| **breathsPerMin**| No| number | How many breaths you want to take per minute. | `4` (BPM converted to the Philips value 1) |
|
|
139
|
+
| **duration** | No | number | How long the RelaxBreathe Program should run for. | `10` (minutes) |
|
|
140
|
+
| **guidanceType** | No | number | What kind of guided RelaxBreathe program to run.<br /><br />Possible values:<ul><li>Light = `0`</li><li>Sound = `1`</li></ul> | `0` (Light) |
|
|
141
|
+
| **lightIntensity** | No | number | How bright the RelaxBreathe Program be at its peak. The value is a percentage that will be converted to a number between `1 and 25`. | `80` (80% converted to the the Philips API value 20) |
|
|
142
|
+
| **volume** | No | number | How loud the RelaxBreathe Program should be at its peak. The value is a percentage that will be converted to a number between `1 and 25`. | `48` (48% converted to the the Philips API value 12) |
|
|
143
|
+
|
|
144
|
+
###### Sunset Schema
|
|
145
|
+
|
|
146
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
147
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
148
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the Sunset Program switch. | `true` |
|
|
149
|
+
| **duration** | No | number | How long the Sunset Program should run for. | `30` (minutes) |
|
|
150
|
+
| **lightIntensity** | No | number | How bright the Sunset Program be at the start. The value is a percentage that will be converted to a number between `1 and 25`. | `80` (80% converted to the the Philips API value 20) |
|
|
151
|
+
| **colorScheme** | No | string | What color pattern should play during the Sunset Program.<br /><br />Possible values:<ul><li>Sunny Day = `'0'`</li><li>Island Red = `'1'`</li><li>Nordic White = `'2'`</li><li>Carribean Red = `'3'`</li></ul> | `'0'` (Sunny Day) |
|
|
152
|
+
| **ambientSounds** | No | string | What sounds should play during the Sunset Program.<br /><br />Possible values:<ul><li>Soft Rain = `'1'`</li><li>Ocean Waves = `'2'`</li><li>Under Water = `'3'`</li><li>Summer Lake = `'4'`</li><li>No Sound = `'0'`</li></ul> | `'1'` (Soft Rain) |
|
|
153
|
+
| **volume** | No | number | How loud the Sunset Program should be at the start. The value is a percentage that will be converted to a number between `1 and 25`. | `48` (48% converted to the the Philips API value 12) |
|
|
154
|
+
|
|
155
|
+
###### WakeAlarm Schema
|
|
156
|
+
|
|
157
|
+
The Wake Alarm controls the currently configured Somneo wake profile. Use the Philips app to set the wake time, days, sunrise ramp, and sound. HomeKit can then arm/disarm that profile and optionally expose native snooze and dismiss actions.
|
|
158
|
+
|
|
159
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
160
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
161
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the main Wake Alarm switch. | `false` |
|
|
162
|
+
| **showSnoozeSwitch** | No | boolean | Exposes a momentary `Snooze Alarm` switch that sends the native snooze action. Useful in Favorites or scenes while an alarm is active. | `false` |
|
|
163
|
+
| **showDismissSwitch** | No | boolean | Exposes a momentary `Dismiss Alarm` switch that sends the native dismiss action. Useful in Favorites or scenes while an alarm is active. | `false` |
|
|
164
|
+
|
|
165
|
+
##### Audio Schema
|
|
166
|
+
|
|
167
|
+
| Field | Required | Data Type | Description | Default Value |
|
|
168
|
+
| ------| :------: | :-------: | ----------------------------- | :-----------: |
|
|
169
|
+
| **isEnabled** | No | boolean | Determines whether or not to expose the Audio Device. | `true` |
|
|
170
|
+
| **favoriteInput** | No | number | Numeric value specifying the input for the Somneo Audio to go to the first time its turned on in a session.<br /><br />After changing the input, the Somneo will go to the last used input.<br /><br />Possible values:<ul><li>FM Preset 1 = `1`</li><li>FM Preset 2 = `2`</li><li>FM Preset 3 = `3`</li><li>FM Preset 4 = `4`</li><li>FM Preset 5 = `5`</li><li>Auxiliary = `6`</li></ul> | `1` (FM Preset 1) |
|
|
171
|
+
|
|
172
|
+
### Somneo Audio Device Note
|
|
173
|
+
|
|
174
|
+
The Somneo clock has 5 FM radio presets and an auxiliary input. To help accomodate this, an audio receiver called `Somneo Audio` is available. You can turn in on and it will default to `FM Preset 1`. Additionally, you can raise and lower the volume with the Remote widget in iOS/iPadOS's Control Center.
|
|
175
|
+
|
|
176
|
+
However, due the way that audio receivers are implemented in Homebridge, they must be exposed as an *External Plugin*. This means that the `Somneo Audio` will need to be onboarded separately from the other accessories.
|
|
177
|
+
|
|
178
|
+
#### Onboarding Instructions for Somneo Audio
|
|
179
|
+
|
|
180
|
+
1. Select `Add Accessory` in the Home app.
|
|
181
|
+
2. Then select `I Don't Have a Code or Cannot Scan`.
|
|
182
|
+
3. Then the `Somneo Audio` receiver should show as an option. It should look like:
|
|
183
|
+
<img src="https://user-images.githubusercontent.com/5261774/112217388-f5632d80-8bf8-11eb-83e1-2ce41e83fd20.jpg" width="320" />
|
|
184
|
+
4. Enter your Homebridge PIN and the device will connect to your home.
|
|
185
|
+
|
|
186
|
+
### Config Examples
|
|
187
|
+
|
|
188
|
+
#### Simplest Configuration
|
|
189
|
+
|
|
190
|
+
This configuration will expose all items and use the default polling interval with the least work.
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"name": "Homebridge Somneo",
|
|
195
|
+
"somneos": [
|
|
196
|
+
{
|
|
197
|
+
"name": "Master Bedroom Somneo",
|
|
198
|
+
"host": "[INSERT_IP_ADDRESS_HERE]"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"platform": "HomebridgeSomneo"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### Most Verbose Configuration
|
|
206
|
+
|
|
207
|
+
This configuration will expose all items with default values, but is very verbose. It is presented here to help visualize the JSON structure.
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"name": "Homebridge Somneo",
|
|
212
|
+
"somneos": [
|
|
213
|
+
{
|
|
214
|
+
"name": "Master Bedroom Somneo",
|
|
215
|
+
"host": "[INSERT_IP_ADDRESS_HERE]",
|
|
216
|
+
"sensors": {
|
|
217
|
+
"humidity": {
|
|
218
|
+
"isEnabled": true
|
|
219
|
+
},
|
|
220
|
+
"lux": {
|
|
221
|
+
"isEnabled": true
|
|
222
|
+
},
|
|
223
|
+
"temperature": {
|
|
224
|
+
"isEnabled": true
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"lights": {
|
|
228
|
+
"mainLight": {
|
|
229
|
+
"isEnabled": true
|
|
230
|
+
},
|
|
231
|
+
"nightLight": {
|
|
232
|
+
"isEnabled": true
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"switches": {
|
|
236
|
+
"relaxBreathe": {
|
|
237
|
+
"isEnabled": true,
|
|
238
|
+
"breathsPerMin": 4,
|
|
239
|
+
"duration": 10,
|
|
240
|
+
"guidanceType": 0,
|
|
241
|
+
"lightIntensity": 80,
|
|
242
|
+
"volume": 48
|
|
243
|
+
},
|
|
244
|
+
"sunset": {
|
|
245
|
+
"isEnabled": true,
|
|
246
|
+
"duration": 30,
|
|
247
|
+
"lightIntensity": 80,
|
|
248
|
+
"colorScheme": 0,
|
|
249
|
+
"ambientSounds": "1",
|
|
250
|
+
"volume": 48
|
|
251
|
+
},
|
|
252
|
+
"wakeAlarm": {
|
|
253
|
+
"isEnabled": true,
|
|
254
|
+
"showSnoozeSwitch": false,
|
|
255
|
+
"showDismissSwitch": false
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"audio": {
|
|
259
|
+
"isEnabled": true,
|
|
260
|
+
"favoriteInput": 1
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"pollingSeconds": 30,
|
|
265
|
+
"webhookApi": {
|
|
266
|
+
"isEnabled": true,
|
|
267
|
+
"bindHost": "0.0.0.0",
|
|
268
|
+
"port": 8585,
|
|
269
|
+
"token": "replace-me"
|
|
270
|
+
},
|
|
271
|
+
"platform": "HomebridgeSomneo"
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Local Shortcut API
|
|
276
|
+
|
|
277
|
+
Base URL:
|
|
278
|
+
|
|
279
|
+
```text
|
|
280
|
+
http://homebridge.local:8585/somneo/v1
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
If only one Somneo clock is configured, the `clock` field is optional. If multiple clocks are configured, set `clock` to the configured clock name or host.
|
|
284
|
+
|
|
285
|
+
If `webhookApi.token` is configured, include it in one of these ways:
|
|
286
|
+
|
|
287
|
+
- Query string: `?token=replace-me`
|
|
288
|
+
- Header: `Authorization: Bearer replace-me`
|
|
289
|
+
- Header: `X-Somneo-Token: replace-me`
|
|
290
|
+
|
|
291
|
+
### Endpoints
|
|
292
|
+
|
|
293
|
+
| Method | Path | Purpose |
|
|
294
|
+
| ------ | ---- | ------- |
|
|
295
|
+
| `GET` | `/somneo/v1/health` | Health check for the local API server. |
|
|
296
|
+
| `GET` | `/somneo/v1/clocks` | Lists configured Somneo clocks. |
|
|
297
|
+
| `GET` | `/somneo/v1/alarm` | Reads the current Somneo wake alarm. |
|
|
298
|
+
| `GET` | `/somneo/v1/alarm/set?time=07:00` | Shortcut-friendly create/update endpoint using query parameters. |
|
|
299
|
+
| `POST` / `PUT` | `/somneo/v1/alarm` | Create or update the current Somneo wake alarm with JSON. |
|
|
300
|
+
| `POST` / `GET` | `/somneo/v1/alarm/enable` | Arm the current wake alarm profile. |
|
|
301
|
+
| `POST` / `GET` | `/somneo/v1/alarm/disable` | Disarm the current wake alarm profile. |
|
|
302
|
+
| `DELETE` | `/somneo/v1/alarm` | Delete alias. This disables the current wake alarm profile and keeps the saved settings. |
|
|
303
|
+
| `POST` / `GET` | `/somneo/v1/alarm/delete` | Same as `DELETE /somneo/v1/alarm`. |
|
|
304
|
+
| `POST` / `GET` | `/somneo/v1/alarm/snooze` | Sends the native Somneo snooze action. |
|
|
305
|
+
| `POST` / `GET` | `/somneo/v1/alarm/dismiss` | Sends the native Somneo dismiss action. |
|
|
306
|
+
| `POST` / `GET` | `/somneo/v1/alarm/snooze-duration` | Sets the global snooze duration in minutes. |
|
|
307
|
+
|
|
308
|
+
### Simple Alarm Payload
|
|
309
|
+
|
|
310
|
+
`POST /somneo/v1/alarm`
|
|
311
|
+
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"clock": "Bedroom Somneo",
|
|
315
|
+
"time": "07:00",
|
|
316
|
+
"enabled": true,
|
|
317
|
+
"sunriseMinutes": 30,
|
|
318
|
+
"lightTheme": 0,
|
|
319
|
+
"soundSource": "wus",
|
|
320
|
+
"sound": "1",
|
|
321
|
+
"volume": 12,
|
|
322
|
+
"powerWake": false,
|
|
323
|
+
"powerWakeTime": "08:17"
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Supported fields:
|
|
328
|
+
|
|
329
|
+
- `clock`: optional when only one Somneo is configured
|
|
330
|
+
- `time`: `HH:MM` in 24-hour format
|
|
331
|
+
- `enabled`: `true` or `false`
|
|
332
|
+
- `sunriseMinutes`: Somneo sunrise ramp duration
|
|
333
|
+
- `lightTheme`: native Somneo light theme value
|
|
334
|
+
- `soundSource`: native sound source value such as `wus`
|
|
335
|
+
- `sound`: native sound/channel value such as `1`
|
|
336
|
+
- `volume`: native Somneo sound level
|
|
337
|
+
- `powerWake`: `true` or `false`
|
|
338
|
+
- `powerWakeTime`: `HH:MM` in 24-hour format
|
|
339
|
+
|
|
340
|
+
If you set `time` and omit `enabled`, the plugin will automatically arm the alarm.
|
|
341
|
+
|
|
342
|
+
### Shortcut Examples
|
|
343
|
+
|
|
344
|
+
Create or update an alarm with a plain URL:
|
|
345
|
+
|
|
346
|
+
```text
|
|
347
|
+
http://homebridge.local:8585/somneo/v1/alarm/set?time=07:00&token=replace-me
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Disable the current alarm:
|
|
351
|
+
|
|
352
|
+
```text
|
|
353
|
+
http://homebridge.local:8585/somneo/v1/alarm/delete?token=replace-me
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Read the current alarm:
|
|
357
|
+
|
|
358
|
+
```text
|
|
359
|
+
http://homebridge.local:8585/somneo/v1/alarm?token=replace-me
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Future Plans
|
|
363
|
+
- No support for sound sensor. HomeKit does not have a sound level sensor. I thought about having an motion sensor, but would need to know what sound level motion detected/not should be considered.
|
|
364
|
+
- Better error handling. I am a Java developer by trade and am still learning Typescript :).
|
|
365
|
+
|
|
366
|
+
## Recognition
|
|
367
|
+
Thanks to:
|
|
368
|
+
|
|
369
|
+
* [homebridge](https://github.com/homebridge/homebridge-plugin-template) - For creating a great template to get started with.
|
|
370
|
+
* [fototeddy](https://github.com/fototeddy/homebridge-somneo-sensors) - For creating a Homebridge Somneo plugin that reads the sensors.
|
|
371
|
+
* [DeKnep](https://www.domoticz.com/forum/viewtopic.php?t=33033) - For creating a similar plugin in another platform and exposing endpoints for control.
|