iobroker.hydrawise 1.0.6 → 1.1.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/README.md +8 -4
- package/build/lib/helpers.js +65 -0
- package/build/lib/helpers.js.map +7 -0
- package/build/main.js +544 -430
- package/build/main.js.map +3 -3
- package/io-package.json +14 -14
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -39,6 +39,14 @@ You can see all controller information, schedules and sensors. It is also possib
|
|
|
39
39
|
Placeholder for the next version (at the beginning of the line):
|
|
40
40
|
### **WORK IN PROGRESS**
|
|
41
41
|
-->
|
|
42
|
+
### 1.1.0 (2026-09-01)
|
|
43
|
+
|
|
44
|
+
* (SentiQ) **FIXED**: Relay ID mapping no longer writes onto the Object constructor
|
|
45
|
+
* (SentiQ) **FIXED**: runDefault reset no longer accidentally stops the zone
|
|
46
|
+
* (SentiQ) **ENHANCED**: Object creation only on structure change; poll overlap protection
|
|
47
|
+
* (SentiQ) **ENHANCED**: Replaced axios with native fetch; timers cleaned up on unload
|
|
48
|
+
* (SentiQ) **TESTING**: Unit tests for helpers (name2id, URL builder, structure signature)
|
|
49
|
+
|
|
42
50
|
### 1.0.6 (2026-08-09)
|
|
43
51
|
|
|
44
52
|
- (SentiQ) updated dependencies
|
|
@@ -58,10 +66,6 @@ You can see all controller information, schedules and sensors. It is also possib
|
|
|
58
66
|
|
|
59
67
|
- (SentiQ) updated dependencies
|
|
60
68
|
|
|
61
|
-
### 1.0.2 (2024-09-24)
|
|
62
|
-
|
|
63
|
-
- (SentiQ) fixed issues detected by repository checker
|
|
64
|
-
|
|
65
69
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
66
70
|
|
|
67
71
|
## License
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var helpers_exports = {};
|
|
20
|
+
__export(helpers_exports, {
|
|
21
|
+
CUSTOMER_SKIP_KEYS: () => CUSTOMER_SKIP_KEYS,
|
|
22
|
+
HYDRAWISE_BASE_URL: () => HYDRAWISE_BASE_URL,
|
|
23
|
+
SCHEDULE_SKIP_KEYS: () => SCHEDULE_SKIP_KEYS,
|
|
24
|
+
buildHydrawiseUrl: () => buildHydrawiseUrl,
|
|
25
|
+
isScalarKey: () => isScalarKey,
|
|
26
|
+
name2id: () => name2id,
|
|
27
|
+
structureSignature: () => structureSignature
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
30
|
+
const HYDRAWISE_BASE_URL = "https://api.hydrawise.com";
|
|
31
|
+
const SCHEDULE_SKIP_KEYS = ["relays", "sensors", "expanders"];
|
|
32
|
+
const CUSTOMER_SKIP_KEYS = ["controllers"];
|
|
33
|
+
function name2id(name, forbiddenChars) {
|
|
34
|
+
return (name || "").replace(forbiddenChars, "_");
|
|
35
|
+
}
|
|
36
|
+
function isScalarKey(key, skipKeys) {
|
|
37
|
+
return !skipKeys.includes(key);
|
|
38
|
+
}
|
|
39
|
+
function buildHydrawiseUrl(service, params) {
|
|
40
|
+
const url = new URL(`/api/v1/${service}`, HYDRAWISE_BASE_URL);
|
|
41
|
+
for (const [key, value] of Object.entries(params)) {
|
|
42
|
+
if (value !== void 0 && value !== null) {
|
|
43
|
+
url.searchParams.set(key, String(value));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return url.toString();
|
|
47
|
+
}
|
|
48
|
+
function structureSignature(relayIds, sensorInputs, controllerNames = []) {
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
relays: [...relayIds].map(String).sort(),
|
|
51
|
+
sensors: [...sensorInputs].map(String).sort(),
|
|
52
|
+
controllers: [...controllerNames].map(String).sort()
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
CUSTOMER_SKIP_KEYS,
|
|
58
|
+
HYDRAWISE_BASE_URL,
|
|
59
|
+
SCHEDULE_SKIP_KEYS,
|
|
60
|
+
buildHydrawiseUrl,
|
|
61
|
+
isScalarKey,
|
|
62
|
+
name2id,
|
|
63
|
+
structureSignature
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lib/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["export const HYDRAWISE_BASE_URL = 'https://api.hydrawise.com';\n\nexport const SCHEDULE_SKIP_KEYS = ['relays', 'sensors', 'expanders'] as const;\nexport const CUSTOMER_SKIP_KEYS = ['controllers'] as const;\n\n/**\n * Replace characters forbidden in ioBroker object IDs.\n *\n * @param name raw name from API\n * @param forbiddenChars adapter FORBIDDEN_CHARS regex\n */\nexport function name2id(name: string, forbiddenChars: RegExp): string {\n return (name || '').replace(forbiddenChars, '_');\n}\n\n/**\n * True when the key is a scalar field (not a nested array/object list).\n *\n * @param key API response key\n * @param skipKeys keys to skip (arrays/objects)\n */\nexport function isScalarKey(key: string, skipKeys: readonly string[]): boolean {\n return !skipKeys.includes(key);\n}\n\n/**\n * Build a full Hydrawise API URL with query parameters.\n *\n * @param service endpoint file name (e.g. statusschedule.php)\n * @param params query parameters\n */\nexport function buildHydrawiseUrl(service: string, params: Record<string, string | number | boolean>): string {\n const url = new URL(`/api/v1/${service}`, HYDRAWISE_BASE_URL);\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n}\n\n/**\n * Stable signature of schedule/customer structure for object-sync decisions.\n *\n * @param relayIds relay numbers from status API\n * @param sensorInputs sensor input numbers\n * @param controllerNames controller names from customer API\n */\nexport function structureSignature(\n relayIds: Array<string | number>,\n sensorInputs: Array<string | number>,\n controllerNames: string[] = [],\n): string {\n return JSON.stringify({\n relays: [...relayIds].map(String).sort(),\n sensors: [...sensorInputs].map(String).sort(),\n controllers: [...controllerNames].map(String).sort(),\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,qBAAqB;AAE3B,MAAM,qBAAqB,CAAC,UAAU,WAAW,WAAW;AAC5D,MAAM,qBAAqB,CAAC,aAAa;AAQzC,SAAS,QAAQ,MAAc,gBAAgC;AAClE,UAAQ,QAAQ,IAAI,QAAQ,gBAAgB,GAAG;AACnD;AAQO,SAAS,YAAY,KAAa,UAAsC;AAC3E,SAAO,CAAC,SAAS,SAAS,GAAG;AACjC;AAQO,SAAS,kBAAkB,SAAiB,QAA2D;AAC1G,QAAM,MAAM,IAAI,IAAI,WAAW,OAAO,IAAI,kBAAkB;AAC5D,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAC/C,QAAI,UAAU,UAAa,UAAU,MAAM;AACvC,UAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,IAC3C;AAAA,EACJ;AACA,SAAO,IAAI,SAAS;AACxB;AASO,SAAS,mBACZ,UACA,cACA,kBAA4B,CAAC,GACvB;AACN,SAAO,KAAK,UAAU;AAAA,IAClB,QAAQ,CAAC,GAAG,QAAQ,EAAE,IAAI,MAAM,EAAE,KAAK;AAAA,IACvC,SAAS,CAAC,GAAG,YAAY,EAAE,IAAI,MAAM,EAAE,KAAK;AAAA,IAC5C,aAAa,CAAC,GAAG,eAAe,EAAE,IAAI,MAAM,EAAE,KAAK;AAAA,EACvD,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|