@iobroker/dm-utils 0.1.7 → 0.1.9
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 +6 -0
- package/build/DeviceManagement.js +10 -10
- package/build/types/errorCodes.d.ts +4 -1
- package/build/types/errorCodes.js +4 -1
- package/build/types/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,6 +294,12 @@ This method returns a promise that resolves to a `ProgressDialog` object.
|
|
|
294
294
|
### **WORK IN PROGRESS**
|
|
295
295
|
-->
|
|
296
296
|
## Changelog
|
|
297
|
+
### 0.1.9 (2023-12-25)
|
|
298
|
+
* (foxriver76) enhanced type exports
|
|
299
|
+
|
|
300
|
+
### 0.1.8 (2023-12-17)
|
|
301
|
+
* (bluefox) corrected control error
|
|
302
|
+
|
|
297
303
|
### 0.1.7 (2023-12-17)
|
|
298
304
|
* (bluefox) added channel info
|
|
299
305
|
|
|
@@ -98,27 +98,27 @@ class DeviceManagement {
|
|
|
98
98
|
handleDeviceControlState(deviceId, controlId, context) {
|
|
99
99
|
var _a;
|
|
100
100
|
if (!this.devices) {
|
|
101
|
-
this.log.warn(`Device
|
|
102
|
-
return { error: { code:
|
|
101
|
+
this.log.warn(`Device get state ${controlId} was called before listDevices()`);
|
|
102
|
+
return { error: { code: types_1.ErrorCodes.E_DEVICE_GET_STATE_NOT_INITIALIZED, message: `Device control ${controlId} was called before listDevices()` } };
|
|
103
103
|
}
|
|
104
104
|
const device = this.devices.get(deviceId);
|
|
105
105
|
if (!device) {
|
|
106
|
-
this.log.warn(`Device
|
|
106
|
+
this.log.warn(`Device get state ${controlId} was called on unknown device: ${deviceId}`);
|
|
107
107
|
return {
|
|
108
|
-
error: { code:
|
|
108
|
+
error: { code: types_1.ErrorCodes.E_DEVICE_GET_STATE_DEVICE_UNKNOWN, message: `Device control ${controlId} was called on unknown device: ${deviceId}` },
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
const control = (_a = device.controls) === null || _a === void 0 ? void 0 : _a.find((a) => a.id === controlId);
|
|
112
112
|
if (!control) {
|
|
113
|
-
this.log.warn(`Device
|
|
114
|
-
return { error: { code:
|
|
113
|
+
this.log.warn(`Device get state ${controlId} doesn't exist on device ${deviceId}`);
|
|
114
|
+
return { error: { code: types_1.ErrorCodes.E_DEVICE_GET_STATE_UNKNOWN, message: `Device control ${controlId} doesn't exist on device ${deviceId}` } };
|
|
115
115
|
}
|
|
116
|
-
if (!control.
|
|
117
|
-
this.log.warn(`Device
|
|
116
|
+
if (!control.getStateHandler) {
|
|
117
|
+
this.log.warn(`Device get state ${controlId} on ${deviceId} is disabled because it has no handler`);
|
|
118
118
|
return {
|
|
119
119
|
error: {
|
|
120
|
-
code:
|
|
121
|
-
message: `Device
|
|
120
|
+
code: types_1.ErrorCodes.E_DEVICE_GET_STATE_NO_HANDLER,
|
|
121
|
+
message: `Device get state ${controlId} on ${deviceId} is disabled because it has no handler`,
|
|
122
122
|
},
|
|
123
123
|
};
|
|
124
124
|
}
|
|
@@ -10,5 +10,8 @@ export declare enum ErrorCodes {
|
|
|
10
10
|
E_DEVICE_CONTROL_DEVICE_UNKNOWN = 302,
|
|
11
11
|
E_DEVICE_CONTROL_UNKNOWN = 303,
|
|
12
12
|
E_DEVICE_CONTROL_NO_HANDLER = 304,
|
|
13
|
-
|
|
13
|
+
E_DEVICE_GET_STATE_NOT_INITIALIZED = 401,
|
|
14
|
+
E_DEVICE_GET_STATE_DEVICE_UNKNOWN = 402,
|
|
15
|
+
E_DEVICE_GET_STATE_UNKNOWN = 403,
|
|
16
|
+
E_DEVICE_GET_STATE_NO_HANDLER = 404
|
|
14
17
|
}
|
|
@@ -14,5 +14,8 @@ var ErrorCodes;
|
|
|
14
14
|
ErrorCodes[ErrorCodes["E_DEVICE_CONTROL_DEVICE_UNKNOWN"] = 302] = "E_DEVICE_CONTROL_DEVICE_UNKNOWN";
|
|
15
15
|
ErrorCodes[ErrorCodes["E_DEVICE_CONTROL_UNKNOWN"] = 303] = "E_DEVICE_CONTROL_UNKNOWN";
|
|
16
16
|
ErrorCodes[ErrorCodes["E_DEVICE_CONTROL_NO_HANDLER"] = 304] = "E_DEVICE_CONTROL_NO_HANDLER";
|
|
17
|
-
ErrorCodes[ErrorCodes["
|
|
17
|
+
ErrorCodes[ErrorCodes["E_DEVICE_GET_STATE_NOT_INITIALIZED"] = 401] = "E_DEVICE_GET_STATE_NOT_INITIALIZED";
|
|
18
|
+
ErrorCodes[ErrorCodes["E_DEVICE_GET_STATE_DEVICE_UNKNOWN"] = 402] = "E_DEVICE_GET_STATE_DEVICE_UNKNOWN";
|
|
19
|
+
ErrorCodes[ErrorCodes["E_DEVICE_GET_STATE_UNKNOWN"] = 403] = "E_DEVICE_GET_STATE_UNKNOWN";
|
|
20
|
+
ErrorCodes[ErrorCodes["E_DEVICE_GET_STATE_NO_HANDLER"] = 404] = "E_DEVICE_GET_STATE_NO_HANDLER";
|
|
18
21
|
})(ErrorCodes || (exports.ErrorCodes = ErrorCodes = {}));
|
package/build/types/index.d.ts
CHANGED