@homebridge-plugins/homebridge-resideo 2.1.7-beta.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.
Files changed (87) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/.github/ISSUE_TEMPLATE/bug-report.yml +97 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. package/.github/ISSUE_TEMPLATE/feature-request.yml +38 -0
  5. package/.github/ISSUE_TEMPLATE/support-request.yml +85 -0
  6. package/.github/ISSUE_TEMPLATE.md +52 -0
  7. package/.github/PULL_REQUEST_TEMPLATE/pull_request.md +27 -0
  8. package/.github/auto-merge.yml +3 -0
  9. package/.github/dependabot.yml +17 -0
  10. package/.github/labeler.yml +38 -0
  11. package/.github/npm-version-script-esm.js +85 -0
  12. package/.github/release-drafter.yml +33 -0
  13. package/.github/workflows/beta-release.yml +55 -0
  14. package/.github/workflows/build.yml +18 -0
  15. package/.github/workflows/changerelease.yml +11 -0
  16. package/.github/workflows/labeler.yml +9 -0
  17. package/.github/workflows/release-drafter.yml +14 -0
  18. package/.github/workflows/release.yml +35 -0
  19. package/.github/workflows/stale.yml +12 -0
  20. package/CHANGELOG.md +161 -0
  21. package/LICENSE +14 -0
  22. package/README.md +67 -0
  23. package/SECURITY.md +19 -0
  24. package/branding/Homebridge_x_Resideo.svg +28 -0
  25. package/branding/honeywell/Homebridge_x_Honeywell.svg +1 -0
  26. package/branding/honeywell/homebridge-honeywell-home-changelog.md +851 -0
  27. package/branding/icon.png +0 -0
  28. package/config.schema.json +611 -0
  29. package/dist/devices/device.d.ts +41 -0
  30. package/dist/devices/device.d.ts.map +1 -0
  31. package/dist/devices/device.js +279 -0
  32. package/dist/devices/device.js.map +1 -0
  33. package/dist/devices/leaksensors.d.ts +34 -0
  34. package/dist/devices/leaksensors.d.ts.map +1 -0
  35. package/dist/devices/leaksensors.js +300 -0
  36. package/dist/devices/leaksensors.js.map +1 -0
  37. package/dist/devices/roomsensors.d.ts +38 -0
  38. package/dist/devices/roomsensors.d.ts.map +1 -0
  39. package/dist/devices/roomsensors.js +274 -0
  40. package/dist/devices/roomsensors.js.map +1 -0
  41. package/dist/devices/roomsensorthermostats.d.ts +57 -0
  42. package/dist/devices/roomsensorthermostats.d.ts.map +1 -0
  43. package/dist/devices/roomsensorthermostats.js +700 -0
  44. package/dist/devices/roomsensorthermostats.js.map +1 -0
  45. package/dist/devices/thermostats.d.ts +73 -0
  46. package/dist/devices/thermostats.d.ts.map +1 -0
  47. package/dist/devices/thermostats.js +930 -0
  48. package/dist/devices/thermostats.js.map +1 -0
  49. package/dist/devices/valve.d.ts +21 -0
  50. package/dist/devices/valve.d.ts.map +1 -0
  51. package/dist/devices/valve.js +151 -0
  52. package/dist/devices/valve.js.map +1 -0
  53. package/dist/homebridge-ui/public/index.html +423 -0
  54. package/dist/homebridge-ui/server.d.ts +2 -0
  55. package/dist/homebridge-ui/server.d.ts.map +1 -0
  56. package/dist/homebridge-ui/server.js +131 -0
  57. package/dist/homebridge-ui/server.js.map +1 -0
  58. package/dist/index.d.ts +4 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +7 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/platform.d.ts +94 -0
  63. package/dist/platform.d.ts.map +1 -0
  64. package/dist/platform.js +890 -0
  65. package/dist/platform.js.map +1 -0
  66. package/dist/settings.d.ts +409 -0
  67. package/dist/settings.d.ts.map +1 -0
  68. package/dist/settings.js +25 -0
  69. package/dist/settings.js.map +1 -0
  70. package/dist/utils.d.ts +21 -0
  71. package/dist/utils.d.ts.map +1 -0
  72. package/dist/utils.js +58 -0
  73. package/dist/utils.js.map +1 -0
  74. package/docs/.nojekyll +1 -0
  75. package/docs/assets/highlight.css +22 -0
  76. package/docs/assets/icons.js +18 -0
  77. package/docs/assets/icons.svg +1 -0
  78. package/docs/assets/main.js +60 -0
  79. package/docs/assets/navigation.js +1 -0
  80. package/docs/assets/search.js +1 -0
  81. package/docs/assets/style.css +1493 -0
  82. package/docs/functions/default.html +1 -0
  83. package/docs/index.html +73 -0
  84. package/docs/modules.html +2 -0
  85. package/eslint.config.js +50 -0
  86. package/package.json +102 -0
  87. package/typedoc.json +22 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9H,8BAAsB,UAAU;IAc5B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe;IAC5C,SAAS,CAAC,SAAS,EAAE,iBAAiB;IACtC,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAC5B,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;IACxC,eAAe,CAAC,EAAE,eAAe;aACxB,KAAK,CAAC,EAAE,QAAQ;IAlBlC,SAAgB,GAAG,EAAE,GAAG,CAAA;IACxB,SAAgB,GAAG,EAAE,OAAO,CAAA;IAC5B,SAAgB,MAAM,EAAG,qBAAqB,CAAA;IAC9C,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;IAG3B,SAAS,CAAC,aAAa,EAAG,MAAM,CAAA;IAChC,SAAS,CAAC,iBAAiB,EAAG,MAAM,CAAA;IACpC,SAAS,CAAC,cAAc,EAAG,MAAM,CAAA;IACjC,SAAS,CAAC,gBAAgB,EAAG,MAAM,CAAA;IACnC,SAAS,CAAC,yBAAyB,EAAG,MAAM,CAAA;gBAGvB,QAAQ,EAAE,eAAe,EAClC,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE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C;IAQ1C,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtC,aAAa,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3C,QAAQ,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUtC,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;CAGhD"}
@@ -0,0 +1,279 @@
1
+ export class deviceBase {
2
+ platform;
3
+ accessory;
4
+ location;
5
+ device;
6
+ sensorAccessory;
7
+ group;
8
+ api;
9
+ log;
10
+ config;
11
+ hap;
12
+ // Config
13
+ deviceLogging;
14
+ deviceRefreshRate;
15
+ devicePushRate;
16
+ deviceMaxRetries;
17
+ deviceDelayBetweenRetries;
18
+ constructor(platform, accessory, location, device, sensorAccessory, group) {
19
+ this.platform = platform;
20
+ this.accessory = accessory;
21
+ this.location = location;
22
+ this.device = device;
23
+ this.sensorAccessory = sensorAccessory;
24
+ this.group = group;
25
+ this.api = this.platform.api;
26
+ this.log = this.platform.log;
27
+ this.config = this.platform.config;
28
+ this.hap = this.api.hap;
29
+ this.getDeviceLogSettings(accessory, device);
30
+ this.getDeviceRateSettings(accessory, device);
31
+ this.getDeviceRetry(device);
32
+ this.getDeviceConfigSettings(device);
33
+ this.getDeviceContext(accessory, device, sensorAccessory);
34
+ // Set accessory information
35
+ accessory
36
+ .getService(this.hap.Service.AccessoryInformation)
37
+ .setCharacteristic(this.hap.Characteristic.Manufacturer, 'Resideo')
38
+ .setCharacteristic(this.hap.Characteristic.Name, accessory.context.name)
39
+ .setCharacteristic(this.hap.Characteristic.ConfiguredName, accessory.context.name)
40
+ .setCharacteristic(this.hap.Characteristic.Model, accessory.context.model)
41
+ .setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceID);
42
+ }
43
+ async getDeviceLogSettings(accessory, device) {
44
+ this.deviceLogging = this.platform.debugMode ? 'debugMode' : device.logging ?? this.config.logging ?? 'standard';
45
+ const logging = this.platform.debugMode ? 'Debug Mode' : device.logging ? 'Device Config' : this.config.logging ? 'Platform Config' : 'Default';
46
+ accessory.context.deviceLogging = this.deviceLogging;
47
+ await this.debugLog(`Using ${logging} Logging: ${this.deviceLogging}`);
48
+ }
49
+ async getDeviceRateSettings(accessory, device) {
50
+ // refreshRate
51
+ this.deviceRefreshRate = device.thermostat?.roomsensor?.refreshRate ?? device.thermostat?.roompriority?.refreshRate ?? device.refreshRate ?? this.config.options?.refreshRate ?? 120;
52
+ const refreshRate = device.thermostat?.roomsensor?.refreshRate
53
+ ? 'Room Sensor Config'
54
+ : device.thermostat?.roompriority?.refreshRate
55
+ ? 'Room Priority Config'
56
+ : device.refreshRate
57
+ ? 'Device Config'
58
+ : this.config.options?.refreshRate ? 'Platform Config' : 'Default';
59
+ accessory.context.deviceRefreshRate = this.deviceRefreshRate;
60
+ // pushRate
61
+ this.devicePushRate = device.pushRate ?? this.config.options?.pushRate ?? 0.1;
62
+ const pushRate = device.pushRate ? 'Device Config' : this.config.options?.pushRate ? 'Platform Config' : 'Default';
63
+ await this.debugLog(`Using ${refreshRate} refreshRate: ${this.deviceRefreshRate}, ${pushRate} pushRate: ${this.devicePushRate}`);
64
+ accessory.context.devicePushRate = this.devicePushRate;
65
+ }
66
+ async getDeviceRetry(device) {
67
+ this.deviceMaxRetries = device.maxRetries ?? 5;
68
+ const maxRetries = device.maxRetries ? 'Device Config' : 'Default';
69
+ await this.debugLog(`Using ${maxRetries} maxRetries: ${this.deviceMaxRetries}`);
70
+ this.deviceDelayBetweenRetries = device.delayBetweenRetries ?? 3;
71
+ this.deviceDelayBetweenRetries = this.deviceDelayBetweenRetries * 1000;
72
+ const delayBetweenRetries = device.delayBetweenRetries ? 'Device Config' : 'Default';
73
+ await this.debugLog(`Using ${delayBetweenRetries} delayBetweenRetries: ${this.deviceDelayBetweenRetries}`);
74
+ }
75
+ async getDeviceConfigSettings(device) {
76
+ const deviceConfig = {};
77
+ const properties = [
78
+ 'logging',
79
+ 'refreshRate',
80
+ 'pushRate',
81
+ 'external',
82
+ 'retry',
83
+ 'maxRetries',
84
+ 'delayBetweenRetries',
85
+ ];
86
+ properties.forEach((prop) => {
87
+ if (device[prop] !== undefined) {
88
+ deviceConfig[prop] = device[prop];
89
+ }
90
+ });
91
+ if (Object.keys(deviceConfig).length !== 0) {
92
+ this.infoLog(`Config: ${JSON.stringify(deviceConfig)}`);
93
+ }
94
+ let thermostatConfig = {};
95
+ if (device.thermostat) {
96
+ thermostatConfig = device.thermostat;
97
+ }
98
+ let leaksensorConfig = {};
99
+ if (device.leaksensor) {
100
+ leaksensorConfig = device.leaksensor;
101
+ }
102
+ let valveConfig = {};
103
+ if (device.valve) {
104
+ valveConfig = device.valve;
105
+ }
106
+ const config = Object.assign({}, deviceConfig, thermostatConfig, leaksensorConfig, valveConfig);
107
+ if (Object.entries(config).length !== 0) {
108
+ this.debugSuccessLog(`${this.device.deviceClass}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
109
+ }
110
+ }
111
+ async getDeviceContext(accessory, device, sensorAccessory) {
112
+ if (sensorAccessory?.accessoryAttribute) {
113
+ accessory.context.name = sensorAccessory.accessoryAttribute.name;
114
+ accessory.context.model = sensorAccessory.accessoryAttribute.model;
115
+ accessory.context.deviceID = sensorAccessory.accessoryAttribute.serialNumber;
116
+ accessory.context.deviceType = sensorAccessory.accessoryAttribute.type;
117
+ }
118
+ else if (device.deviceClass) {
119
+ accessory.context.name = device.userDefinedDeviceName ?? device.name;
120
+ accessory.context.model = device.deviceClass ?? device.deviceModel;
121
+ accessory.context.deviceID = device.deviceID;
122
+ accessory.context.deviceType = device.deviceType;
123
+ }
124
+ // Firmware Version
125
+ const deviceFirmwareVersion = sensorAccessory?.accessoryAttribute.softwareRevision ?? device.firmware ?? device.firmwareVersion
126
+ ?? device.thermostatVersion ?? accessory.context.version ?? this.platform.version ?? '0.0.0';
127
+ const version = deviceFirmwareVersion.toString();
128
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Firmware Version: ${version?.replace(/^V|-.*$/g, '')}`);
129
+ let deviceVersion;
130
+ if (version?.includes('.') === false) {
131
+ const replace = version?.replace(/^V|-.*$/g, '');
132
+ const match = replace?.match(/./g);
133
+ const validVersion = match?.join('.');
134
+ deviceVersion = validVersion ?? '0.0.0';
135
+ }
136
+ else {
137
+ deviceVersion = version?.replace(/^V|-.*$/g, '') ?? '0.0.0';
138
+ }
139
+ accessory
140
+ .getService(this.hap.Service.AccessoryInformation)
141
+ .setCharacteristic(this.hap.Characteristic.HardwareRevision, deviceVersion)
142
+ .setCharacteristic(this.hap.Characteristic.SoftwareRevision, deviceVersion)
143
+ .setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
144
+ .getCharacteristic(this.hap.Characteristic.FirmwareRevision)
145
+ .updateValue(deviceVersion);
146
+ accessory.context.deviceVersion = deviceVersion;
147
+ this.debugSuccessLog(`${device.deviceType}: ${accessory.displayName} deviceVersion: ${accessory.context.deviceVersion}`);
148
+ }
149
+ async statusCode(statusCode, action) {
150
+ switch (statusCode) {
151
+ case 200:
152
+ this.debugLog(`${this.device.deviceClass}: ${this.accessory.displayName} Standard Response, statusCode: ${statusCode}, Action: ${action}`);
153
+ break;
154
+ case 400:
155
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Bad Request, statusCode: ${statusCode}, Action: ${action}`);
156
+ break;
157
+ case 401:
158
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Unauthorized, statusCode: ${statusCode}, Action: ${action}`);
159
+ break;
160
+ case 403:
161
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Forbidden, The request has been authenticated but does not have appropriate permissions, or a requested resource is not found, statusCode: ${statusCode}`);
162
+ break;
163
+ case 404:
164
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Not Found, statusCode: ${statusCode}, Action: ${action}`);
165
+ break;
166
+ case 429:
167
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Too Many Requests, statusCode: ${statusCode}, Action: ${action}`);
168
+ break;
169
+ case 500:
170
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} Internal Server Error (Meater Server), statusCode: ${statusCode}, Action: ${action}`);
171
+ break;
172
+ default:
173
+ this.infoLog(`${this.device.deviceClass}: ${this.accessory.displayName} Unknown statusCode: ${statusCode}, Action: ${action}, Report Bugs Here: https://bit.ly/homebridge-resideo-bug-report`);
174
+ }
175
+ }
176
+ async resideoAPIError(e, action) {
177
+ if (e.message.includes('400')) {
178
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Bad Request`);
179
+ this.debugLog('The client has issued an invalid request. This is commonly used to specify validation errors in a request payload.');
180
+ }
181
+ else if (e.message.includes('401')) {
182
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Unauthorized Request`);
183
+ this.debugLog('Authorization for the API is required, but the request has not been authenticated.');
184
+ }
185
+ else if (e.message.includes('403')) {
186
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Forbidden Request`);
187
+ this.debugLog('The request has been authenticated but does not have appropriate permissions, or a requested resource is not found.');
188
+ }
189
+ else if (e.message.includes('404')) {
190
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Requst Not Found`);
191
+ this.debugLog('Specifies the requested path does not exist.');
192
+ }
193
+ else if (e.message.includes('406')) {
194
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Request Not Acceptable`);
195
+ this.debugLog('The client has requested a MIME type via the Accept header for a value not supported by the server.');
196
+ }
197
+ else if (e.message.includes('415')) {
198
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Unsupported Requst Header`);
199
+ this.debugLog('The client has defined a contentType header that is not supported by the server.');
200
+ }
201
+ else if (e.message.includes('422')) {
202
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Unprocessable Entity`);
203
+ this.debugLog('The client has made a valid request, but the server cannot process it.'
204
+ + ' This is often used for APIs for which certain limits have been exceeded.');
205
+ }
206
+ else if (e.message.includes('429')) {
207
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Too Many Requests`);
208
+ this.debugLog('The client has exceeded the number of requests allowed for a given time window.');
209
+ }
210
+ else if (e.message.includes('500')) {
211
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action}, Internal Server Error`);
212
+ this.debugLog('An unexpected error on the SmartThings servers has occurred. These errors should be rare.');
213
+ }
214
+ else {
215
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to ${action},`);
216
+ }
217
+ if (this.deviceLogging.includes('debug')) {
218
+ this.errorLog(`${this.device.deviceClass}: ${this.accessory.displayName} failed to pushChanges, Error Message: ${JSON.stringify(e.message)}`);
219
+ }
220
+ }
221
+ /**
222
+ * Logging for Device
223
+ */
224
+ async infoLog(...log) {
225
+ if (await this.enablingDeviceLogging()) {
226
+ this.log.info(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
227
+ }
228
+ }
229
+ async successLog(...log) {
230
+ if (await this.enablingDeviceLogging()) {
231
+ this.log.success(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
232
+ }
233
+ }
234
+ async debugSuccessLog(...log) {
235
+ if (await this.enablingDeviceLogging()) {
236
+ if (this.deviceLogging?.includes('debug')) {
237
+ this.log.success(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
238
+ }
239
+ }
240
+ }
241
+ async warnLog(...log) {
242
+ if (await this.enablingDeviceLogging()) {
243
+ this.log.warn(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
244
+ }
245
+ }
246
+ async debugWarnLog(...log) {
247
+ if (await this.enablingDeviceLogging()) {
248
+ if (this.deviceLogging?.includes('debug')) {
249
+ this.log.warn(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
250
+ }
251
+ }
252
+ }
253
+ async errorLog(...log) {
254
+ if (await this.enablingDeviceLogging()) {
255
+ this.log.error(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
256
+ }
257
+ }
258
+ async debugErrorLog(...log) {
259
+ if (await this.enablingDeviceLogging()) {
260
+ if (this.deviceLogging?.includes('debug')) {
261
+ this.log.error(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
262
+ }
263
+ }
264
+ }
265
+ async debugLog(...log) {
266
+ if (await this.enablingDeviceLogging()) {
267
+ if (this.deviceLogging === 'debug') {
268
+ this.log.info(`[DEBUG] ${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
269
+ }
270
+ else {
271
+ this.log.debug(`${this.device.deviceType}: ${this.accessory.displayName}`, String(...log));
272
+ }
273
+ }
274
+ }
275
+ async enablingDeviceLogging() {
276
+ return this.deviceLogging.includes('debug') ?? this.deviceLogging === 'standard';
277
+ }
278
+ }
279
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AASA,MAAM,OAAgB,UAAU;IAcT;IACT;IACA;IACA;IACH;IACS;IAlBF,GAAG,CAAK;IACR,GAAG,CAAS;IACZ,MAAM,CAAwB;IAC3B,GAAG,CAAK;IAE3B,SAAS;IACC,aAAa,CAAS;IACtB,iBAAiB,CAAS;IAC1B,cAAc,CAAS;IACvB,gBAAgB,CAAS;IACzB,yBAAyB,CAAS;IAE5C,YACqB,QAAyB,EAClC,SAA4B,EAC5B,QAAkB,EAClB,MAAqC,EACxC,eAAiC,EACxB,KAAgB;QALb,aAAQ,GAAR,QAAQ,CAAiB;QAClC,cAAS,GAAT,SAAS,CAAmB;QAC5B,aAAQ,GAAR,QAAQ,CAAU;QAClB,WAAM,GAAN,MAAM,CAA+B;QACxC,oBAAe,GAAf,eAAe,C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E,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;YAC5F,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;IAClF,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ import type { PlatformAccessory } from 'homebridge';
2
+ import type { ResideoPlatform } from '../platform.js';
3
+ import type { devicesConfig, location, resideoDevice } from '../settings.js';
4
+ import { Subject } from 'rxjs';
5
+ import { deviceBase } from './device.js';
6
+ /**
7
+ * Platform Accessory
8
+ * An instance of this class is created for each accessory your platform registers
9
+ * Each accessory may expose multiple services of different service types.
10
+ */
11
+ export declare class LeakSensor extends deviceBase {
12
+ readonly platform: ResideoPlatform;
13
+ private Battery;
14
+ private LeakSensor?;
15
+ private HumiditySensor?;
16
+ private TemperatureSensor?;
17
+ SensorUpdateInProgress: boolean;
18
+ doSensorUpdate: Subject<void>;
19
+ constructor(platform: ResideoPlatform, accessory: PlatformAccessory, location: location, device: resideoDevice & devicesConfig);
20
+ /**
21
+ * Parse the device status from the Resideo api
22
+ */
23
+ parseStatus(): Promise<void>;
24
+ /**
25
+ * Asks the Resideo Home API for the latest device information
26
+ */
27
+ refreshStatus(): Promise<void>;
28
+ /**
29
+ * Updates the status for each of the HomeKit Characteristics
30
+ */
31
+ updateHomeKitCharacteristics(): Promise<void>;
32
+ apiError(e: any): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=leaksensors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leaksensors.d.ts","sourceRoot":"","sources":["../../src/devices/leaksensors.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAuB,iBAAiB,EAAW,MAAM,YAAY,CAAA;AAEjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAyB,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnG,OAAO,EAAY,OAAO,EAAE,MAAM,MAAM,CAAA;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,UAAU;IAkCtC,QAAQ,CAAC,QAAQ,EAAE,eAAe;IAhCpC,OAAO,CAAC,OAAO,CAMd;IAED,OAAO,CAAC,UAAU,CAAC,CAKlB;IAED,OAAO,CAAC,cAAc,CAAC,CAItB;IAED,OAAO,CAAC,iBAAiB,CAAC,CAIzB;IAGD,sBAAsB,EAAG,OAAO,CAAA;IAChC,cAAc,EAAG,OAAO,CAAC,IAAI,CAAC,CAAA;gBAGnB,QAAQ,EAAE,eAAe,EAClC,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,aAAa,GAAG,aAAa;IAgJvC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA8ClC;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BpC;;OAEG;IACG,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;IA6C7C,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CActC"}
@@ -0,0 +1,300 @@
1
+ import { interval, Subject } from 'rxjs';
2
+ import { skipWhile, take } from 'rxjs/operators';
3
+ import { DeviceURL } from '../settings.js';
4
+ import { deviceBase } from './device.js';
5
+ /**
6
+ * Platform Accessory
7
+ * An instance of this class is created for each accessory your platform registers
8
+ * Each accessory may expose multiple services of different service types.
9
+ */
10
+ export class LeakSensor extends deviceBase {
11
+ platform;
12
+ // Services
13
+ Battery;
14
+ LeakSensor;
15
+ HumiditySensor;
16
+ TemperatureSensor;
17
+ // Sensor Update
18
+ SensorUpdateInProgress;
19
+ doSensorUpdate;
20
+ constructor(platform, accessory, location, device) {
21
+ super(platform, accessory, location, device);
22
+ this.platform = platform;
23
+ // this is subject we use to track when we need to POST changes to the Resideo API
24
+ this.doSensorUpdate = new Subject();
25
+ this.SensorUpdateInProgress = false;
26
+ // Initialize Battery Service
27
+ accessory.context.Battery = accessory.context.Battery ?? {};
28
+ this.Battery = {
29
+ Name: accessory.context.Battery.Name ?? `${accessory.displayName} Battery`,
30
+ Service: accessory.getService(this.hap.Service.Battery) ?? accessory.addService(this.hap.Service.Battery),
31
+ BatteryLevel: accessory.context.BatteryLevel ?? 100,
32
+ ChargingState: accessory.context.ChargingState ?? this.hap.Characteristic.ChargingState.NOT_CHARGEABLE,
33
+ StatusLowBattery: accessory.context.StatusLowBattery ?? this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL,
34
+ };
35
+ accessory.context.Battery = this.Battery;
36
+ // set the service name, this is what is displayed as the default name on the Home app
37
+ this.Battery.Service
38
+ .setCharacteristic(this.hap.Characteristic.Name, this.Battery.Name)
39
+ .setCharacteristic(this.hap.Characteristic.ChargingState, this.hap.Characteristic.ChargingState.NOT_CHARGEABLE)
40
+ .getCharacteristic(this.hap.Characteristic.BatteryLevel)
41
+ .onGet(() => {
42
+ return this.Battery.BatteryLevel;
43
+ });
44
+ // Initialize Leak Sensor Service
45
+ if (device.leaksensor?.hide_leak) {
46
+ if (this.LeakSensor) {
47
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Leak Sensor Service`);
48
+ this.LeakSensor.Service = accessory.getService(this.hap.Service.LeakSensor);
49
+ accessory.removeService(this.LeakSensor.Service);
50
+ }
51
+ else {
52
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Leak Sensor Service Not Found`);
53
+ }
54
+ }
55
+ else {
56
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Leak Sensor Service`);
57
+ accessory.context.LeakSensor = accessory.context.LeakSensor ?? {};
58
+ this.LeakSensor = {
59
+ Name: accessory.context.LeakSensor.Name ?? `${accessory.displayName} Leak Sensor`,
60
+ Service: accessory.getService(this.hap.Service.LeakSensor) ?? accessory.addService(this.hap.Service.LeakSensor),
61
+ StatusActive: accessory.context.StatusActive ?? false,
62
+ LeakDetected: accessory.context.LeakDetected ?? this.hap.Characteristic.LeakDetected.LEAK_NOT_DETECTED,
63
+ };
64
+ accessory.context.LeakSensor = this.LeakSensor;
65
+ // Initialize Leak Sensor Characteristic
66
+ this.LeakSensor.Service
67
+ .setCharacteristic(this.hap.Characteristic.Name, this.LeakSensor.Name)
68
+ .getCharacteristic(this.hap.Characteristic.StatusActive)
69
+ .onGet(() => {
70
+ return this.LeakSensor.StatusActive;
71
+ });
72
+ this.LeakSensor.Service
73
+ .getCharacteristic(this.hap.Characteristic.LeakDetected)
74
+ .onGet(() => {
75
+ return this.LeakSensor.LeakDetected;
76
+ });
77
+ }
78
+ // Initialize Temperature Sensor Service
79
+ if (device.leaksensor?.hide_temperature) {
80
+ if (this.TemperatureSensor) {
81
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Temperature Sensor Service`);
82
+ this.TemperatureSensor.Service = accessory.getService(this.hap.Service.TemperatureSensor);
83
+ accessory.removeService(this.TemperatureSensor.Service);
84
+ }
85
+ else {
86
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Temperature Sensor Service Not Found`);
87
+ }
88
+ }
89
+ else {
90
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Temperature Sensor Service`);
91
+ accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {};
92
+ this.TemperatureSensor = {
93
+ Name: accessory.context.TemperatureSensor.Name ?? `${accessory.displayName} Temperature Sensor`,
94
+ Service: accessory.getService(this.hap.Service.TemperatureSensor) ?? accessory.addService(this.hap.Service.TemperatureSensor),
95
+ CurrentTemperature: accessory.context.CurrentTemperature ?? 20,
96
+ };
97
+ accessory.context.TemperatureSensor = this.TemperatureSensor;
98
+ // Initialize Temperature Sensor Characteristic
99
+ this.TemperatureSensor.Service
100
+ .setCharacteristic(this.hap.Characteristic.Name, this.TemperatureSensor.Name)
101
+ .getCharacteristic(this.hap.Characteristic.CurrentTemperature)
102
+ .setProps({
103
+ minValue: -273.15,
104
+ maxValue: 100,
105
+ minStep: 0.1,
106
+ })
107
+ .onGet(async () => {
108
+ return this.TemperatureSensor.CurrentTemperature;
109
+ });
110
+ }
111
+ // Initialize Humidity Sensor Service
112
+ if (device.leaksensor?.hide_humidity) {
113
+ if (this.HumiditySensor) {
114
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Removing Humidity Sensor Service`);
115
+ this.HumiditySensor.Service = accessory.getService(this.hap.Service.HumiditySensor);
116
+ accessory.removeService(this.HumiditySensor.Service);
117
+ }
118
+ else {
119
+ this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Humidity Sensor Service Not Found`);
120
+ }
121
+ }
122
+ else if (device.indoorHumidity) {
123
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Add Humidity Sensor Service`);
124
+ accessory.context.HumiditySensor = accessory.context.HumiditySensor ?? {};
125
+ this.HumiditySensor = {
126
+ Name: accessory.context.HumiditySensor.Name ?? `${accessory.displayName} Humidity Sensor`,
127
+ Service: accessory.getService(this.hap.Service.HumiditySensor) ?? accessory.addService(this.hap.Service.HumiditySensor),
128
+ CurrentRelativeHumidity: accessory.context.CurrentRelativeHumidity ?? 50,
129
+ };
130
+ accessory.context.HumiditySensor = this.HumiditySensor;
131
+ // Initialize Humidity Sensor Characteristic
132
+ this.HumiditySensor.Service
133
+ .setCharacteristic(this.hap.Characteristic.Name, this.HumiditySensor.Name);
134
+ this.HumiditySensor.Service
135
+ .getCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity)
136
+ .setProps({
137
+ minStep: 0.1,
138
+ })
139
+ .onGet(() => {
140
+ return this.HumiditySensor.CurrentRelativeHumidity;
141
+ });
142
+ }
143
+ else {
144
+ this.debugLog(`${device.deviceClass} ${accessory.displayName} Humidity Sensor Service Not Added`);
145
+ }
146
+ // Intial Refresh
147
+ this.refreshStatus();
148
+ // Retrieve initial values and updateHomekit
149
+ this.updateHomeKitCharacteristics();
150
+ // Start an update interval
151
+ interval(this.config.options.refreshRate * 1000)
152
+ .pipe(skipWhile(() => this.SensorUpdateInProgress))
153
+ .subscribe(async () => {
154
+ await this.refreshStatus();
155
+ });
156
+ }
157
+ /**
158
+ * Parse the device status from the Resideo api
159
+ */
160
+ async parseStatus() {
161
+ // Battery Service
162
+ this.Battery.BatteryLevel = Number(this.device.batteryRemaining);
163
+ this.Battery.Service.getCharacteristic(this.hap.Characteristic.BatteryLevel).updateValue(this.Battery.BatteryLevel);
164
+ if (this.device.batteryRemaining < 15) {
165
+ this.Battery.StatusLowBattery = this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
166
+ }
167
+ else {
168
+ this.Battery.StatusLowBattery = this.hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
169
+ }
170
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} BatteryLevel: ${this.Battery.BatteryLevel}, StatusLowBattery: ${this.Battery.StatusLowBattery}`);
171
+ // LeakSensor Service
172
+ if (!this.device.leaksensor?.hide_leak) {
173
+ if (this.LeakSensor) {
174
+ // Active
175
+ this.LeakSensor.StatusActive = this.device.hasDeviceCheckedIn;
176
+ // LeakDetected
177
+ if (this.device.waterPresent === true) {
178
+ this.LeakSensor.LeakDetected = this.hap.Characteristic.LeakDetected.LEAK_DETECTED;
179
+ }
180
+ else {
181
+ this.LeakSensor.LeakDetected = this.hap.Characteristic.LeakDetected.LEAK_NOT_DETECTED;
182
+ }
183
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} StatusActive: ${this.LeakSensor.StatusActive}, LeakDetected: ${this.LeakSensor.LeakDetected}`);
184
+ }
185
+ }
186
+ const currentSensorReadings = this.device.currentSensorReadings ?? { temperature: 20, humidity: 50 };
187
+ // Temperature Service
188
+ if (!this.device.leaksensor?.hide_temperature) {
189
+ if (this.TemperatureSensor) {
190
+ this.TemperatureSensor.CurrentTemperature = currentSensorReadings.temperature;
191
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}°`);
192
+ }
193
+ }
194
+ // Humidity Service
195
+ if (!this.device.leaksensor?.hide_humidity) {
196
+ if (this.HumiditySensor) {
197
+ this.HumiditySensor.CurrentRelativeHumidity = currentSensorReadings.humidity;
198
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} CurrentRelativeHumidity: ${this.HumiditySensor.CurrentRelativeHumidity}%`);
199
+ }
200
+ }
201
+ }
202
+ /**
203
+ * Asks the Resideo Home API for the latest device information
204
+ */
205
+ async refreshStatus() {
206
+ try {
207
+ const device = (await this.platform.axios.get(`${DeviceURL}/waterLeakDetectors/${this.device.deviceID}`, {
208
+ params: {
209
+ locationId: this.location.locationID,
210
+ },
211
+ })).data;
212
+ this.debugLog(`(refreshStatus) ${device.deviceClass} device: ${JSON.stringify(device)}`);
213
+ this.device = device;
214
+ await this.parseStatus();
215
+ await this.updateHomeKitCharacteristics();
216
+ }
217
+ catch (e) {
218
+ const action = 'refreshStatus';
219
+ if (this.device.retry) {
220
+ // Refresh the status from the API
221
+ interval(5000)
222
+ .pipe(skipWhile(() => this.SensorUpdateInProgress))
223
+ .pipe(take(1))
224
+ .subscribe(async () => {
225
+ await this.refreshStatus();
226
+ });
227
+ }
228
+ this.resideoAPIError(e, action);
229
+ this.apiError(e);
230
+ }
231
+ }
232
+ /**
233
+ * Updates the status for each of the HomeKit Characteristics
234
+ */
235
+ async updateHomeKitCharacteristics() {
236
+ if (this.Battery.BatteryLevel === undefined) {
237
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} BatteryLevel: ${this.Battery.BatteryLevel}`);
238
+ }
239
+ else {
240
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, this.Battery.BatteryLevel);
241
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.Battery.BatteryLevel}`);
242
+ }
243
+ if (this.Battery.StatusLowBattery === undefined) {
244
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} StatusLowBattery: ${this.Battery.StatusLowBattery}`);
245
+ }
246
+ else {
247
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, this.Battery.StatusLowBattery);
248
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.Battery.StatusLowBattery}`);
249
+ }
250
+ if (!this.device.leaksensor?.hide_leak) {
251
+ if (this.LeakSensor?.LeakDetected === undefined) {
252
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} LeakDetected: ${this.LeakSensor?.LeakDetected}`);
253
+ }
254
+ else {
255
+ this.LeakSensor?.Service.updateCharacteristic(this.hap.Characteristic.LeakDetected, this.LeakSensor?.LeakDetected);
256
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic LeakDetected: ${this.LeakSensor?.LeakDetected}`);
257
+ }
258
+ if (this.LeakSensor?.StatusActive === undefined) {
259
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} StatusActive: ${this.LeakSensor?.StatusActive}`);
260
+ }
261
+ else {
262
+ this.LeakSensor.Service.updateCharacteristic(this.hap.Characteristic.StatusActive, this.LeakSensor?.StatusActive);
263
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic StatusActive: ${this.LeakSensor?.StatusActive}`);
264
+ }
265
+ }
266
+ if (!this.device.leaksensor?.hide_temperature) {
267
+ if (this.TemperatureSensor?.CurrentTemperature === undefined) {
268
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} CurrentTemperature: ${this.TemperatureSensor?.CurrentTemperature}`);
269
+ }
270
+ else {
271
+ this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, this.TemperatureSensor?.CurrentTemperature);
272
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.TemperatureSensor.CurrentTemperature}`);
273
+ }
274
+ }
275
+ if (!this.device.leaksensor?.hide_humidity) {
276
+ if (this.HumiditySensor?.CurrentRelativeHumidity === undefined) {
277
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} CurrentRelativeHumidity: ${this.HumiditySensor?.CurrentRelativeHumidity}`);
278
+ }
279
+ else {
280
+ this.HumiditySensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, this.HumiditySensor?.CurrentRelativeHumidity);
281
+ this.debugLog(`${this.device.deviceClass} ${this.accessory.displayName} updateCharacteristic CurrentRelativeHumidity: ${this.HumiditySensor?.CurrentRelativeHumidity}`);
282
+ }
283
+ }
284
+ }
285
+ async apiError(e) {
286
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.BatteryLevel, e);
287
+ this.Battery.Service.updateCharacteristic(this.hap.Characteristic.StatusLowBattery, e);
288
+ if (!this.device.leaksensor?.hide_leak) {
289
+ this.LeakSensor?.Service.updateCharacteristic(this.hap.Characteristic.LeakDetected, e);
290
+ this.LeakSensor?.Service.updateCharacteristic(this.hap.Characteristic.StatusActive, e);
291
+ }
292
+ if (!this.device.leaksensor?.hide_temperature) {
293
+ this.TemperatureSensor?.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e);
294
+ }
295
+ if (!this.device.leaksensor?.hide_humidity) {
296
+ this.HumiditySensor?.Service.updateCharacteristic(this.hap.Characteristic.CurrentRelativeHumidity, e);
297
+ }
298
+ }
299
+ }
300
+ //# sourceMappingURL=leaksensors.js.map