@iobroker/dm-utils 0.1.7 → 0.1.8

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 CHANGED
@@ -294,6 +294,9 @@ This method returns a promise that resolves to a `ProgressDialog` object.
294
294
  ### **WORK IN PROGRESS**
295
295
  -->
296
296
  ## Changelog
297
+ ### 0.1.8 (2023-12-17)
298
+ * (bluefox) corrected control error
299
+
297
300
  ### 0.1.7 (2023-12-17)
298
301
  * (bluefox) added channel info
299
302
 
@@ -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 control ${controlId} was called before listDevices()`);
102
- return { error: { code: 201, message: `Device control ${controlId} was called before listDevices()` } };
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 control ${controlId} was called on unknown device: ${deviceId}`);
106
+ this.log.warn(`Device get state ${controlId} was called on unknown device: ${deviceId}`);
107
107
  return {
108
- error: { code: 202, message: `Device control ${controlId} was called on unknown device: ${deviceId}` },
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 control ${controlId} doesn't exist on device ${deviceId}`);
114
- return { error: { code: 203, message: `Device control ${controlId} doesn't exist on device ${deviceId}` } };
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.handler) {
117
- this.log.warn(`Device control ${controlId} on ${deviceId} is disabled because it has no handler`);
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: 204,
121
- message: `Device control ${controlId} on ${deviceId} is disabled because it has no handler`,
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
- E_DEVICE_CONTROL_NO_STATE = 305
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["E_DEVICE_CONTROL_NO_STATE"] = 305] = "E_DEVICE_CONTROL_NO_STATE";
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {