@homebridge-plugins/homebridge-govee 10.12.1
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/CHANGELOG.md +1937 -0
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/config.schema.json +1727 -0
- package/eslint.config.js +49 -0
- package/lib/connection/aws.js +174 -0
- package/lib/connection/ble.js +208 -0
- package/lib/connection/cert/AmazonRootCA1.pem +20 -0
- package/lib/connection/http.js +240 -0
- package/lib/connection/lan.js +284 -0
- package/lib/device/cooler-single.js +300 -0
- package/lib/device/dehumidifier-H7150.js +182 -0
- package/lib/device/dehumidifier-H7151.js +157 -0
- package/lib/device/diffuser-H7161.js +117 -0
- package/lib/device/diffuser-H7162.js +117 -0
- package/lib/device/fan-H7100.js +274 -0
- package/lib/device/fan-H7101.js +330 -0
- package/lib/device/fan-H7102.js +274 -0
- package/lib/device/fan-H7105.js +503 -0
- package/lib/device/fan-H7106.js +274 -0
- package/lib/device/fan-H7111.js +335 -0
- package/lib/device/heater-single.js +300 -0
- package/lib/device/heater1a.js +353 -0
- package/lib/device/heater1b.js +616 -0
- package/lib/device/heater2.js +838 -0
- package/lib/device/humidifier-H7140.js +224 -0
- package/lib/device/humidifier-H7141.js +257 -0
- package/lib/device/humidifier-H7142.js +522 -0
- package/lib/device/humidifier-H7143.js +157 -0
- package/lib/device/humidifier-H7148.js +157 -0
- package/lib/device/humidifier-H7160.js +446 -0
- package/lib/device/ice-maker-H7162.js +46 -0
- package/lib/device/index.js +105 -0
- package/lib/device/kettle.js +269 -0
- package/lib/device/light-switch.js +86 -0
- package/lib/device/light.js +617 -0
- package/lib/device/outlet-double.js +121 -0
- package/lib/device/outlet-single.js +172 -0
- package/lib/device/outlet-triple.js +160 -0
- package/lib/device/purifier-H7120.js +336 -0
- package/lib/device/purifier-H7121.js +336 -0
- package/lib/device/purifier-H7122.js +449 -0
- package/lib/device/purifier-H7123.js +411 -0
- package/lib/device/purifier-H7124.js +411 -0
- package/lib/device/purifier-H7126.js +296 -0
- package/lib/device/purifier-H7127.js +296 -0
- package/lib/device/purifier-H712C.js +296 -0
- package/lib/device/purifier-single.js +119 -0
- package/lib/device/sensor-button.js +22 -0
- package/lib/device/sensor-contact.js +22 -0
- package/lib/device/sensor-leak.js +87 -0
- package/lib/device/sensor-monitor.js +190 -0
- package/lib/device/sensor-presence.js +53 -0
- package/lib/device/sensor-thermo.js +144 -0
- package/lib/device/sensor-thermo4.js +55 -0
- package/lib/device/switch-double.js +121 -0
- package/lib/device/switch-single.js +95 -0
- package/lib/device/switch-triple.js +160 -0
- package/lib/device/tap-single.js +108 -0
- package/lib/device/template.js +43 -0
- package/lib/device/tv-single.js +84 -0
- package/lib/device/valve-single.js +155 -0
- package/lib/fakegato/LICENSE +21 -0
- package/lib/fakegato/fakegato-history.js +814 -0
- package/lib/fakegato/fakegato-storage.js +108 -0
- package/lib/fakegato/fakegato-timer.js +125 -0
- package/lib/fakegato/uuid.js +27 -0
- package/lib/homebridge-ui/public/index.html +433 -0
- package/lib/homebridge-ui/server.js +10 -0
- package/lib/index.js +8 -0
- package/lib/platform.js +1967 -0
- package/lib/utils/colour.js +564 -0
- package/lib/utils/constants.js +579 -0
- package/lib/utils/custom-chars.js +225 -0
- package/lib/utils/eve-chars.js +68 -0
- package/lib/utils/functions.js +117 -0
- package/lib/utils/lang-en.js +131 -0
- package/package.json +75 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
<p class="text-center">
|
|
2
|
+
<img
|
|
3
|
+
src="https://user-images.githubusercontent.com/43026681/101324574-5e997d80-3862-11eb-81b0-932330f6e242.png"
|
|
4
|
+
alt="homebridge-govee logo"
|
|
5
|
+
style="width: 60%;"
|
|
6
|
+
/>
|
|
7
|
+
</p>
|
|
8
|
+
<div id="pageIntro" class="text-center" style="display: none;">
|
|
9
|
+
<p class="lead">Thank you for installing <strong>homebridge-govee</strong></p>
|
|
10
|
+
<p>
|
|
11
|
+
You will need your Govee email & password to continue - this plugin does not need a Govee API key
|
|
12
|
+
</p>
|
|
13
|
+
<button type="button" class="btn btn-primary" id="introContinue">Continue →</button>
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
id="menuWrapper"
|
|
17
|
+
class="btn-group w-100 mb-0"
|
|
18
|
+
role="group"
|
|
19
|
+
aria-label="UI Menu"
|
|
20
|
+
style="display: none;"
|
|
21
|
+
>
|
|
22
|
+
<button type="button" class="btn btn-primary ml-0" id="menuSettings">Settings</button>
|
|
23
|
+
<button type="button" class="btn btn-primary" id="menuDevices">My Devices</button>
|
|
24
|
+
<button type="button" class="btn btn-primary mr-0" id="menuHome">Support</button>
|
|
25
|
+
</div>
|
|
26
|
+
<div id="pageDevices" class="mt-4" style="display: none;">
|
|
27
|
+
<div id="deviceInfo">
|
|
28
|
+
<form>
|
|
29
|
+
<div class="form-group">
|
|
30
|
+
<select class="form-control" id="deviceSelect"></select>
|
|
31
|
+
</div>
|
|
32
|
+
</form>
|
|
33
|
+
<table class="table w-100" id="deviceTable" style="display: none;">
|
|
34
|
+
<thead>
|
|
35
|
+
<tr class="table-active">
|
|
36
|
+
<th scope="col" style="width: 40%;">Device Name</th>
|
|
37
|
+
<th scope="col" style="width: 60%;" id="displayName"></th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<th scope="row">Govee Device ID</th>
|
|
43
|
+
<td id="deviceId"></td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr>
|
|
46
|
+
<th scope="row">Govee Model</th>
|
|
47
|
+
<td id="model"></td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<th scope="row">AWS Supported</th>
|
|
51
|
+
<td id="aws_supported"></td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr id="row_aws_enabled" style="display: none;">
|
|
54
|
+
<th scope="row">AWS Enabled</th>
|
|
55
|
+
<td id="aws_enabled"></td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<th scope="row">Bluetooth Supported</th>
|
|
59
|
+
<td id="ble_supported"></td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr id="row_ble_enabled" style="display: none;">
|
|
62
|
+
<th scope="row">Bluetooth Enabled</th>
|
|
63
|
+
<td id="ble_enabled"></td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr id="row_ble_address" style="display: none;">
|
|
66
|
+
<th scope="row">Bluetooth Address</th>
|
|
67
|
+
<td id="ble_address"></td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr id="row_ble_name" style="display: none;">
|
|
70
|
+
<th scope="row">Bluetooth Name</th>
|
|
71
|
+
<td id="ble_name"></td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<th scope="row">LAN Supported</th>
|
|
75
|
+
<td id="lan_supported"></td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr id="row_lan_enabled" style="display: none;">
|
|
78
|
+
<th scope="row">LAN Enabled</th>
|
|
79
|
+
<td id="lan_enabled"></td>
|
|
80
|
+
</tr>
|
|
81
|
+
<tr id="row_ip_address" style="display: none;">
|
|
82
|
+
<th scope="row">IP Address</th>
|
|
83
|
+
<td id="ip_address"></td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr id="row_supported_cmds" style="display: none;">
|
|
86
|
+
<th scope="row">Supported Commands</th>
|
|
87
|
+
<td id="supported_cmds"></td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<th scope="row">Firmware Version</th>
|
|
91
|
+
<td id="firmware"></td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<th scope="row">Hardware Version</th>
|
|
95
|
+
<td id="hardware"></td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr id="row_kelvin_range" style="display: none;">
|
|
98
|
+
<th scope="row">Kelvin Range</th>
|
|
99
|
+
<td id="kelvin_range"></td>
|
|
100
|
+
</tr>
|
|
101
|
+
<tr id="row_temp_range" style="display: none;">
|
|
102
|
+
<th scope="row">Temperature Range</th>
|
|
103
|
+
<td id="temp_range"></td>
|
|
104
|
+
</tr>
|
|
105
|
+
<tr id="row_humi_range" style="display: none;">
|
|
106
|
+
<th scope="row">Humidity Range</th>
|
|
107
|
+
<td id="humi_range"></td>
|
|
108
|
+
</tr>
|
|
109
|
+
<tr>
|
|
110
|
+
<td colspan="2" style="text-align: center" id="image"></td>
|
|
111
|
+
</tr>
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div id="pageSupport" class="mt-4" style="display: none;">
|
|
117
|
+
<p class="text-center lead">Thank you for using <strong>homebridge-govee</strong></p>
|
|
118
|
+
<p class="text-center">The links below will take you to our GitHub wiki</p>
|
|
119
|
+
<h4>Setup</h4>
|
|
120
|
+
<ul>
|
|
121
|
+
<li>
|
|
122
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Installation" target="_blank"
|
|
123
|
+
>Installation</a
|
|
124
|
+
>
|
|
125
|
+
</li>
|
|
126
|
+
<li>
|
|
127
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Configuration" target="_blank"
|
|
128
|
+
>Configuration</a
|
|
129
|
+
>
|
|
130
|
+
</li>
|
|
131
|
+
<li>
|
|
132
|
+
<a href="https://github.com/homebridge/homebridge/wiki/How-to-Install-Alternate-Plugin-Versions" target="_blank"
|
|
133
|
+
>Beta Version</a
|
|
134
|
+
>
|
|
135
|
+
</li>
|
|
136
|
+
<li>
|
|
137
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Node-Version" target="_blank"
|
|
138
|
+
>Node Version</a
|
|
139
|
+
>
|
|
140
|
+
</li>
|
|
141
|
+
</ul>
|
|
142
|
+
<h4>Features</h4>
|
|
143
|
+
<ul>
|
|
144
|
+
<li>
|
|
145
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Supported-Devices" target="_blank"
|
|
146
|
+
>Supported Devices</a
|
|
147
|
+
>
|
|
148
|
+
</li>
|
|
149
|
+
<li>
|
|
150
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Connection-Methods" target="_blank"
|
|
151
|
+
>Connection Methods</a
|
|
152
|
+
>
|
|
153
|
+
</li>
|
|
154
|
+
<ul>
|
|
155
|
+
<li>
|
|
156
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/LAN-Control" target="_blank"
|
|
157
|
+
>LAN Control</a
|
|
158
|
+
>
|
|
159
|
+
</li>
|
|
160
|
+
<li>
|
|
161
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/API-Control" target="_blank"
|
|
162
|
+
>API Control</a
|
|
163
|
+
>
|
|
164
|
+
</li>
|
|
165
|
+
<li>
|
|
166
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/AWS-Control" target="_blank"
|
|
167
|
+
>AWS Control</a
|
|
168
|
+
>
|
|
169
|
+
</li>
|
|
170
|
+
<li>
|
|
171
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Bluetooth-Control" target="_blank"
|
|
172
|
+
>BLE Control</a
|
|
173
|
+
>
|
|
174
|
+
</li>
|
|
175
|
+
</ul>
|
|
176
|
+
<li>
|
|
177
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Scene%2C-Music%2C-DIY-Modes" target="_blank"
|
|
178
|
+
>Scene, Music, DIY Modes</a
|
|
179
|
+
>
|
|
180
|
+
</li>
|
|
181
|
+
</ul>
|
|
182
|
+
<h4>Help/About</h4>
|
|
183
|
+
<ul>
|
|
184
|
+
<li>
|
|
185
|
+
<a href="https://github.com/bwp91/homebridge-govee/wiki/Common-Errors" target="_blank"
|
|
186
|
+
>Common Errors</a
|
|
187
|
+
>
|
|
188
|
+
</li>
|
|
189
|
+
<li>
|
|
190
|
+
<a href="https://github.com/bwp91/homebridge-govee/issues/new/choose" target="_blank"
|
|
191
|
+
>Support Request</a
|
|
192
|
+
>
|
|
193
|
+
</li>
|
|
194
|
+
<li>
|
|
195
|
+
<a href="https://github.com/bwp91/homebridge-govee/blob/latest/CHANGELOG.md" target="_blank"
|
|
196
|
+
>Changelog</a
|
|
197
|
+
>
|
|
198
|
+
</li>
|
|
199
|
+
<li><a href="https://github.com/sponsors/bwp91" target="_blank">About Me</a></li>
|
|
200
|
+
</ul>
|
|
201
|
+
<h4>Credits</h4>
|
|
202
|
+
<ul>
|
|
203
|
+
<li>To all users who have shared their devices to enable functionality.</li>
|
|
204
|
+
<li>
|
|
205
|
+
To the creator/owner of the
|
|
206
|
+
<a href="https://www.npmjs.com/package/govee-led-client" target="_blank">govee-led-client</a>
|
|
207
|
+
library which made the bluetooth connection possible.
|
|
208
|
+
</li>
|
|
209
|
+
<li>
|
|
210
|
+
To the creator/owner of the
|
|
211
|
+
<a href="https://github.com/towlerj/govee_api" target="_blank">govee_api</a>
|
|
212
|
+
library which made the AWS connection possible.
|
|
213
|
+
</li>
|
|
214
|
+
<li>
|
|
215
|
+
To <a href="https://github.com/alboiuvlad29" target="_blank">@alboiuvlad29</a> who made the LAN connection possible.
|
|
216
|
+
</li>
|
|
217
|
+
<li>
|
|
218
|
+
To <a href="https://github.com/JeremyDunn" target="_blank">@JeremyDunn</a> for his code from
|
|
219
|
+
<a href="https://github.com/JeremyDunn/homebridge-govee-water-detectors" target="_blank"
|
|
220
|
+
>homebridge-govee-water-detectors</a
|
|
221
|
+
>
|
|
222
|
+
for leak sensor support.
|
|
223
|
+
</li>
|
|
224
|
+
<li>
|
|
225
|
+
To the creator/owner of the
|
|
226
|
+
<a href="https://www.npmjs.com/package/govee-bt-client" target="_blank"
|
|
227
|
+
>govee-bt-client</a
|
|
228
|
+
>
|
|
229
|
+
library which made the BLE connection to sensors possible.
|
|
230
|
+
</li>
|
|
231
|
+
<li>
|
|
232
|
+
To the creator of the awesome plugin header logo:
|
|
233
|
+
<a href="https://www.instagram.com/keryan.me" target="_blank">Keryan Belahcene</a>.
|
|
234
|
+
</li>
|
|
235
|
+
<li>
|
|
236
|
+
To the creators/contributors of
|
|
237
|
+
<a href="https://homebridge.io" target="_blank">Homebridge</a> who make this plugin possible.
|
|
238
|
+
</li>
|
|
239
|
+
</ul>
|
|
240
|
+
<h4>Disclaimer</h4>
|
|
241
|
+
<ul>
|
|
242
|
+
<li>
|
|
243
|
+
I am in no way affiliated with Govee and this plugin is a personal project that I maintain in
|
|
244
|
+
my free time.
|
|
245
|
+
</li>
|
|
246
|
+
<li>Use this plugin entirely at your own risk - please see licence for more information.</li>
|
|
247
|
+
</ul>
|
|
248
|
+
</div>
|
|
249
|
+
<script>
|
|
250
|
+
;(async () => {
|
|
251
|
+
try {
|
|
252
|
+
const currentConfig = await homebridge.getPluginConfig()
|
|
253
|
+
showIntro = () => {
|
|
254
|
+
const introContinue = document.getElementById('introContinue')
|
|
255
|
+
introContinue.addEventListener('click', () => {
|
|
256
|
+
homebridge.showSpinner()
|
|
257
|
+
document.getElementById('pageIntro').style.display = 'none'
|
|
258
|
+
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
259
|
+
showSettings()
|
|
260
|
+
homebridge.hideSpinner()
|
|
261
|
+
})
|
|
262
|
+
document.getElementById('pageIntro').style.display = 'block'
|
|
263
|
+
}
|
|
264
|
+
showDevices = async () => {
|
|
265
|
+
homebridge.showSpinner()
|
|
266
|
+
homebridge.hideSchemaForm()
|
|
267
|
+
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
268
|
+
document.getElementById('menuHome').classList.add('btn-primary')
|
|
269
|
+
document.getElementById('menuDevices').classList.add('btn-elegant')
|
|
270
|
+
document.getElementById('menuDevices').classList.remove('btn-primary')
|
|
271
|
+
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
272
|
+
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
273
|
+
document.getElementById('pageSupport').style.display = 'none'
|
|
274
|
+
document.getElementById('pageDevices').style.display = 'block'
|
|
275
|
+
const cachedAccessories =
|
|
276
|
+
typeof homebridge.getCachedAccessories === 'function'
|
|
277
|
+
? await homebridge.getCachedAccessories()
|
|
278
|
+
: await homebridge.request('/getCachedAccessories')
|
|
279
|
+
if (cachedAccessories.length > 0) {
|
|
280
|
+
cachedAccessories.sort((a, b) => {
|
|
281
|
+
return a.displayName.toLowerCase() > b.displayName.toLowerCase()
|
|
282
|
+
? 1
|
|
283
|
+
: b.displayName.toLowerCase() > a.displayName.toLowerCase()
|
|
284
|
+
? -1
|
|
285
|
+
: 0
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
const deviceSelect = document.getElementById('deviceSelect')
|
|
289
|
+
deviceSelect.innerHTML = ''
|
|
290
|
+
cachedAccessories.forEach(a => {
|
|
291
|
+
const option = document.createElement('option')
|
|
292
|
+
option.text = a.displayName
|
|
293
|
+
option.value = a.context.gvDeviceId
|
|
294
|
+
deviceSelect.add(option)
|
|
295
|
+
})
|
|
296
|
+
showDeviceInfo = async hbDeviceId => {
|
|
297
|
+
homebridge.showSpinner()
|
|
298
|
+
const thisAcc = cachedAccessories.find(x => x.context.gvDeviceId === hbDeviceId)
|
|
299
|
+
const context = thisAcc.context
|
|
300
|
+
document.getElementById('displayName').innerHTML = thisAcc.displayName
|
|
301
|
+
document.getElementById('deviceId').innerHTML = context.gvDeviceId || 'N/A'
|
|
302
|
+
document.getElementById('model').innerHTML = context.gvModel || 'N/A'
|
|
303
|
+
if (context.hasAWSControl) {
|
|
304
|
+
document.getElementById('aws_supported').innerHTML = 'Yes'
|
|
305
|
+
document.getElementById('aws_enabled').innerHTML = context.useAWSControl ? 'Yes' : 'No'
|
|
306
|
+
document.getElementById('row_aws_enabled').style.display = 'table-row'
|
|
307
|
+
} else {
|
|
308
|
+
document.getElementById('aws_supported').innerHTML = 'No'
|
|
309
|
+
document.getElementById('row_aws_enabled').style.display = 'none'
|
|
310
|
+
}
|
|
311
|
+
if (context.hasBLEControl) {
|
|
312
|
+
document.getElementById('ble_supported').innerHTML = 'Yes'
|
|
313
|
+
document.getElementById('ble_enabled').innerHTML = context.useBLEControl ? 'Yes' : 'No'
|
|
314
|
+
document.getElementById('ble_address').innerHTML = context.bleAddress
|
|
315
|
+
document.getElementById('ble_name').innerHTML = context.bleName
|
|
316
|
+
document.getElementById('row_ble_enabled').style.display = 'table-row'
|
|
317
|
+
document.getElementById('row_ble_address').style.display = 'table-row'
|
|
318
|
+
document.getElementById('row_ble_name').style.display = 'table-row'
|
|
319
|
+
} else {
|
|
320
|
+
document.getElementById('ble_supported').innerHTML = 'No'
|
|
321
|
+
document.getElementById('row_ble_enabled').style.display = 'none'
|
|
322
|
+
document.getElementById('row_ble_address').style.display = 'none'
|
|
323
|
+
document.getElementById('row_ble_name').style.display = 'none'
|
|
324
|
+
}
|
|
325
|
+
if (context.hasLANControl) {
|
|
326
|
+
document.getElementById('lan_supported').innerHTML = 'Yes'
|
|
327
|
+
document.getElementById('lan_enabled').innerHTML = context.useLANControl ? 'Yes' : 'No'
|
|
328
|
+
document.getElementById('row_lan_enabled').style.display = 'table-row'
|
|
329
|
+
if (context.useLANControl && context.ipAddress) {
|
|
330
|
+
document.getElementById('ip_address').innerHTML = context.ipAddress
|
|
331
|
+
document.getElementById('row_ip_address').style.display = 'table-row'
|
|
332
|
+
} else {
|
|
333
|
+
document.getElementById('row_ip_address').style.display = 'none'
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
document.getElementById('lan_supported').innerHTML = 'No'
|
|
337
|
+
document.getElementById('row_lan_enabled').style.display = 'none'
|
|
338
|
+
document.getElementById('row_ip_address').style.display = 'none'
|
|
339
|
+
}
|
|
340
|
+
if (context.supportedCmds && Array.isArray(context.supportedCmds)) {
|
|
341
|
+
document.getElementById('supported_cmds').innerHTML = context.supportedCmds.join(', ')
|
|
342
|
+
document.getElementById('row_supported_cmds').style.display = 'table-row'
|
|
343
|
+
} else {
|
|
344
|
+
document.getElementById('row_supported_cmds').style.display = 'none'
|
|
345
|
+
}
|
|
346
|
+
document.getElementById('firmware').innerHTML = context.firmware
|
|
347
|
+
? context.firmware
|
|
348
|
+
: 'N/A'
|
|
349
|
+
document.getElementById('hardware').innerHTML = context.hardware
|
|
350
|
+
? context.hardware
|
|
351
|
+
: 'N/A'
|
|
352
|
+
if (context?.supportedCmdsOpts?.colorTem?.range?.min) {
|
|
353
|
+
document.getElementById('kelvin_range').innerHTML =
|
|
354
|
+
context.supportedCmdsOpts.colorTem.range.min + 'K - ' + context.supportedCmdsOpts.colorTem.range.max + 'K'
|
|
355
|
+
document.getElementById('row_kelvin_range').style.display = 'table-row'
|
|
356
|
+
} else {
|
|
357
|
+
document.getElementById('row_kelvin_range').style.display = 'none'
|
|
358
|
+
}
|
|
359
|
+
if (context.maxTemp) {
|
|
360
|
+
document.getElementById('temp_range').innerHTML =
|
|
361
|
+
context.minTemp + '°C - ' + context.maxTemp + '°C'
|
|
362
|
+
document.getElementById('row_temp_range').style.display = 'table-row'
|
|
363
|
+
} else {
|
|
364
|
+
document.getElementById('row_temp_range').style.display = 'none'
|
|
365
|
+
}
|
|
366
|
+
if (context.maxHumi) {
|
|
367
|
+
document.getElementById('humi_range').innerHTML =
|
|
368
|
+
context.minHumi + '% - ' + context.maxHumi + '%'
|
|
369
|
+
document.getElementById('row_humi_range').style.display = 'table-row'
|
|
370
|
+
} else {
|
|
371
|
+
document.getElementById('row_humi_range').style.display = 'none'
|
|
372
|
+
}
|
|
373
|
+
document.getElementById('image').innerHTML = context.image
|
|
374
|
+
? '<img src="' + context.image + '" style="width: 150px;">'
|
|
375
|
+
: ''
|
|
376
|
+
document.getElementById('deviceTable').style.display = 'inline-table'
|
|
377
|
+
homebridge.hideSpinner()
|
|
378
|
+
}
|
|
379
|
+
deviceSelect.addEventListener('change', event => showDeviceInfo(event.target.value))
|
|
380
|
+
if (cachedAccessories.length > 0) {
|
|
381
|
+
showDeviceInfo(cachedAccessories[0].context.gvDeviceId)
|
|
382
|
+
} else {
|
|
383
|
+
const option = document.createElement('option')
|
|
384
|
+
option.text = 'No Devices'
|
|
385
|
+
deviceSelect.add(option)
|
|
386
|
+
deviceSelect.disabled = true
|
|
387
|
+
}
|
|
388
|
+
homebridge.hideSpinner()
|
|
389
|
+
}
|
|
390
|
+
showSupport = () => {
|
|
391
|
+
homebridge.showSpinner()
|
|
392
|
+
homebridge.hideSchemaForm()
|
|
393
|
+
document.getElementById('menuHome').classList.add('btn-elegant')
|
|
394
|
+
document.getElementById('menuHome').classList.remove('btn-primary')
|
|
395
|
+
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
396
|
+
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
397
|
+
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
398
|
+
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
399
|
+
document.getElementById('pageSupport').style.display = 'block'
|
|
400
|
+
document.getElementById('pageDevices').style.display = 'none'
|
|
401
|
+
homebridge.hideSpinner()
|
|
402
|
+
}
|
|
403
|
+
showSettings = () => {
|
|
404
|
+
homebridge.showSpinner()
|
|
405
|
+
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
406
|
+
document.getElementById('menuHome').classList.add('btn-primary')
|
|
407
|
+
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
408
|
+
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
409
|
+
document.getElementById('menuSettings').classList.add('btn-elegant')
|
|
410
|
+
document.getElementById('menuSettings').classList.remove('btn-primary')
|
|
411
|
+
document.getElementById('pageSupport').style.display = 'none'
|
|
412
|
+
document.getElementById('pageDevices').style.display = 'none'
|
|
413
|
+
homebridge.showSchemaForm()
|
|
414
|
+
homebridge.hideSpinner()
|
|
415
|
+
}
|
|
416
|
+
menuHome.addEventListener('click', () => showSupport())
|
|
417
|
+
menuDevices.addEventListener('click', () => showDevices())
|
|
418
|
+
menuSettings.addEventListener('click', () => showSettings())
|
|
419
|
+
if (currentConfig.length) {
|
|
420
|
+
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
421
|
+
showSettings()
|
|
422
|
+
} else {
|
|
423
|
+
currentConfig.push({ name: 'Govee' })
|
|
424
|
+
await homebridge.updatePluginConfig(currentConfig)
|
|
425
|
+
showIntro()
|
|
426
|
+
}
|
|
427
|
+
} catch (err) {
|
|
428
|
+
homebridge.toast.error(err.message, 'Error')
|
|
429
|
+
} finally {
|
|
430
|
+
homebridge.hideSpinner()
|
|
431
|
+
}
|
|
432
|
+
})()
|
|
433
|
+
</script>
|
package/lib/index.js
ADDED