homebridge-rainpoint 1.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.
Files changed (60) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +143 -0
  3. package/config.schema.json +148 -0
  4. package/dist/IrrigationSystemAccessory.d.ts +26 -0
  5. package/dist/IrrigationSystemAccessory.d.ts.map +1 -0
  6. package/dist/IrrigationSystemAccessory.js +168 -0
  7. package/dist/IrrigationSystemAccessory.js.map +1 -0
  8. package/dist/SensorAccessory.d.ts +22 -0
  9. package/dist/SensorAccessory.d.ts.map +1 -0
  10. package/dist/SensorAccessory.js +74 -0
  11. package/dist/SensorAccessory.js.map +1 -0
  12. package/dist/ValveAccessory.d.ts +25 -0
  13. package/dist/ValveAccessory.d.ts.map +1 -0
  14. package/dist/ValveAccessory.js +119 -0
  15. package/dist/ValveAccessory.js.map +1 -0
  16. package/dist/api/RainPointClientInterface.d.ts +65 -0
  17. package/dist/api/RainPointClientInterface.d.ts.map +1 -0
  18. package/dist/api/RainPointClientInterface.js +3 -0
  19. package/dist/api/RainPointClientInterface.js.map +1 -0
  20. package/dist/api/RainPointHomeClient.d.ts +36 -0
  21. package/dist/api/RainPointHomeClient.d.ts.map +1 -0
  22. package/dist/api/RainPointHomeClient.js +359 -0
  23. package/dist/api/RainPointHomeClient.js.map +1 -0
  24. package/dist/api/RainPointTyClient.d.ts +113 -0
  25. package/dist/api/RainPointTyClient.d.ts.map +1 -0
  26. package/dist/api/RainPointTyClient.js +947 -0
  27. package/dist/api/RainPointTyClient.js.map +1 -0
  28. package/dist/api/constants.d.ts +53 -0
  29. package/dist/api/constants.d.ts.map +1 -0
  30. package/dist/api/constants.js +105 -0
  31. package/dist/api/constants.js.map +1 -0
  32. package/dist/api/dp-parser.d.ts +14 -0
  33. package/dist/api/dp-parser.d.ts.map +1 -0
  34. package/dist/api/dp-parser.js +100 -0
  35. package/dist/api/dp-parser.js.map +1 -0
  36. package/dist/api/index.d.ts +7 -0
  37. package/dist/api/index.d.ts.map +1 -0
  38. package/dist/api/index.js +23 -0
  39. package/dist/api/index.js.map +1 -0
  40. package/dist/api/types.d.ts +330 -0
  41. package/dist/api/types.d.ts.map +1 -0
  42. package/dist/api/types.js +3 -0
  43. package/dist/api/types.js.map +1 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +7 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/naming.d.ts +14 -0
  49. package/dist/naming.d.ts.map +1 -0
  50. package/dist/naming.js +22 -0
  51. package/dist/naming.js.map +1 -0
  52. package/dist/platform.d.ts +52 -0
  53. package/dist/platform.d.ts.map +1 -0
  54. package/dist/platform.js +277 -0
  55. package/dist/platform.js.map +1 -0
  56. package/dist/settings.d.ts +3 -0
  57. package/dist/settings.d.ts.map +1 -0
  58. package/dist/settings.js +6 -0
  59. package/dist/settings.js.map +1 -0
  60. package/package.json +59 -0
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RainPointPlatform = void 0;
4
+ const settings_1 = require("./settings");
5
+ const RainPointHomeClient_1 = require("./api/RainPointHomeClient");
6
+ const RainPointTyClient_1 = require("./api/RainPointTyClient");
7
+ const constants_1 = require("./api/constants");
8
+ const ValveAccessory_1 = require("./ValveAccessory");
9
+ const SensorAccessory_1 = require("./SensorAccessory");
10
+ const IrrigationSystemAccessory_1 = require("./IrrigationSystemAccessory");
11
+ const naming_1 = require("./naming");
12
+ class RainPointPlatform {
13
+ constructor(log, platformConfig, api) {
14
+ this.log = log;
15
+ this.platformConfig = platformConfig;
16
+ this.api = api;
17
+ this.Service = this.api.hap.Service;
18
+ this.Characteristic = this.api.hap.Characteristic;
19
+ this.accessories = [];
20
+ this.pollTimer = null;
21
+ this.accessoryHandlers = new Map();
22
+ this.deviceStatusMap = new Map();
23
+ this.discoveredDeviceIds = new Set();
24
+ this.provider = platformConfig.provider || 'home';
25
+ this.email = platformConfig.email || '';
26
+ this.password = platformConfig.password || '';
27
+ // Region is split per provider: RainPoint Home uses regionHome (US/CN),
28
+ // RainPoint TY uses regionTy (AZ/EU/IN/CN). Each has its own config field
29
+ // and is shown conditionally in the UI based on the selected provider.
30
+ // Falls back to the legacy `region` field if the per-provider field is unset.
31
+ this.region = this.provider === 'ty'
32
+ ? (platformConfig.regionTy || platformConfig.region || 'AZ')
33
+ : (platformConfig.regionHome || platformConfig.region || 'US');
34
+ this.countryCode = platformConfig.countryCode || '1';
35
+ this.homeIndex = platformConfig.homeIndex ?? 0;
36
+ this.pollInterval = platformConfig.pollInterval ?? constants_1.DEFAULT_POLL_INTERVAL;
37
+ this.flatValves = platformConfig.flatValves ?? false;
38
+ this.debugmode = platformConfig.debugmode ?? false;
39
+ if (this.pollInterval < constants_1.MIN_POLL_INTERVAL) {
40
+ this.pollInterval = constants_1.MIN_POLL_INTERVAL;
41
+ }
42
+ if (!this.email || !this.password) {
43
+ this.log.warn('Missing required configuration: email and password are required');
44
+ this.client = null;
45
+ return;
46
+ }
47
+ this.client = this.createClient();
48
+ this.log.info('Initializing RainPoint platform (provider: %s):', this.provider, platformConfig.name || 'RainPoint');
49
+ this.api.on('didFinishLaunching', async () => {
50
+ this.log.debug('Executed didFinishLaunching callback');
51
+ await this.discoverDevices();
52
+ });
53
+ }
54
+ createClient() {
55
+ const config = {
56
+ email: this.email,
57
+ password: this.password,
58
+ region: this.region,
59
+ countryCode: this.countryCode,
60
+ // Persist the TY cloud session (sid/ecode/endpoint) across homebridge restarts
61
+ // so we don't re-login every reload. User.storagePath() is the homebridge
62
+ // per-instance storage dir; the TY client keys the session file by email.
63
+ storageDir: this.api.user.storagePath(),
64
+ };
65
+ if (this.provider === 'ty') {
66
+ return new RainPointTyClient_1.RainPointTyClient(config, this.log);
67
+ }
68
+ return new RainPointHomeClient_1.RainPointHomeClient(config, this.log);
69
+ }
70
+ configureAccessory(accessory) {
71
+ this.log.info('Loading accessory from cache:', accessory.displayName);
72
+ this.accessories.push(accessory);
73
+ }
74
+ async discoverDevices() {
75
+ try {
76
+ this.log.info('Connecting to RainPoint API (provider: %s)...', this.provider);
77
+ await this.client.login();
78
+ this.log.info('Fetching homes...');
79
+ const homes = await this.client.getHomes();
80
+ if (homes.length === 0) {
81
+ this.log.warn('No homes found in your RainPoint account');
82
+ return;
83
+ }
84
+ const homeIndex = Math.min(this.homeIndex, homes.length - 1);
85
+ const home = homes[homeIndex];
86
+ this.client.setHome(home.id);
87
+ this.log.info('Using home: %s (%s)', home.name, home.id);
88
+ this.log.info('Fetching devices...');
89
+ const devices = await this.client.getDevices();
90
+ this.log.info('Found %d device(s)', devices.length);
91
+ this.discoveredDeviceIds.clear();
92
+ for (const device of devices) {
93
+ this.registerDevice(device);
94
+ }
95
+ this.cleanupStaleAccessories();
96
+ this.startPolling();
97
+ }
98
+ catch (error) {
99
+ this.log.error('Failed to discover devices:', error);
100
+ }
101
+ }
102
+ registerDevice(device) {
103
+ this.log.debug('Device: %s (%s) - type: %s, ports: %d, sub: %s', device.name, device.model, device.deviceType, device.portNumber, device.isSubDevice);
104
+ this.discoveredDeviceIds.add(device.id);
105
+ if (device.deviceType === constants_1.DEVICE_TYPE_GATEWAY) {
106
+ this.log.debug('Skipping gateway device: %s', device.name);
107
+ return;
108
+ }
109
+ if (device.deviceType === constants_1.DEVICE_TYPE_SENSOR) {
110
+ this.registerSensorAccessory(device);
111
+ return;
112
+ }
113
+ if (this.flatValves) {
114
+ this.registerFlatValves(device);
115
+ }
116
+ else {
117
+ this.registerIrrigationSystem(device);
118
+ }
119
+ }
120
+ registerFlatValves(device) {
121
+ for (let port = 1; port <= device.portNumber; port++) {
122
+ const zoneName = (0, naming_1.zoneDisplayName)(device, port, true);
123
+ this.registerValveAccessory(device, port, zoneName);
124
+ }
125
+ }
126
+ registerValveAccessory(device, port, name) {
127
+ const uniqueId = this.debugmode ? `dev_${device.id}_port${port}` : `${device.id}_port${port}`;
128
+ const uuid = this.api.hap.uuid.generate(uniqueId);
129
+ const existingAccessory = this.accessories.find(acc => acc.UUID === uuid);
130
+ const context = {
131
+ deviceId: device.id,
132
+ port,
133
+ name,
134
+ model: device.model,
135
+ productId: device.productId,
136
+ deviceType: device.deviceType,
137
+ isSubDevice: device.isSubDevice,
138
+ parentId: device.parentId,
139
+ addr: device.addr,
140
+ portName: name,
141
+ zoneNames: device.portDescribe,
142
+ };
143
+ if (existingAccessory) {
144
+ this.log.info('Restoring existing valve accessory from cache:', existingAccessory.displayName);
145
+ existingAccessory.context = context;
146
+ this.api.updatePlatformAccessories([existingAccessory]);
147
+ const handler = new ValveAccessory_1.ValveAccessory(this, existingAccessory, context);
148
+ this.accessoryHandlers.set(uniqueId, handler);
149
+ }
150
+ else {
151
+ this.log.info('Adding new valve accessory:', name);
152
+ const accessory = new this.api.platformAccessory(name, uuid);
153
+ accessory.context = context;
154
+ const handler = new ValveAccessory_1.ValveAccessory(this, accessory, context);
155
+ this.accessoryHandlers.set(uniqueId, handler);
156
+ this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
157
+ }
158
+ }
159
+ registerSensorAccessory(device) {
160
+ const uniqueId = this.debugmode ? `dev_${device.id}` : device.id;
161
+ const uuid = this.api.hap.uuid.generate(uniqueId);
162
+ const existingAccessory = this.accessories.find(acc => acc.UUID === uuid);
163
+ const context = {
164
+ deviceId: device.id,
165
+ port: 0,
166
+ name: device.name,
167
+ model: device.model,
168
+ productId: device.productId,
169
+ deviceType: constants_1.DEVICE_TYPE_SENSOR,
170
+ isSubDevice: device.isSubDevice,
171
+ parentId: device.parentId,
172
+ addr: device.addr,
173
+ portName: device.name,
174
+ zoneNames: device.portDescribe,
175
+ };
176
+ if (existingAccessory) {
177
+ this.log.info('Restoring existing sensor accessory from cache:', existingAccessory.displayName);
178
+ existingAccessory.context = context;
179
+ this.api.updatePlatformAccessories([existingAccessory]);
180
+ const handler = new SensorAccessory_1.SensorAccessory(this, existingAccessory, context);
181
+ this.accessoryHandlers.set(uniqueId, handler);
182
+ }
183
+ else {
184
+ this.log.info('Adding new sensor accessory:', device.name);
185
+ const accessory = new this.api.platformAccessory(device.name, uuid);
186
+ accessory.context = context;
187
+ const handler = new SensorAccessory_1.SensorAccessory(this, accessory, context);
188
+ this.accessoryHandlers.set(uniqueId, handler);
189
+ this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
190
+ }
191
+ }
192
+ registerIrrigationSystem(device) {
193
+ const uniqueId = this.debugmode ? `dev_sys_${device.id}` : `sys_${device.id}`;
194
+ const uuid = this.api.hap.uuid.generate(uniqueId);
195
+ const existingAccessory = this.accessories.find(acc => acc.UUID === uuid);
196
+ const context = {
197
+ deviceId: device.id,
198
+ port: 0,
199
+ name: device.name,
200
+ model: device.model,
201
+ productId: device.productId,
202
+ deviceType: device.deviceType,
203
+ isSubDevice: device.isSubDevice,
204
+ parentId: device.parentId,
205
+ addr: device.addr,
206
+ portName: device.name,
207
+ zoneNames: device.portDescribe,
208
+ };
209
+ if (existingAccessory) {
210
+ this.log.info('Restoring existing irrigation system accessory from cache:', existingAccessory.displayName);
211
+ existingAccessory.context = context;
212
+ this.api.updatePlatformAccessories([existingAccessory]);
213
+ const handler = new IrrigationSystemAccessory_1.IrrigationSystemAccessory(this, existingAccessory, context, device);
214
+ this.accessoryHandlers.set(uniqueId, handler);
215
+ }
216
+ else {
217
+ this.log.info('Adding new irrigation system accessory:', device.name);
218
+ const accessory = new this.api.platformAccessory(device.name, uuid);
219
+ accessory.context = context;
220
+ const handler = new IrrigationSystemAccessory_1.IrrigationSystemAccessory(this, accessory, context, device);
221
+ this.accessoryHandlers.set(uniqueId, handler);
222
+ this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
223
+ }
224
+ }
225
+ startPolling() {
226
+ if (this.pollTimer) {
227
+ clearInterval(this.pollTimer);
228
+ }
229
+ const intervalSeconds = this.pollInterval;
230
+ this.log.info('Starting status polling every %d seconds', intervalSeconds);
231
+ this.pollTimer = setInterval(async () => {
232
+ await this.pollStatus();
233
+ }, intervalSeconds * 1000);
234
+ this.pollStatus();
235
+ }
236
+ async pollStatus() {
237
+ try {
238
+ const deviceIds = Array.from(this.discoveredDeviceIds);
239
+ if (deviceIds.length === 0) {
240
+ return;
241
+ }
242
+ const statuses = await this.client.getDeviceStatuses(deviceIds);
243
+ for (const [deviceId, status] of statuses) {
244
+ this.deviceStatusMap.set(deviceId, status);
245
+ }
246
+ this.updateAccessories();
247
+ }
248
+ catch (error) {
249
+ this.log.error('Polling failed:', error);
250
+ }
251
+ }
252
+ updateAccessories() {
253
+ for (const [, handler] of this.accessoryHandlers) {
254
+ const context = handler.getContext();
255
+ const status = this.deviceStatusMap.get(context.deviceId);
256
+ if (status) {
257
+ handler.updateStatus(status);
258
+ }
259
+ }
260
+ }
261
+ getDeviceStatus(deviceId) {
262
+ return this.deviceStatusMap.get(deviceId);
263
+ }
264
+ cleanupStaleAccessories() {
265
+ const currentIds = new Set();
266
+ for (const [uniqueId] of this.accessoryHandlers) {
267
+ currentIds.add(this.api.hap.uuid.generate(uniqueId));
268
+ }
269
+ const staleAccessories = this.accessories.filter(acc => !currentIds.has(acc.UUID));
270
+ if (staleAccessories.length > 0) {
271
+ this.log.info('Removing %d stale accessory(s)', staleAccessories.length);
272
+ this.api.unregisterPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, staleAccessories);
273
+ }
274
+ }
275
+ }
276
+ exports.RainPointPlatform = RainPointPlatform;
277
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAWA,yCAAwD;AAOxD,mEAAgE;AAChE,+DAA4D;AAC5D,+CAKyB;AACzB,qDAAkD;AAClD,uDAAoD;AACpD,2EAAwE;AACxE,qCAA2C;AAgB3C,MAAa,iBAAiB;IAsB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,CAAC;YAChD,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAEnF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gCAAgC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;YACzE,IAAI,CAAC,GAAG,CAAC,6BAA6B,CAAC,sBAAW,EAAE,wBAAa,EAAE,gBAAgB,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;CACF;AA9TD,8CA8TC"}
@@ -0,0 +1,3 @@
1
+ export declare const PLATFORM_NAME = "RainPoint";
2
+ export declare const PLUGIN_NAME = "homebridge-rainpoint";
3
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,WAAW,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_NAME = exports.PLATFORM_NAME = void 0;
4
+ exports.PLATFORM_NAME = 'RainPoint';
5
+ exports.PLUGIN_NAME = 'homebridge-rainpoint';
6
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,WAAW,CAAC;AAC5B,QAAA,WAAW,GAAG,sBAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "homebridge-rainpoint",
3
+ "version": "1.0.0",
4
+ "displayName": "Homebridge RainPoint",
5
+ "description": "Homebridge plugin for RainPoint irrigation systems - control water timers, valves, and soil sensors via the RainPoint/HomGar cloud API.",
6
+ "author": "Luke Zbihlyj",
7
+ "maintainers": [
8
+ "lukezbihlyj"
9
+ ],
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/lukezbihlyj/homebridge-rainpoint.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/lukezbihlyj/homebridge-rainpoint/issues"
17
+ },
18
+ "homepage": "https://github.com/lukezbihlyj/homebridge-rainpoint#readme",
19
+ "engines": {
20
+ "node": ">=18.0.0",
21
+ "homebridge": ">=1.6.0"
22
+ },
23
+ "main": "dist/index.js",
24
+ "scripts": {
25
+ "lint": "eslint src/**.ts --max-warnings=0",
26
+ "watch": "npm run build && npm link && nodemon",
27
+ "build": "rimraf ./dist && tsc",
28
+ "prepublishOnly": "npm run lint && npm run build"
29
+ },
30
+ "keywords": [
31
+ "homebridge-plugin",
32
+ "rainpoint",
33
+ "homgar",
34
+ "irrigation",
35
+ "sprinkler",
36
+ "water",
37
+ "timer",
38
+ "valve",
39
+ "sensor",
40
+ "soil",
41
+ "moisture",
42
+ "garden",
43
+ "homekit"
44
+ ],
45
+ "dependencies": {
46
+ "uuid": "^14.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^18.0.0",
50
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
51
+ "@typescript-eslint/parser": "^8.0.0",
52
+ "eslint": "^8.0.1",
53
+ "homebridge": "^1.6.0",
54
+ "nodemon": "^2.0.20",
55
+ "rimraf": "^3.0.2",
56
+ "ts-node": "^10.3.0",
57
+ "typescript": "^5.0.0"
58
+ }
59
+ }