@homebridge-plugins/homebridge-ecovacs 7.0.0
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 +570 -0
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/config.schema.json +952 -0
- package/lib/homebridge-ui/public/index.html +297 -0
- package/lib/homebridge-ui/server.js +10 -0
- package/lib/index.js +8 -0
- package/lib/platform.js +1557 -0
- package/lib/utils/constants.js +102 -0
- package/lib/utils/custom-chars.js +50 -0
- package/lib/utils/functions.js +18 -0
- package/lib/utils/lang-en.js +79 -0
- package/package.json +75 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<p class="text-center">
|
|
2
|
+
<img
|
|
3
|
+
src="https://user-images.githubusercontent.com/43026681/101321841-f0eb5280-385d-11eb-8dd4-f57113f6e078.png"
|
|
4
|
+
alt="homebridge-ecovacs 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-ecovacs</strong></p>
|
|
10
|
+
<p>You will need to enter your ECOVACS username, password and region on the next page</p>
|
|
11
|
+
<button type="button" class="btn btn-primary" id="introContinue">Continue →</button>
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
id="menuWrapper"
|
|
15
|
+
class="btn-group w-100 mb-0"
|
|
16
|
+
role="group"
|
|
17
|
+
aria-label="UI Menu"
|
|
18
|
+
style="display: none;"
|
|
19
|
+
>
|
|
20
|
+
<button type="button" class="btn btn-primary ml-0" id="menuSettings">Settings</button>
|
|
21
|
+
<button type="button" class="btn btn-primary" id="menuDevices">My Devices</button>
|
|
22
|
+
<button type="button" class="btn btn-primary mr-0" id="menuHome">Support</button>
|
|
23
|
+
</div>
|
|
24
|
+
<div id="pageDevices" class="mt-4" style="display: none;">
|
|
25
|
+
<div id="deviceInfo">
|
|
26
|
+
<form>
|
|
27
|
+
<div class="form-group">
|
|
28
|
+
<select class="form-control" id="deviceSelect"></select>
|
|
29
|
+
</div>
|
|
30
|
+
</form>
|
|
31
|
+
<table class="table w-100" id="deviceTable" style="display: none;">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr class="table-active">
|
|
34
|
+
<th scope="col" style="width: 40%;">Device Name</th>
|
|
35
|
+
<th scope="col" style="width: 60%;" id="displayName"></th>
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
<tbody>
|
|
39
|
+
<tr>
|
|
40
|
+
<th scope="row">Device ID</th>
|
|
41
|
+
<td id="deviceId"></td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<th scope="row">Cloud Status</th>
|
|
45
|
+
<td id="deviceOnline"></td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<th scope="row">Model</th>
|
|
49
|
+
<td id="deviceModel"></td>
|
|
50
|
+
</tr>
|
|
51
|
+
<tr>
|
|
52
|
+
<th scope="row">Company</th>
|
|
53
|
+
<td id="deviceCompany"></td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<th scope="row">Class (Resource)</th>
|
|
57
|
+
<td id="deviceClassResource"></td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<th scope="row">IP Address</th>
|
|
61
|
+
<td id="deviceIP"></td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<th scope="row">MAC Address</th>
|
|
65
|
+
<td id="deviceMac"></td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td colspan="2" style="text-align: center" id="imgIcon"></td>
|
|
69
|
+
</tr>
|
|
70
|
+
</tbody>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div id="pageSupport" class="mt-4" style="display: none;">
|
|
75
|
+
<p class="text-center lead">Thank you for using <strong>homebridge-ecovacs</strong></p>
|
|
76
|
+
<p class="text-center">The links below will take you to our GitHub wiki</p>
|
|
77
|
+
<h4>Setup</h4>
|
|
78
|
+
<ul>
|
|
79
|
+
<li>
|
|
80
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Installation" target="_blank"
|
|
81
|
+
>Installation</a
|
|
82
|
+
>
|
|
83
|
+
</li>
|
|
84
|
+
<li>
|
|
85
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Configuration" target="_blank"
|
|
86
|
+
>Configuration</a
|
|
87
|
+
>
|
|
88
|
+
</li>
|
|
89
|
+
<li>
|
|
90
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Beta-Version" target="_blank"
|
|
91
|
+
>Beta Version</a
|
|
92
|
+
>
|
|
93
|
+
</li>
|
|
94
|
+
<li>
|
|
95
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Node-Version" target="_blank"
|
|
96
|
+
>Node Version</a
|
|
97
|
+
>
|
|
98
|
+
</li>
|
|
99
|
+
</ul>
|
|
100
|
+
<h4>Features</h4>
|
|
101
|
+
<ul>
|
|
102
|
+
<li>
|
|
103
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Supported-Devices" target="_blank"
|
|
104
|
+
>Supported Devices</a
|
|
105
|
+
>
|
|
106
|
+
</li>
|
|
107
|
+
<li>
|
|
108
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Speed-Control" target="_blank"
|
|
109
|
+
>Speed Control</a
|
|
110
|
+
>
|
|
111
|
+
</li>
|
|
112
|
+
<li>
|
|
113
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Custom-Areas" target="_blank"
|
|
114
|
+
>Custom Areas</a
|
|
115
|
+
>
|
|
116
|
+
</li>
|
|
117
|
+
</ul>
|
|
118
|
+
<h4>Help/About</h4>
|
|
119
|
+
<ul>
|
|
120
|
+
<li>
|
|
121
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/wiki/Common-Errors" target="_blank"
|
|
122
|
+
>Common Errors</a
|
|
123
|
+
>
|
|
124
|
+
</li>
|
|
125
|
+
<li>
|
|
126
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/issues/new/choose" target="_blank"
|
|
127
|
+
>Support Request</a
|
|
128
|
+
>
|
|
129
|
+
</li>
|
|
130
|
+
<li>
|
|
131
|
+
<a href="https://github.com/homebridge-plugins/homebridge-ecovacs/blob/latest/CHANGELOG.md" target="_blank"
|
|
132
|
+
>Changelog</a
|
|
133
|
+
>
|
|
134
|
+
</li>
|
|
135
|
+
<li><a href="https://github.com/sponsors/bwp91" target="_blank">About Me</a></li>
|
|
136
|
+
</ul>
|
|
137
|
+
<h4>Credits</h4>
|
|
138
|
+
<ul>
|
|
139
|
+
<li>
|
|
140
|
+
To the owner of
|
|
141
|
+
<a href="https://github.com/mrbungle64/ecovacs-deebot.js" target="_blank"
|
|
142
|
+
>ecovacs-deebot.js</a
|
|
143
|
+
>
|
|
144
|
+
client: <a href="https://github.com/mrbungle64" target="_blank">@mrbungle64</a>.
|
|
145
|
+
</li>
|
|
146
|
+
<li>
|
|
147
|
+
To the owner of
|
|
148
|
+
<a href="https://github.com/nicoduj/homebridge-deebotEcovacs" target="_blank"
|
|
149
|
+
>homebridge-deebotEcovacs</a
|
|
150
|
+
>: <a href="https://github.com/nicoduj" target="_blank">@nicoduj</a>.
|
|
151
|
+
</li>
|
|
152
|
+
<li>
|
|
153
|
+
To the creator of the awesome plugin header logo:
|
|
154
|
+
<a href="https://www.instagram.com/keryan.me" target="_blank">Keryan Belahcene</a>.
|
|
155
|
+
</li>
|
|
156
|
+
<li>
|
|
157
|
+
To the creators/contributors of
|
|
158
|
+
<a href="https://homebridge.io" target="_blank">Homebridge</a> who make this plugin possible.
|
|
159
|
+
</li>
|
|
160
|
+
</ul>
|
|
161
|
+
<h4>Disclaimer</h4>
|
|
162
|
+
<ul>
|
|
163
|
+
<li>
|
|
164
|
+
I am in no way affiliated with ECOVACS and this plugin is a personal project that I maintain
|
|
165
|
+
in my free time.
|
|
166
|
+
</li>
|
|
167
|
+
<li>Use this plugin entirely at your own risk - please see licence for more information.</li>
|
|
168
|
+
</ul>
|
|
169
|
+
</div>
|
|
170
|
+
<script>
|
|
171
|
+
;(async () => {
|
|
172
|
+
try {
|
|
173
|
+
const currentConfig = await homebridge.getPluginConfig()
|
|
174
|
+
showIntro = () => {
|
|
175
|
+
homebridge.disableSaveButton?.()
|
|
176
|
+
const introContinue = document.getElementById('introContinue')
|
|
177
|
+
introContinue.addEventListener('click', () => {
|
|
178
|
+
homebridge.showSpinner()
|
|
179
|
+
document.getElementById('pageIntro').style.display = 'none'
|
|
180
|
+
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
181
|
+
showSettings()
|
|
182
|
+
homebridge.hideSpinner()
|
|
183
|
+
})
|
|
184
|
+
document.getElementById('pageIntro').style.display = 'block'
|
|
185
|
+
}
|
|
186
|
+
showDevices = async () => {
|
|
187
|
+
homebridge.showSpinner()
|
|
188
|
+
homebridge.disableSaveButton?.()
|
|
189
|
+
homebridge.hideSchemaForm()
|
|
190
|
+
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
191
|
+
document.getElementById('menuHome').classList.add('btn-primary')
|
|
192
|
+
document.getElementById('menuDevices').classList.add('btn-elegant')
|
|
193
|
+
document.getElementById('menuDevices').classList.remove('btn-primary')
|
|
194
|
+
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
195
|
+
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
196
|
+
document.getElementById('pageSupport').style.display = 'none'
|
|
197
|
+
document.getElementById('pageDevices').style.display = 'block'
|
|
198
|
+
const cachedAccessories =
|
|
199
|
+
typeof homebridge.getCachedAccessories === 'function'
|
|
200
|
+
? await homebridge.getCachedAccessories()
|
|
201
|
+
: await homebridge.request('/getCachedAccessories')
|
|
202
|
+
if (cachedAccessories.length > 0) {
|
|
203
|
+
cachedAccessories.sort((a, b) => {
|
|
204
|
+
return a.displayName.toLowerCase() > b.displayName.toLowerCase()
|
|
205
|
+
? 1
|
|
206
|
+
: b.displayName.toLowerCase() > a.displayName.toLowerCase()
|
|
207
|
+
? -1
|
|
208
|
+
: 0
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
const deviceSelect = document.getElementById('deviceSelect')
|
|
212
|
+
deviceSelect.innerHTML = ''
|
|
213
|
+
cachedAccessories.forEach(a => {
|
|
214
|
+
const option = document.createElement('option')
|
|
215
|
+
option.text = a.displayName
|
|
216
|
+
option.value = a.context.ecoDeviceId
|
|
217
|
+
deviceSelect.add(option)
|
|
218
|
+
})
|
|
219
|
+
showDeviceInfo = async deviceId => {
|
|
220
|
+
homebridge.showSpinner()
|
|
221
|
+
const thisAcc = cachedAccessories.find(x => x.context.ecoDeviceId === deviceId)
|
|
222
|
+
const context = thisAcc.context
|
|
223
|
+
document.getElementById('displayName').innerHTML = thisAcc.displayName
|
|
224
|
+
document.getElementById('deviceId').innerHTML = context.ecoDeviceId || 'N/A'
|
|
225
|
+
document.getElementById('deviceOnline').innerHTML = context.isOnline
|
|
226
|
+
? '<i class="fas fa-circle mr-1 green-text"></i> Online'
|
|
227
|
+
: '<i class="fas fa-circle mr-1 red-text"></i> Offline'
|
|
228
|
+
document.getElementById('deviceModel').innerHTML = context.ecoModel || 'N/A'
|
|
229
|
+
document.getElementById('deviceCompany').innerHTML = context.ecoCompany || 'N/A'
|
|
230
|
+
document.getElementById('deviceClassResource').innerHTML =
|
|
231
|
+
(context.ecoClass || 'N/A') + ' (' + (context.ecoResource || 'N/A') + ')'
|
|
232
|
+
|
|
233
|
+
document.getElementById('deviceIP').innerHTML = context.ipAddress || 'N/A'
|
|
234
|
+
document.getElementById('deviceMac').innerHTML = context.macAddress || 'N/A'
|
|
235
|
+
document.getElementById('imgIcon').innerHTML = context.ecoImage
|
|
236
|
+
? '<img src="' + context.ecoImage + '" style="width: 150px;">'
|
|
237
|
+
: ''
|
|
238
|
+
document.getElementById('deviceTable').style.display = 'inline-table'
|
|
239
|
+
homebridge.hideSpinner()
|
|
240
|
+
}
|
|
241
|
+
deviceSelect.addEventListener('change', event => showDeviceInfo(event.target.value))
|
|
242
|
+
if (cachedAccessories.length > 0) {
|
|
243
|
+
showDeviceInfo(cachedAccessories[0].context.ecoDeviceId)
|
|
244
|
+
} else {
|
|
245
|
+
const option = document.createElement('option')
|
|
246
|
+
option.text = 'No Devices'
|
|
247
|
+
deviceSelect.add(option)
|
|
248
|
+
deviceSelect.disabled = true
|
|
249
|
+
}
|
|
250
|
+
homebridge.hideSpinner()
|
|
251
|
+
}
|
|
252
|
+
showSupport = () => {
|
|
253
|
+
homebridge.showSpinner()
|
|
254
|
+
homebridge.disableSaveButton?.()
|
|
255
|
+
homebridge.hideSchemaForm()
|
|
256
|
+
document.getElementById('menuHome').classList.add('btn-elegant')
|
|
257
|
+
document.getElementById('menuHome').classList.remove('btn-primary')
|
|
258
|
+
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
259
|
+
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
260
|
+
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
261
|
+
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
262
|
+
document.getElementById('pageSupport').style.display = 'block'
|
|
263
|
+
document.getElementById('pageDevices').style.display = 'none'
|
|
264
|
+
homebridge.hideSpinner()
|
|
265
|
+
}
|
|
266
|
+
showSettings = () => {
|
|
267
|
+
homebridge.showSpinner()
|
|
268
|
+
homebridge.enableSaveButton?.()
|
|
269
|
+
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
270
|
+
document.getElementById('menuHome').classList.add('btn-primary')
|
|
271
|
+
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
272
|
+
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
273
|
+
document.getElementById('menuSettings').classList.add('btn-elegant')
|
|
274
|
+
document.getElementById('menuSettings').classList.remove('btn-primary')
|
|
275
|
+
document.getElementById('pageSupport').style.display = 'none'
|
|
276
|
+
document.getElementById('pageDevices').style.display = 'none'
|
|
277
|
+
homebridge.showSchemaForm()
|
|
278
|
+
homebridge.hideSpinner()
|
|
279
|
+
}
|
|
280
|
+
menuHome.addEventListener('click', () => showSupport())
|
|
281
|
+
menuDevices.addEventListener('click', () => showDevices())
|
|
282
|
+
menuSettings.addEventListener('click', () => showSettings())
|
|
283
|
+
if (currentConfig.length) {
|
|
284
|
+
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
285
|
+
showSettings()
|
|
286
|
+
} else {
|
|
287
|
+
currentConfig.push({ name: 'Deebot' })
|
|
288
|
+
await homebridge.updatePluginConfig(currentConfig)
|
|
289
|
+
showIntro()
|
|
290
|
+
}
|
|
291
|
+
} catch (err) {
|
|
292
|
+
homebridge.toast.error(err.message, 'Error')
|
|
293
|
+
} finally {
|
|
294
|
+
homebridge.hideSpinner()
|
|
295
|
+
}
|
|
296
|
+
})()
|
|
297
|
+
</script>
|
package/lib/index.js
ADDED