@iobroker/dm-utils 1.0.0 → 1.0.1
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 +15 -4
- package/build/types/base.d.ts +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ In most cases, you will get all states of your instance and fill the array with
|
|
|
114
114
|
|
|
115
115
|
Every array entry is an object of type `DeviceInfo` which has the following properties:
|
|
116
116
|
|
|
117
|
-
- `id` (string): a unique (human
|
|
117
|
+
- `id` (string): a unique (human-readable) identifier of the device (it must be unique for your adapter instance only)
|
|
118
118
|
- `name` (string or translations): the human-readable name of this device
|
|
119
119
|
- `status` (optional): the current status of the device, which can be one of:
|
|
120
120
|
- `"disconnected"`
|
|
@@ -197,8 +197,8 @@ This method is called when the user clicks on a control (i.e., slider) in the de
|
|
|
197
197
|
|
|
198
198
|
The parameters of this method are:
|
|
199
199
|
- `deviceId` (string): the `id` that was given in `listDevices()` --> `[].id`
|
|
200
|
-
- `controlId` (string): the `id` that was given in `listDevices()` --> `[].controls[].id
|
|
201
|
-
- `state` (string | number | boolean): new state for the control, that will be sent to real device
|
|
200
|
+
- `controlId` (string): the `id` that was given in `listDevices()` --> `[].controls[].id`. There are some reserved control names, you can find the list below.
|
|
201
|
+
- `state` (string | number | boolean): new state for the control, that will be sent to a real device
|
|
202
202
|
- `context` (object): object containing helper methods that can be used when executing the action
|
|
203
203
|
|
|
204
204
|
The returned object must contain:
|
|
@@ -206,6 +206,9 @@ The returned object must contain:
|
|
|
206
206
|
|
|
207
207
|
This method can be implemented asynchronously and can take a lot of time to complete.
|
|
208
208
|
|
|
209
|
+
Reserved control names:
|
|
210
|
+
- `disabled` - The disabled control has its own pre-defined place on the device card and is used to disable the device. The state of this control is boolean.
|
|
211
|
+
|
|
209
212
|
### `handleDeviceControlState(deviceId: string, controlId: string, context: MessageContext)
|
|
210
213
|
|
|
211
214
|
This method is called when GUI requests the update of the state.
|
|
@@ -226,7 +229,11 @@ To allow your adapter to interact with the user, you can use "actions".
|
|
|
226
229
|
|
|
227
230
|
As described above, there are actions on the instance and on devices. The behavior of both methods is similar.
|
|
228
231
|
|
|
229
|
-
Inside an action method (`handleInstanceAction()` or `handleDeviceAction()`) you can perform arbitrary actions, like talking to a device or API, and you can interact with the user.
|
|
232
|
+
Inside an action method (`handleInstanceAction()` or `handleDeviceAction()`) you can perform arbitrary actions, like talking to a device or API, and you can interact with the user.
|
|
233
|
+
For interactions, there are methods you can call on `context`:
|
|
234
|
+
|
|
235
|
+
There are some reserved action names, you can find the list below:
|
|
236
|
+
- `status` - This action is called when the user clicks on the status icon. So to implement the "click-on-status" functionality, the developer has to implement this action.
|
|
230
237
|
|
|
231
238
|
### `showMessage(text: ioBroker.StringOrTranslated)`
|
|
232
239
|
|
|
@@ -295,6 +302,10 @@ This method returns a promise that resolves to a `ProgressDialog` object.
|
|
|
295
302
|
### **WORK IN PROGRESS**
|
|
296
303
|
-->
|
|
297
304
|
## Changelog
|
|
305
|
+
### 1.0.1 (2025-01-09)
|
|
306
|
+
|
|
307
|
+
* (@GermanBluefox) Added description for `disabled` control and `status` action.
|
|
308
|
+
|
|
298
309
|
### 1.0.0 (2025-01-08)
|
|
299
310
|
|
|
300
311
|
* (@GermanBluefox) Added `disabled` options for a device
|
package/build/types/base.d.ts
CHANGED
|
@@ -101,8 +101,7 @@ export interface DeviceInfo<T extends ActionType = 'api'> {
|
|
|
101
101
|
actions?: DeviceAction<T>[];
|
|
102
102
|
controls?: DeviceControl<T>[];
|
|
103
103
|
hasDetails?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
disabled?: boolean;
|
|
104
|
+
/** Device type for grouping */
|
|
106
105
|
group?: {
|
|
107
106
|
key: string;
|
|
108
107
|
name?: ioBroker.StringOrTranslated;
|