@homebridge-plugins/homebridge-sharkiq 1.3.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/CHANGELOG.md +12 -0
- package/LICENSE +176 -0
- package/README.md +92 -0
- package/config.schema.json +114 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +131 -0
- package/dist/config.js.map +1 -0
- package/dist/homebridge-ui/public/index.html +201 -0
- package/dist/homebridge-ui/server.d.ts +2 -0
- package/dist/homebridge-ui/server.d.ts.map +1 -0
- package/dist/homebridge-ui/server.js +47 -0
- package/dist/homebridge-ui/server.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/login.d.ts +16 -0
- package/dist/login.d.ts.map +1 -0
- package/dist/login.js +242 -0
- package/dist/login.js.map +1 -0
- package/dist/platform.d.ts +16 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +118 -0
- package/dist/platform.js.map +1 -0
- package/dist/platformAccessory.d.ts +29 -0
- package/dist/platformAccessory.d.ts.map +1 -0
- package/dist/platformAccessory.js +285 -0
- package/dist/platformAccessory.js.map +1 -0
- package/dist/settings.d.ts +3 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +3 -0
- package/dist/settings.js.map +1 -0
- package/dist/sharkiq-js/ayla_api.d.ts +39 -0
- package/dist/sharkiq-js/ayla_api.d.ts.map +1 -0
- package/dist/sharkiq-js/ayla_api.js +289 -0
- package/dist/sharkiq-js/ayla_api.js.map +1 -0
- package/dist/sharkiq-js/const.d.ts +22 -0
- package/dist/sharkiq-js/const.d.ts.map +1 -0
- package/dist/sharkiq-js/const.js +23 -0
- package/dist/sharkiq-js/const.js.map +1 -0
- package/dist/sharkiq-js/properties.d.ts +52 -0
- package/dist/sharkiq-js/properties.d.ts.map +1 -0
- package/dist/sharkiq-js/properties.js +56 -0
- package/dist/sharkiq-js/properties.js.map +1 -0
- package/dist/sharkiq-js/sharkiq.d.ts +59 -0
- package/dist/sharkiq-js/sharkiq.d.ts.map +1 -0
- package/dist/sharkiq-js/sharkiq.js +359 -0
- package/dist/sharkiq-js/sharkiq.js.map +1 -0
- package/dist/type.d.ts +12 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +35 -0
- package/dist/utils.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/dmt/dmt-component-data.js +1 -0
- package/docs/assets/dmt/dmt-components.css +20 -0
- package/docs/assets/dmt/dmt-components.js +67 -0
- package/docs/assets/dmt/dmt-search.cmp +0 -0
- package/docs/assets/dmt/dmt-theme.css +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +57 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/style.css +1611 -0
- package/docs/functions/default.html +2 -0
- package/docs/index.html +50 -0
- package/docs/modules.html +2 -0
- package/eslint.config.js +49 -0
- package/package.json +87 -0
- package/typedoc.json +21 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import { getAuthData, setAuthData } from '../config.js';
|
|
3
|
+
import { addSeconds, isValidDate, safeJsonParse, subtractSeconds } from '../utils.js';
|
|
4
|
+
import { global_vars } from './const.js';
|
|
5
|
+
import { SharkIqVacuum } from './sharkiq.js';
|
|
6
|
+
// New AylaApi object
|
|
7
|
+
function get_ayla_api(auth_file_path, log, europe = false) {
|
|
8
|
+
if (europe) {
|
|
9
|
+
return new AylaApi(auth_file_path, global_vars.EU_SHARK_APP_ID, global_vars.EU_SHARK_APP_SECRET, log, europe);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return new AylaApi(auth_file_path, global_vars.SHARK_APP_ID, global_vars.SHARK_APP_SECRET, log, europe);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class AylaApi {
|
|
16
|
+
_auth_file_path;
|
|
17
|
+
_access_token;
|
|
18
|
+
_refresh_token;
|
|
19
|
+
_auth_expiration;
|
|
20
|
+
_is_authed;
|
|
21
|
+
_app_id;
|
|
22
|
+
_app_secret;
|
|
23
|
+
log;
|
|
24
|
+
europe;
|
|
25
|
+
// Simple Ayla Networks API wrapper
|
|
26
|
+
constructor(auth_file_path, app_id, app_secret, log, europe = false) {
|
|
27
|
+
this._auth_file_path = auth_file_path;
|
|
28
|
+
this._access_token = null;
|
|
29
|
+
this._refresh_token = null;
|
|
30
|
+
this._auth_expiration = null;
|
|
31
|
+
this._is_authed = false;
|
|
32
|
+
this._app_id = app_id;
|
|
33
|
+
this._app_secret = app_secret;
|
|
34
|
+
this.log = log;
|
|
35
|
+
this.europe = europe;
|
|
36
|
+
}
|
|
37
|
+
// Get exit error message
|
|
38
|
+
get exit_error_message() {
|
|
39
|
+
return 'SharkIQ will not continue. If the issue persists, open an issue.';
|
|
40
|
+
}
|
|
41
|
+
// Make API Request
|
|
42
|
+
async makeRequest(method, url, data, auth_header) {
|
|
43
|
+
const reqData = {};
|
|
44
|
+
const headers = {};
|
|
45
|
+
reqData.method = method;
|
|
46
|
+
if (auth_header) {
|
|
47
|
+
headers.Authorization = auth_header;
|
|
48
|
+
}
|
|
49
|
+
if (method === 'POST') {
|
|
50
|
+
headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
51
|
+
}
|
|
52
|
+
if (data !== null) {
|
|
53
|
+
reqData.body = JSON.stringify(data);
|
|
54
|
+
}
|
|
55
|
+
reqData.headers = headers;
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(url, reqData);
|
|
58
|
+
const statusCode = await response.status;
|
|
59
|
+
const responseText = await response.text();
|
|
60
|
+
return {
|
|
61
|
+
status: statusCode,
|
|
62
|
+
response: responseText,
|
|
63
|
+
ok: response.ok,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return {
|
|
68
|
+
status: 500,
|
|
69
|
+
response: '',
|
|
70
|
+
ok: false,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
_set_credentials(login_result) {
|
|
75
|
+
// Update credentials for cache
|
|
76
|
+
this._access_token = login_result.access_token;
|
|
77
|
+
this._refresh_token = login_result.refresh_token;
|
|
78
|
+
const _auth_expiration = new Date(login_result.expiration);
|
|
79
|
+
this._auth_expiration = isValidDate(_auth_expiration) ? _auth_expiration : null;
|
|
80
|
+
this._is_authed = true;
|
|
81
|
+
}
|
|
82
|
+
// Sign in with auth file
|
|
83
|
+
async sign_in() {
|
|
84
|
+
this.log.debug('Signing in.');
|
|
85
|
+
try {
|
|
86
|
+
const authData = await getAuthData(this._auth_file_path);
|
|
87
|
+
this._set_credentials(authData);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.log.error(`${error}`);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Refresh auth token
|
|
96
|
+
async refresh_auth() {
|
|
97
|
+
this.log.debug('Refreshing auth token.');
|
|
98
|
+
const refresh_data = { user: { refresh_token: this._refresh_token } };
|
|
99
|
+
const url = `${this.europe ? global_vars.EU_LOGIN_URL : global_vars.LOGIN_URL}/users/refresh_token.json`;
|
|
100
|
+
try {
|
|
101
|
+
const resp = await this.makeRequest('POST', url, refresh_data, null);
|
|
102
|
+
// Use safe JSON parsing utility
|
|
103
|
+
const parseResult = safeJsonParse(resp.response);
|
|
104
|
+
if (!parseResult.success) {
|
|
105
|
+
this.log.error('Error parsing JSON response when refreshing auth token');
|
|
106
|
+
this.log.debug(`Parse Error: ${parseResult.error}`);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
const jsonResponse = parseResult.data;
|
|
110
|
+
const status = resp.status;
|
|
111
|
+
if (status !== 200) {
|
|
112
|
+
this.log.error(`API Error: Unable to refresh auth token. Status Code ${status}`);
|
|
113
|
+
if (jsonResponse.error !== undefined) {
|
|
114
|
+
this.log.error(`Message: ${JSON.stringify(jsonResponse.error)}`);
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const dateNow = new Date();
|
|
119
|
+
jsonResponse.expiration = addSeconds(dateNow, jsonResponse.expires_in);
|
|
120
|
+
await setAuthData(this._auth_file_path, jsonResponse);
|
|
121
|
+
this._set_credentials(jsonResponse);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
this.log.error('Error refreshing auth token:', error);
|
|
126
|
+
this.log.debug('Promise Rejected with refreshin auth.');
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Get signout json request data
|
|
131
|
+
get sign_out_data() {
|
|
132
|
+
return { user: { access_token: this._access_token } };
|
|
133
|
+
}
|
|
134
|
+
// Clear auth data
|
|
135
|
+
_clear_auth() {
|
|
136
|
+
/* Clear authentication state */
|
|
137
|
+
this._is_authed = false;
|
|
138
|
+
this._access_token = null;
|
|
139
|
+
this._refresh_token = null;
|
|
140
|
+
this._auth_expiration = null;
|
|
141
|
+
}
|
|
142
|
+
// Sign out
|
|
143
|
+
async sign_out() {
|
|
144
|
+
const url = `${this.europe ? global_vars.EU_LOGIN_URL : global_vars.LOGIN_URL}/users/sign_out.json`;
|
|
145
|
+
try {
|
|
146
|
+
await this.makeRequest('POST', url, this.sign_out_data, null);
|
|
147
|
+
this._clear_auth();
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
this.log.debug('Promise Rejected with sign out.');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Get when auth data expires
|
|
154
|
+
async auth_expiration() {
|
|
155
|
+
if (!this._is_authed) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
if (this._auth_expiration === null) {
|
|
160
|
+
await this.sign_in();
|
|
161
|
+
return this._auth_expiration;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return this._auth_expiration;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Check if the token expired
|
|
169
|
+
async token_expired() {
|
|
170
|
+
const auth_expiration = await this.auth_expiration();
|
|
171
|
+
if (auth_expiration === null) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
const dateNow = new Date();
|
|
175
|
+
return (dateNow > auth_expiration) === true;
|
|
176
|
+
}
|
|
177
|
+
// Check if the current token is expiring soon
|
|
178
|
+
async token_expiring_soon() {
|
|
179
|
+
const auth_expiration = await this.auth_expiration();
|
|
180
|
+
if (auth_expiration === null) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
const dateNow = new Date();
|
|
184
|
+
return (dateNow > subtractSeconds(auth_expiration, 600)) === true;
|
|
185
|
+
}
|
|
186
|
+
// Check if auth is valid and renew if expired.
|
|
187
|
+
async check_auth() {
|
|
188
|
+
const token_expired = await this.token_expired();
|
|
189
|
+
if (!this._access_token || !this._is_authed || token_expired) {
|
|
190
|
+
this._is_authed = false;
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
else if (await this.token_expiring_soon()) {
|
|
194
|
+
try {
|
|
195
|
+
const status = await this.refresh_auth();
|
|
196
|
+
return status;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
this.log.error('Unable to refresh auth token.');
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Attempt to refresh the access token
|
|
208
|
+
async attempt_refresh(attempt) {
|
|
209
|
+
if (attempt === 1) {
|
|
210
|
+
this.log.error(this.exit_error_message);
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
this.log.info('Attempting to refresh access token.');
|
|
214
|
+
const status = await this.refresh_auth();
|
|
215
|
+
if (!status) {
|
|
216
|
+
this.log.error('Refreshing access token failed. Please check your auth file and delete it to recreate it if needed.');
|
|
217
|
+
this.log.info('The auth file is located at:', this._auth_file_path);
|
|
218
|
+
this.log.error(this.exit_error_message);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
// Get auth header for requests
|
|
224
|
+
async auth_header() {
|
|
225
|
+
const check_auth = await this.check_auth();
|
|
226
|
+
if (check_auth) {
|
|
227
|
+
return `auth_token ${this._access_token}`;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// List device objects
|
|
234
|
+
async list_devices(attempt = 0) {
|
|
235
|
+
const url = `${this.europe ? global_vars.EU_DEVICE_URL : global_vars.DEVICE_URL}/apiv1/devices.json`;
|
|
236
|
+
try {
|
|
237
|
+
const auth_header = await this.auth_header();
|
|
238
|
+
const resp = await this.makeRequest('GET', url, null, auth_header);
|
|
239
|
+
if (resp.status === 401) {
|
|
240
|
+
this.log.error('API Error: Unauthorized');
|
|
241
|
+
const status = await this.attempt_refresh(attempt);
|
|
242
|
+
if (!status && attempt === 1) {
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
return await this.list_devices(attempt + 1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// Use safe JSON parsing utility
|
|
250
|
+
const parseResult = safeJsonParse(resp.response);
|
|
251
|
+
if (!parseResult.success) {
|
|
252
|
+
this.log.error('Error parsing JSON response when listing devices');
|
|
253
|
+
this.log.debug(`Parse Error: ${parseResult.error}`);
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
const devices = parseResult.data;
|
|
257
|
+
const d = devices.map((device) => {
|
|
258
|
+
return device.device;
|
|
259
|
+
});
|
|
260
|
+
return d;
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
this.log.debug('Promise Rejected with list devices.');
|
|
264
|
+
return Promise.reject(new Error('Error: Unable to list devices.'));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Get and return array of devices
|
|
268
|
+
async get_devices(update = true) {
|
|
269
|
+
try {
|
|
270
|
+
const d = await this.list_devices();
|
|
271
|
+
const devices = d.map((device) => {
|
|
272
|
+
return new SharkIqVacuum(this, device, this.log, this.europe);
|
|
273
|
+
});
|
|
274
|
+
if (update) {
|
|
275
|
+
for (let i = 0; i < devices.length; i++) {
|
|
276
|
+
await devices[i].update([]);
|
|
277
|
+
devices[i]._update_metadata();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return devices;
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
this.log.error(`${error}`);
|
|
284
|
+
return Promise.reject(new Error('Error: Unable to get devices.'));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export { AylaApi, get_ayla_api };
|
|
289
|
+
//# sourceMappingURL=ayla_api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ayla_api.js","sourceRoot":"","sources":["../../src/sharkiq-js/ayla_api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAQ5C,qBAAqB;AACrB,SAAS,YAAY,CAAC,cAAsB,EAAE,GAAW,EAAE,MAAM,GAAG,KAAK;IACvE,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAI,OAAO,CAAC,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oBACxC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;oBAC3B,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAA;gBAC/B,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAA;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAA;YAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;CACF;AAED,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const global_vars: {
|
|
2
|
+
DEVICE_URL: string;
|
|
3
|
+
LOGIN_URL: string;
|
|
4
|
+
SHARK_APP_ID: string;
|
|
5
|
+
SHARK_APP_SECRET: string;
|
|
6
|
+
OAUTH: {
|
|
7
|
+
CLIENT_ID: string;
|
|
8
|
+
AUTH_URL: string;
|
|
9
|
+
TOKEN_URL: string;
|
|
10
|
+
REDIRECT_URI: string;
|
|
11
|
+
AUTH0_CLIENT: string;
|
|
12
|
+
SCOPES: string;
|
|
13
|
+
FILE: string;
|
|
14
|
+
};
|
|
15
|
+
FILE: string;
|
|
16
|
+
EU_DEVICE_URL: string;
|
|
17
|
+
EU_LOGIN_URL: string;
|
|
18
|
+
EU_SHARK_APP_ID: string;
|
|
19
|
+
EU_SHARK_APP_SECRET: string;
|
|
20
|
+
};
|
|
21
|
+
export { global_vars };
|
|
22
|
+
//# sourceMappingURL=const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/sharkiq-js/const.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;CAmBhB,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Global variables for API
|
|
2
|
+
const global_vars = {
|
|
3
|
+
DEVICE_URL: 'https://ads-field-39a9391a.aylanetworks.com',
|
|
4
|
+
LOGIN_URL: 'https://user-field-39a9391a.aylanetworks.com',
|
|
5
|
+
SHARK_APP_ID: 'ios_shark_prod-3A-id',
|
|
6
|
+
SHARK_APP_SECRET: 'ios_shark_prod-74tFWGNg34LQCmR0m45SsThqrqs',
|
|
7
|
+
OAUTH: {
|
|
8
|
+
CLIENT_ID: 'wsguxrqm77mq4LtrTrwg8ZJUxmSrexGi',
|
|
9
|
+
AUTH_URL: 'https://login.sharkninja.com/authorize',
|
|
10
|
+
TOKEN_URL: 'https://login.sharkninja.com/oauth/token',
|
|
11
|
+
REDIRECT_URI: 'com.sharkninja.shark://login.sharkninja.com/ios/com.sharkninja.shark/callback',
|
|
12
|
+
AUTH0_CLIENT: 'eyJ2ZXJzaW9uIjoiMi42LjAiLCJuYW1lIjoiQXV0aDAuc3dpZnQiLCJlbnI6eyJpVCI6IjE3LjYiLCJzd2lmdCI6IjUueCJ9fQ==',
|
|
13
|
+
SCOPES: 'openid profile email offline_access read:users read:current_user read:user_idp_tokens',
|
|
14
|
+
FILE: '.sharkiq_oauth.json',
|
|
15
|
+
},
|
|
16
|
+
FILE: '.sharkiq.json',
|
|
17
|
+
EU_DEVICE_URL: 'https://ads-eu.aylanetworks.com',
|
|
18
|
+
EU_LOGIN_URL: 'https://user-field-eu.aylanetworks.com',
|
|
19
|
+
EU_SHARK_APP_ID: 'Shark-Android-EUField-Fw-id',
|
|
20
|
+
EU_SHARK_APP_SECRET: 'Shark-Android-EUField-s-zTykblGJujGcSSTaJaeE4PESI',
|
|
21
|
+
};
|
|
22
|
+
export { global_vars };
|
|
23
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/sharkiq-js/const.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,6CAA6C;IACzD,SAAS,EAAE,8CAA8C;IACzD,YAAY,EAAE,sBAAsB;IACpC,gBAAgB,EAAE,4CAA4C;IAC9D,KAAK,EAAE;QACL,SAAS,EAAE,kCAAkC;QAC7C,QAAQ,EAAE,wCAAwC;QAClD,SAAS,EAAE,0CAA0C;QACrD,YAAY,EAAE,+EAA+E;QAC7F,YAAY,EAAE,sGAAsG;QACpH,MAAM,EAAE,uFAAuF;QAC/F,IAAI,EAAE,qBAAqB;KAC5B;IACD,IAAI,EAAE,eAAe;IACrB,aAAa,EAAE,iCAAiC;IAChD,YAAY,EAAE,wCAAwC;IACtD,eAAe,EAAE,6BAA6B;IAC9C,mBAAmB,EAAE,mDAAmD;CACzE,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
declare const PowerModes: {
|
|
2
|
+
ECO: number;
|
|
3
|
+
NORMAL: number;
|
|
4
|
+
MAX: number;
|
|
5
|
+
};
|
|
6
|
+
declare const OperatingModes: {
|
|
7
|
+
STOP: number;
|
|
8
|
+
PAUSE: number;
|
|
9
|
+
START: number;
|
|
10
|
+
RETURN: number;
|
|
11
|
+
};
|
|
12
|
+
declare const Properties: {
|
|
13
|
+
AREAS_TO_CLEAN: string;
|
|
14
|
+
BATTERY_CAPACITY: string;
|
|
15
|
+
CHARGING_STATUS: string;
|
|
16
|
+
CLEAN_COMPLETE: string;
|
|
17
|
+
CLEANING_STATISTICS: string;
|
|
18
|
+
DOCKED_STATUS: string;
|
|
19
|
+
ERROR_CODE: string;
|
|
20
|
+
EVACUATING: string;
|
|
21
|
+
FIND_DEVICE: string;
|
|
22
|
+
LOW_LIGHT_MISSION: string;
|
|
23
|
+
NAV_MODULE_FW_VERSION: string;
|
|
24
|
+
OPERATING_MODE: string;
|
|
25
|
+
POWER_MODE: string;
|
|
26
|
+
RECHARGE_RESUME: string;
|
|
27
|
+
RECHARGING_TO_RESUME: string;
|
|
28
|
+
ROBOT_FIRMWARE_VERSION: string;
|
|
29
|
+
ROBOT_ROOM_LIST: string;
|
|
30
|
+
RSSI: string;
|
|
31
|
+
DEVICE_MODEL_NUMBER: string;
|
|
32
|
+
DEVICE_SERIAL_NUMBER: string;
|
|
33
|
+
};
|
|
34
|
+
declare const ERROR_MESSAGES: {
|
|
35
|
+
1: string;
|
|
36
|
+
2: string;
|
|
37
|
+
3: string;
|
|
38
|
+
4: string;
|
|
39
|
+
5: string;
|
|
40
|
+
6: string;
|
|
41
|
+
7: string;
|
|
42
|
+
8: string;
|
|
43
|
+
9: string;
|
|
44
|
+
10: string;
|
|
45
|
+
11: string;
|
|
46
|
+
13: string;
|
|
47
|
+
14: string;
|
|
48
|
+
16: string;
|
|
49
|
+
18: string;
|
|
50
|
+
};
|
|
51
|
+
export { ERROR_MESSAGES, OperatingModes, PowerModes, Properties };
|
|
52
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/sharkiq-js/properties.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,UAAU;;;;CAIf,CAAA;AAGD,QAAA,MAAM,cAAc;;;;;CAKnB,CAAA;AAGD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAqBf,CAAA;AAGD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;CAgBnB,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Power Modes ENUM
|
|
2
|
+
const PowerModes = {
|
|
3
|
+
ECO: 1,
|
|
4
|
+
NORMAL: 0,
|
|
5
|
+
MAX: 2,
|
|
6
|
+
};
|
|
7
|
+
// Operating Modes ENUM
|
|
8
|
+
const OperatingModes = {
|
|
9
|
+
STOP: 0,
|
|
10
|
+
PAUSE: 1,
|
|
11
|
+
START: 2,
|
|
12
|
+
RETURN: 3,
|
|
13
|
+
};
|
|
14
|
+
// Common properties for Vacuum ENUM
|
|
15
|
+
const Properties = {
|
|
16
|
+
AREAS_TO_CLEAN: 'AreasToClean_V2',
|
|
17
|
+
BATTERY_CAPACITY: 'Battery_Capacity',
|
|
18
|
+
CHARGING_STATUS: 'Charging_Status',
|
|
19
|
+
CLEAN_COMPLETE: 'CleanComplete',
|
|
20
|
+
CLEANING_STATISTICS: 'Cleaning_Statistics',
|
|
21
|
+
DOCKED_STATUS: 'DockedStatus',
|
|
22
|
+
ERROR_CODE: 'Error_Code',
|
|
23
|
+
EVACUATING: 'Evacuating',
|
|
24
|
+
FIND_DEVICE: 'Find_Device',
|
|
25
|
+
LOW_LIGHT_MISSION: 'LowLightMission',
|
|
26
|
+
NAV_MODULE_FW_VERSION: 'Nav_Module_FW_Version',
|
|
27
|
+
OPERATING_MODE: 'Operating_Mode',
|
|
28
|
+
POWER_MODE: 'Power_Mode',
|
|
29
|
+
RECHARGE_RESUME: 'Recharge_Resume',
|
|
30
|
+
RECHARGING_TO_RESUME: 'Recharging_To_Resume',
|
|
31
|
+
ROBOT_FIRMWARE_VERSION: 'Robot_Firmware_Version',
|
|
32
|
+
ROBOT_ROOM_LIST: 'Robot_Room_List',
|
|
33
|
+
RSSI: 'RSSI',
|
|
34
|
+
DEVICE_MODEL_NUMBER: 'Device_Model_Number',
|
|
35
|
+
DEVICE_SERIAL_NUMBER: 'Device_Serial_Num',
|
|
36
|
+
};
|
|
37
|
+
// Error messages enum
|
|
38
|
+
const ERROR_MESSAGES = {
|
|
39
|
+
1: 'Side wheel is stuck',
|
|
40
|
+
2: 'Side brush is stuck',
|
|
41
|
+
3: 'Suction motor failed',
|
|
42
|
+
4: 'Brushroll stuck',
|
|
43
|
+
5: 'Side wheel is stuck (2)',
|
|
44
|
+
6: 'Bumper is stuck',
|
|
45
|
+
7: 'Cliff sensor is blocked',
|
|
46
|
+
8: 'Battery power is low',
|
|
47
|
+
9: 'No Dustbin',
|
|
48
|
+
10: 'Fall sensor is blocked',
|
|
49
|
+
11: 'Front wheel is stuck',
|
|
50
|
+
13: 'Switched off',
|
|
51
|
+
14: 'Magnetic strip error',
|
|
52
|
+
16: 'Top bumper is stuck',
|
|
53
|
+
18: 'Wheel encoder error',
|
|
54
|
+
};
|
|
55
|
+
export { ERROR_MESSAGES, OperatingModes, PowerModes, Properties };
|
|
56
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/sharkiq-js/properties.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;CACP,CAAA;AAED,uBAAuB;AACvB,MAAM,cAAc,GAAG;IACrB,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAA;AAED,oCAAoC;AACpC,MAAM,UAAU,GAAG;IACjB,cAAc,EAAE,iBAAiB;IACjC,gBAAgB,EAAE,kBAAkB;IACpC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,eAAe;IAC/B,mBAAmB,EAAE,qBAAqB;IAC1C,aAAa,EAAE,cAAc;IAC7B,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,iBAAiB;IACpC,qBAAqB,EAAE,uBAAuB;IAC9C,cAAc,EAAE,gBAAgB;IAChC,UAAU,EAAE,YAAY;IACxB,eAAe,EAAE,iBAAiB;IAClC,oBAAoB,EAAE,sBAAsB;IAC5C,sBAAsB,EAAE,wBAAwB;IAChD,eAAe,EAAE,iBAAiB;IAClC,IAAI,EAAE,MAAM;IACZ,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,mBAAmB;CAC1C,CAAA;AAED,sBAAsB;AACtB,MAAM,cAAc,GAAG;IACrB,CAAC,EAAE,qBAAqB;IACxB,CAAC,EAAE,qBAAqB;IACxB,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,yBAAyB;IAC5B,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,yBAAyB;IAC5B,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,YAAY;IACf,EAAE,EAAE,wBAAwB;IAC5B,EAAE,EAAE,sBAAsB;IAC1B,EAAE,EAAE,cAAc;IAClB,EAAE,EAAE,sBAAsB;IAC1B,EAAE,EAAE,qBAAqB;IACzB,EAAE,EAAE,qBAAqB;CAC1B,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Logger } from 'homebridge';
|
|
2
|
+
import type { AylaApi } from './ayla_api.js';
|
|
3
|
+
import { OperatingModes, PowerModes, Properties } from './properties.js';
|
|
4
|
+
export interface DeviceDct {
|
|
5
|
+
dsn: string;
|
|
6
|
+
key: string;
|
|
7
|
+
oem_model: string;
|
|
8
|
+
product_name: string;
|
|
9
|
+
}
|
|
10
|
+
interface Log extends Logger {
|
|
11
|
+
warn: (message: string, ...args: any[]) => void;
|
|
12
|
+
debug: (message: string, ...args: any[]) => void;
|
|
13
|
+
info: (message: string, ...args: any[]) => void;
|
|
14
|
+
success: (message: string, ...args: any[]) => void;
|
|
15
|
+
error: (message: string, ...args: any[]) => void;
|
|
16
|
+
}
|
|
17
|
+
declare class SharkIqVacuum {
|
|
18
|
+
ayla_api: AylaApi;
|
|
19
|
+
_dsn: string;
|
|
20
|
+
_key: string;
|
|
21
|
+
_oem_model_number: string;
|
|
22
|
+
_vac_model_number: string;
|
|
23
|
+
_vac_serial_number: string;
|
|
24
|
+
properties_full: any;
|
|
25
|
+
property_values: any;
|
|
26
|
+
_settable_properties: any;
|
|
27
|
+
europe: boolean;
|
|
28
|
+
_name: string;
|
|
29
|
+
_firmware_version: string;
|
|
30
|
+
log: Logger;
|
|
31
|
+
_error: string | null;
|
|
32
|
+
constructor(ayla_api: AylaApi, device_dct: DeviceDct, log: Log, europe?: boolean);
|
|
33
|
+
get oem_model_number(): string;
|
|
34
|
+
get vac_model_number(): string;
|
|
35
|
+
get vac_serial_number(): string;
|
|
36
|
+
get name(): string;
|
|
37
|
+
get serial_number(): string;
|
|
38
|
+
operating_mode(): number;
|
|
39
|
+
docked_status(): number;
|
|
40
|
+
power_mode(): number;
|
|
41
|
+
_update_metadata(): void;
|
|
42
|
+
set_property_endpoint(property_name: any): string;
|
|
43
|
+
get_property_value(property_name: any): any;
|
|
44
|
+
set_property_value(property_name: any, value: any, attempt?: number): Promise<void>;
|
|
45
|
+
get update_url(): string;
|
|
46
|
+
update(property_list: any, attempt?: number): Promise<number>;
|
|
47
|
+
_do_update(full_update: any, properties: any): void;
|
|
48
|
+
set_operating_mode(mode: number): Promise<void>;
|
|
49
|
+
_encode_room_list(rooms: any): string;
|
|
50
|
+
_get_device_room_list(): {
|
|
51
|
+
identifier: string;
|
|
52
|
+
rooms: string[];
|
|
53
|
+
};
|
|
54
|
+
get_room_list(): string[];
|
|
55
|
+
clean_rooms(rooms: any): Promise<void>;
|
|
56
|
+
cancel_clean(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export { OperatingModes, PowerModes, Properties, SharkIqVacuum };
|
|
59
|
+
//# sourceMappingURL=sharkiq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharkiq.d.ts","sourceRoot":"","sources":["../../src/sharkiq-js/sharkiq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,OAAO,KAAK,EAAE,OAAO,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