@iobroker/dm-utils 1.0.16 → 3.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.
- package/README.md +226 -105
- package/build/ActionContext.d.ts +2 -6
- package/build/DeviceManagement.d.ts +27 -28
- package/build/DeviceManagement.js +229 -106
- package/build/ProgressDialog.d.ts +2 -6
- package/build/types/adapter.d.ts +4 -3
- package/build/types/api.d.ts +58 -0
- package/build/types/base.d.ts +74 -30
- package/build/types/common.d.ts +117 -102
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +1 -1
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Utility classes for ioBroker adapters to support [ioBroker.device-manager](https
|
|
|
6
6
|
|
|
7
7
|
Add in your `io-package.json` the property `deviceManager: true` to `common.supportedMessages`.
|
|
8
8
|
Note: If you don't have a `common.supportedMessages` property yet, you have to add it.
|
|
9
|
-
Also, if you
|
|
9
|
+
Also, if you have a `common.messagebox` property for the adapter-specific messages, you can remove it and add `common.supportedMessages.custom: true`. (see
|
|
10
10
|
https://github.com/ioBroker/ioBroker.js-controller/blob/274f9e8f84dbdaaba9830a6cc00ddf083e989090/schemas/io-package.json#L754C104-L754C178)
|
|
11
11
|
|
|
12
12
|
In your ioBroker adapter, add a subclass of `DeviceManagement` and override the methods you need (see next chapters):
|
|
@@ -30,7 +30,7 @@ class MyAdapter extends utils.Adapter {
|
|
|
30
30
|
public constructor(options: Partial<utils.AdapterOptions> = {}) {
|
|
31
31
|
super({
|
|
32
32
|
...options,
|
|
33
|
-
name:
|
|
33
|
+
name: 'my-adapter',
|
|
34
34
|
});
|
|
35
35
|
this.deviceManagement = new DmTestDeviceManagement(this);
|
|
36
36
|
|
|
@@ -62,7 +62,7 @@ the `DeviceManagement` implementation's `handleXxxAction()` is called, and the a
|
|
|
62
62
|
|
|
63
63
|
### Controls
|
|
64
64
|
|
|
65
|
-
The device manager tab allows the user to control devices too. If devices are controllable, the device manager tab shows
|
|
65
|
+
The device manager tab allows the user to control devices too. If devices are controllable, the device manager tab shows the control elements in the device card.
|
|
66
66
|
|
|
67
67
|
When the user clicks on a control (i.e., a button in the UI),
|
|
68
68
|
the `DeviceManagement` implementation's `handleXxxAction()` is called, and the adapter can perform arbitrary actions
|
|
@@ -74,18 +74,28 @@ The communication between the `ioBroker.device-manager` tab and the adapter happ
|
|
|
74
74
|
|
|
75
75
|
**IMPORTANT:** make sure your adapter doesn't handle `sendTo` messages starting with `dm:`, otherwise the communication will not work.
|
|
76
76
|
|
|
77
|
+
- Use, for example, this on the top of your onMessage Methode:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
if (obj.command?.startsWith('dm:')) {
|
|
81
|
+
// Handled by Device Manager class itself, so ignored here
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
77
86
|
### Access adapter methods
|
|
78
87
|
|
|
79
88
|
You can access all adapter methods like `getState()` or `getStateAsync()` via `this.adapter`.
|
|
80
89
|
Example: `this.getState()` -> `this.adapter.getState()`
|
|
81
90
|
|
|
82
91
|
### Error Codes
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
92
|
+
|
|
93
|
+
| Code | Description |
|
|
94
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| 101 | Instance action ${actionId} was called before getInstanceInfo() was called. This could happen if the instance has restarted. |
|
|
96
|
+
| 102 | Instance action ${actionId} is unknown. |
|
|
97
|
+
| 103 | Instance action ${actionId} is disabled because it has no handler. |
|
|
98
|
+
| 201 | Device action ${actionId} was called before loadDevices() was called. This could happen if the instance has restarted. |
|
|
89
99
|
| 202 | Device action ${actionId} was called on unknown device: ${deviceId}. |
|
|
90
100
|
| 203 | Device action ${actionId} doesn't exist on device ${deviceId}. |
|
|
91
101
|
| 204 | Device action ${actionId} on ${deviceId} is disabled because it has no handler. |
|
|
@@ -93,6 +103,7 @@ Example: `this.getState()` -> `this.adapter.getState()`
|
|
|
93
103
|
## Examples
|
|
94
104
|
|
|
95
105
|
To get an idea of how to use `dm-utils`, please have a look at:
|
|
106
|
+
|
|
96
107
|
- [the folder "examples"](examples/dm-test.ts) or
|
|
97
108
|
- [ioBroker.dm-test](https://github.com/UncleSamSwiss/ioBroker.dm-test)
|
|
98
109
|
|
|
@@ -102,54 +113,65 @@ All methods can either return an object of the defined value or a `Promise` reso
|
|
|
102
113
|
|
|
103
114
|
This allows you to implement the method synchronously or asynchronously, depending on your implementation.
|
|
104
115
|
|
|
105
|
-
### `
|
|
116
|
+
### `loadDevices(context: DeviceLoadContext)`
|
|
106
117
|
|
|
107
118
|
This method must always be overridden (as it is abstract in the base class).
|
|
108
119
|
|
|
109
|
-
You must
|
|
120
|
+
You must fill the `context` with information about all devices of this adapter's instance.
|
|
121
|
+
|
|
122
|
+
You may call `context.setTotalDevices(count: number)` as soon as possible to let the GUI know how many devices in total will be loaded. This allows the GUI to show the loading progress.
|
|
110
123
|
|
|
111
124
|
This method is called when the user expands an instance in the list.
|
|
112
125
|
|
|
113
|
-
In most cases, you will get all states of your instance and fill the
|
|
126
|
+
In most cases, you will get all states of your instance and fill the `context` with the relevant information.
|
|
114
127
|
|
|
115
|
-
Every
|
|
128
|
+
Every item is an object of type `DeviceInfo` which has the following properties:
|
|
116
129
|
|
|
117
|
-
- `id` (
|
|
130
|
+
- `id` (JSON object): a unique identifier of the device (it must be unique for your adapter instance only)
|
|
131
|
+
- `identifier` (optional): a human-readable identifier of the device
|
|
118
132
|
- `name` (string or translations): the human-readable name of this device
|
|
119
|
-
- `status` (optional): the current status of the device, which
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- `
|
|
124
|
-
- `description` (string, optional): a text that will be shown as a tooltip on the status
|
|
133
|
+
- `status` (optional): the current status of the device, which has to be an object containing:
|
|
134
|
+
- `connection` (string): alowed values are: `"connected"` / `"disconnected"`
|
|
135
|
+
- `rssi` (number): rssi value of the connection
|
|
136
|
+
- `battery` (boolean / number): if boolean: false - the battery is empty. If number: the battery level of the device (shows also a battery symbol on the card)
|
|
137
|
+
- `warning` (boolean / string): if boolean: true indicates a warning. If a string: shows also the warning with mouseover
|
|
125
138
|
- `actions` (array, optional): an array of actions that can be performed on the device; each object contains:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
- `id` (string): unique identifier to recognize an action (never shown to the user)
|
|
140
|
+
- `icon` (string): an icon shown on the button (see below for details)
|
|
141
|
+
- `description` (string, optional): a text that will be shown as a tooltip on the button
|
|
142
|
+
- `handler` (function, optional): function that will be called when the user clicks on the button; if not given, the button will be disabled in the UI
|
|
130
143
|
- `hasDetails` (boolean, optional): if set to `true`, the row of the device can be expanded and details are shown below
|
|
131
144
|
|
|
145
|
+
Possible strings for device icons are here: [TYPE ICONS](https://github.com/ioBroker/adapter-react-v5/blob/main/src/Components/DeviceType/DeviceTypeIcon.tsx#L68)
|
|
146
|
+
<br/>
|
|
147
|
+
Possible strings for action icons are here: [ACTION NAMES](https://github.com/ioBroker/dm-gui-components/blob/main/src/Utils.tsx#L128)
|
|
148
|
+
<br/>
|
|
149
|
+
Possible strings for configuration icons are here: [CONFIGURATION TYPES](https://github.com/ioBroker/dm-utils/blob/b3e54ecfaedd6a239beec59c5deb8117d1d59d7f/src/types/common.ts#L110)
|
|
150
|
+
<br/>
|
|
151
|
+
|
|
132
152
|
### `getInstanceInfo()`
|
|
133
153
|
|
|
134
154
|
This method allows the device manager tab to gather some general information about the instance. It is called when the user opens the tab.
|
|
135
155
|
|
|
136
156
|
If you override this method, the returned object must contain:
|
|
137
157
|
|
|
138
|
-
- `apiVersion` (string): the supported API version; must
|
|
158
|
+
- `apiVersion` (string): the supported API version; must be `"v3"`
|
|
139
159
|
- `actions` (array, optional): an array of actions that can be performed on the instance; each object contains:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
160
|
+
- `id` (string): unique identifier to recognize an action (never shown to the user)
|
|
161
|
+
- `icon` (string): an icon shown on the button (see below for details)
|
|
162
|
+
- `title` (string): the title shown next to the icon on the button
|
|
163
|
+
- `description` (string, optional): a text that will be shown as a tooltip on the button
|
|
164
|
+
- `handler` (function, optional): function that will be called when the user clicks on the button; if not given, the button will be disabled in the UI
|
|
165
|
+
- `communicationStateId` (string, optional): the ID of the state that is used by backend for communication with front-end
|
|
166
|
+
- `identifierLabel` (string or translations, optional): the human-readable label next to the identifier
|
|
145
167
|
|
|
146
|
-
### `getDeviceDetails(id:
|
|
168
|
+
### `getDeviceDetails(id: DeviceId)`
|
|
147
169
|
|
|
148
170
|
This method is called if a device's `hasDetails` is set to `true` and the user clicks on the expander.
|
|
149
171
|
|
|
150
172
|
The returned object must contain:
|
|
151
173
|
|
|
152
|
-
- `id` (
|
|
174
|
+
- `id` (JSON object): the `id` given as parameter to the method call
|
|
153
175
|
- `schema` (Custom JSON form schema): the schema of the Custom JSON form to show below the device information
|
|
154
176
|
- `data` (object, optional): the data used to populate the Custom JSON form
|
|
155
177
|
|
|
@@ -157,31 +179,37 @@ For more details about the schema, see [here](https://github.com/ioBroker/ioBrok
|
|
|
157
179
|
|
|
158
180
|
Please keep in mind that there is no "Save" button, so in most cases, the form shouldn't contain editable fields, but you may use `sendTo<xxx>` objects to send data to the adapter.
|
|
159
181
|
|
|
160
|
-
|
|
182
|
+
## `DeviceManagement` handlers
|
|
161
183
|
|
|
162
|
-
|
|
184
|
+
### InstanceInfo action handlers
|
|
185
|
+
|
|
186
|
+
These functions are called when the user clicks on an action (i.e., button) for an adapter instance.
|
|
187
|
+
|
|
188
|
+
The parameters of this function are:
|
|
163
189
|
|
|
164
|
-
The parameters of this method are:
|
|
165
|
-
- `actionId` (string): the `id` that was given in `getInstanceInfo()` --> `actions[].id`
|
|
166
190
|
- `context` (object): object containing helper methods that can be used when executing the action
|
|
191
|
+
- `options` (object): object containing the action `value` (if given)
|
|
167
192
|
|
|
168
193
|
The returned object must contain:
|
|
194
|
+
|
|
169
195
|
- `refresh` (boolean): set this to `true` if you want the list to be reloaded after this action
|
|
170
196
|
|
|
171
197
|
This method can be implemented asynchronously and can take a lot of time to complete.
|
|
172
198
|
|
|
173
199
|
See below for how to interact with the user.
|
|
174
200
|
|
|
175
|
-
###
|
|
201
|
+
### DeviceInfo action handlers
|
|
176
202
|
|
|
177
|
-
|
|
203
|
+
These functions are called when the user clicks on an action (i.e., button) for an adapter instance.
|
|
178
204
|
|
|
179
|
-
The parameters of this
|
|
180
|
-
|
|
181
|
-
- `
|
|
205
|
+
The parameters of this function are:
|
|
206
|
+
|
|
207
|
+
- `deviceId` (JSON object): the `id` of the device
|
|
182
208
|
- `context` (object): object containing helper methods that can be used when executing the action
|
|
209
|
+
- `options` (object): object containing the action `value` (if given)
|
|
183
210
|
|
|
184
211
|
The returned object must contain:
|
|
212
|
+
|
|
185
213
|
- `refresh` (string / boolean): the following values are allowed:
|
|
186
214
|
- `"device"`: if you want the device details to be reloaded after this action
|
|
187
215
|
- `"instance"`: if you want the entire device list to be reloaded after this action
|
|
@@ -191,32 +219,32 @@ This method can be implemented asynchronously and can take a lot of time to comp
|
|
|
191
219
|
|
|
192
220
|
See below for how to interact with the user.
|
|
193
221
|
|
|
194
|
-
###
|
|
222
|
+
### DeviceInfo control handlers
|
|
195
223
|
|
|
196
|
-
|
|
224
|
+
These functions are called when the user clicks on a control (i.e., slider) in the device card.
|
|
197
225
|
|
|
198
226
|
The parameters of this method are:
|
|
199
|
-
|
|
200
|
-
- `
|
|
201
|
-
- `
|
|
227
|
+
|
|
228
|
+
- `deviceId` (JSON object): the `id` that was given in `loadDevices()` --> `[].id`
|
|
229
|
+
- `controlId` (string): the `id` that was given in `loadDevices()` --> `[].controls[].id`. There are some reserved control names, you can find the list below.
|
|
230
|
+
- `newState` (string | number | boolean): new state for the control, that will be sent to a real device
|
|
202
231
|
- `context` (object): object containing helper methods that can be used when executing the action
|
|
203
232
|
|
|
204
|
-
The returned object must
|
|
205
|
-
- `state`: ioBroker state object
|
|
233
|
+
The returned object must be an ioBroker state object.
|
|
206
234
|
|
|
207
235
|
This method can be implemented asynchronously and can take a lot of time to complete.
|
|
208
236
|
|
|
209
|
-
###
|
|
237
|
+
### DeviceInfo getState handlers
|
|
210
238
|
|
|
211
|
-
|
|
239
|
+
These functions are called when GUI requests the update of the state.
|
|
212
240
|
|
|
213
241
|
The parameters of this method are:
|
|
214
|
-
|
|
215
|
-
- `
|
|
242
|
+
|
|
243
|
+
- `deviceId` (JSON object): the `id` that was given in `loadDevices()` --> `[].id`
|
|
244
|
+
- `controlId` (string): the `id` that was given in `loadDevices()` --> `[].controls[].id`
|
|
216
245
|
- `context` (object): object containing helper methods that can be used when executing the action
|
|
217
246
|
|
|
218
|
-
The returned object must
|
|
219
|
-
- `state`: ioBroker state object
|
|
247
|
+
The returned object must be an ioBroker state object.
|
|
220
248
|
|
|
221
249
|
This method can be implemented asynchronously and can take a lot of time to complete.
|
|
222
250
|
|
|
@@ -230,6 +258,7 @@ Inside an action method (`handleInstanceAction()` or `handleDeviceAction()`) you
|
|
|
230
258
|
For interactions, there are methods you can call on `context`:
|
|
231
259
|
|
|
232
260
|
There are some reserved action names, you can find the list below:
|
|
261
|
+
|
|
233
262
|
- `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.
|
|
234
263
|
- `disable` - This action will be called when the user clicks on the `enabled` icon. `disable` and `enable` actions cannot be together.
|
|
235
264
|
- `enable` - This action will be called when the user clicks on the `disabled` icon. `disable` and `enable` actions cannot be together.
|
|
@@ -239,6 +268,7 @@ There are some reserved action names, you can find the list below:
|
|
|
239
268
|
Shows a message to the user.
|
|
240
269
|
|
|
241
270
|
The method has the following parameter:
|
|
271
|
+
|
|
242
272
|
- `text` (string or translation): the text to show to the user
|
|
243
273
|
|
|
244
274
|
This asynchronous method returns (or rather: the Promise is resolved) once the user has clicked on "OK".
|
|
@@ -248,23 +278,28 @@ This asynchronous method returns (or rather: the Promise is resolved) once the u
|
|
|
248
278
|
Lets the user confirm an action by showing a message with an "OK" and "Cancel" button.
|
|
249
279
|
|
|
250
280
|
The method has the following parameter:
|
|
281
|
+
|
|
251
282
|
- `text` (string or translation): the text to show to the user
|
|
252
283
|
|
|
253
284
|
This asynchronous method returns (or rather: the Promise is resolved) once the user has clicked a button in the dialog:
|
|
285
|
+
|
|
254
286
|
- `true` if the user clicked "OK"
|
|
255
287
|
- `false` if the user clicked "Cancel"
|
|
256
288
|
|
|
257
|
-
### `showForm(schema: JsonFormSchema, options?: { data?: JsonFormData; title?: string })`
|
|
289
|
+
### `showForm(schema: JsonFormSchema, options?: { data?: JsonFormData; title?: string; ignoreApplyDisabled?: boolean })`
|
|
258
290
|
|
|
259
291
|
Shows a dialog with a Custom JSON form that can be edited by the user.
|
|
260
292
|
|
|
261
293
|
The method has the following parameters:
|
|
294
|
+
|
|
262
295
|
- `schema` (Custom JSON form schema): the schema of the Custom JSON form to show in the dialog
|
|
263
296
|
- `options` (object, optional): options to configure the dialog further
|
|
264
|
-
|
|
265
|
-
|
|
297
|
+
- `data` (object, optional): the data used to populate the Custom JSON form
|
|
298
|
+
- `title` (string, optional): the dialog title
|
|
299
|
+
- `ignoreApplyDisabled` (boolean, optional): set to `true` to always enable the "OK" button even if the form is unchanged
|
|
266
300
|
|
|
267
301
|
This asynchronous method returns (or rather: the Promise is resolved) once the user has clicked a button in the dialog:
|
|
302
|
+
|
|
268
303
|
- the form data, if the user clicked "OK"
|
|
269
304
|
- `undefined`, if the user clicked "Cancel"
|
|
270
305
|
|
|
@@ -273,11 +308,12 @@ This asynchronous method returns (or rather: the Promise is resolved) once the u
|
|
|
273
308
|
Shows a dialog with a linear progress bar to the user. There is no way for the user to dismiss this dialog.
|
|
274
309
|
|
|
275
310
|
The method has the following parameters:
|
|
311
|
+
|
|
276
312
|
- `title` (string): the dialog title
|
|
277
313
|
- `options` (object, optional): options to configure the dialog further
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
314
|
+
- `indeterminate` (boolean, optional): set to `true` to visualize an unspecified wait time
|
|
315
|
+
- `value` (number, optional): the progress value to show to the user (if set, it must be a value between 0 and 100)
|
|
316
|
+
- `label` (string, optional): the label to show to the right of the progress bar; you may show the progress value in a human-readable way (e.g. "42%") or show the current step in multi-step progress (e.g. "Logging in...")
|
|
281
317
|
|
|
282
318
|
This method returns a promise that resolves to a `ProgressDialog` object.
|
|
283
319
|
|
|
@@ -286,123 +322,208 @@ This method returns a promise that resolves to a `ProgressDialog` object.
|
|
|
286
322
|
`ProgressDialog` has two methods:
|
|
287
323
|
|
|
288
324
|
- `update(update: { title?: string; indeterminate?: boolean; value?:number; label?: string; })`
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
325
|
+
- Updates the progress dialog with new values
|
|
326
|
+
- The method has the following parameter:
|
|
327
|
+
- `update` (object): what to update in the dialog
|
|
328
|
+
- `title` (string, optional): change the dialog title
|
|
329
|
+
- `indeterminate` (boolean, optional): change whether the progress is indeterminate
|
|
330
|
+
- `value` (number, optional): change the progress value (if set, it must be a value between 0 and 100)
|
|
331
|
+
- `label` (string, optional): change the label to the right of the progress bar
|
|
296
332
|
- `close()`
|
|
297
|
-
|
|
298
|
-
|
|
333
|
+
- Closes the progress dialog (and allows you to open other dialogs)
|
|
334
|
+
|
|
335
|
+
### `sendCommandToGui(command: BackendToGuiCommand)`
|
|
336
|
+
|
|
337
|
+
Sends command to GUI to add/update/delete devices or to update the status of a device.
|
|
338
|
+
|
|
339
|
+
**It is suggested** to use the state's ID directly in the DeviceInfo structure instead of sending the command every time to GUI on status update.
|
|
340
|
+
|
|
341
|
+
See the example below:
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
class MyAdapterDeviceManagement extends DeviceManagement<MyAdapter> {
|
|
345
|
+
protected loadDevices(context: DeviceLoadContext<string>): void {
|
|
346
|
+
const deviceInfo: DeviceInfo = {
|
|
347
|
+
id: 'uniqieID',
|
|
348
|
+
name: 'My device',
|
|
349
|
+
icon: 'node', // find possible icons here: https://github.com/ioBroker/adapter-react-v5/blob/main/src/Components/DeviceType/DeviceTypeIcon.tsx#L68
|
|
350
|
+
manufacturer: { objectId: 'uniqieID', property: 'native.manufacturer' },
|
|
351
|
+
model: { objectId: 'uniqieID', property: 'native.model' },
|
|
352
|
+
status: {
|
|
353
|
+
battery: { stateId: 'uniqieID.DevicePower0.BatteryPercent' },
|
|
354
|
+
connection: { stateId: 'uniqieID.online', mapping: { true: 'connected', false: 'disconnected' } },
|
|
355
|
+
rssi: { stateId: 'uniqieID.rssi' },
|
|
356
|
+
},
|
|
357
|
+
hasDetails: true,
|
|
358
|
+
};
|
|
359
|
+
context.addDevice(deviceInfo);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Migration from 1.x to 2.x
|
|
365
|
+
|
|
366
|
+
Between versions 1.x and 2.x, there are some breaking changes. Please also have a look at the changelog below for more information.
|
|
367
|
+
|
|
368
|
+
### Incremental loading of devices
|
|
369
|
+
|
|
370
|
+
In version 1.x, the `listDevices()` method had to return the full list of devices.
|
|
371
|
+
In version 2.x, this method was replaced by `loadDevices(context: DeviceLoadContext)` that allows incremental loading of devices.
|
|
372
|
+
|
|
373
|
+
Instead of creating and returning an array of `DeviceInfo` objects, you have to call `context.addDevice(deviceInfo)` for each device you want to add to the list.
|
|
374
|
+
|
|
375
|
+
You may also call `context.setTotalDevices(count: number)` as soon as possible to let the GUI know how many devices in total will be loaded.
|
|
376
|
+
|
|
377
|
+
### Refresh response of device actions
|
|
378
|
+
|
|
379
|
+
In version 2.x, the refresh response of device actions has changed.
|
|
380
|
+
|
|
381
|
+
| Version 1.x | Version 2.x | Description |
|
|
382
|
+
| ------------ | ------------ | --------------------------------------------------------------------------- |
|
|
383
|
+
| `true` | `'all'` | the instance information as well as the entire device list will be reloaded |
|
|
384
|
+
| `false` | `'none'` | nothing will be reloaded |
|
|
385
|
+
| `'device'` | `'devices'` | the entire device list will be reloaded |
|
|
386
|
+
| `'instance'` | `'instance'` | (unchanged) only the instance information will be reloaded |
|
|
387
|
+
|
|
388
|
+
## Changelog
|
|
389
|
+
|
|
299
390
|
<!--
|
|
300
391
|
Placeholder for the next version (at the beginning of the line):
|
|
301
392
|
### **WORK IN PROGRESS**
|
|
302
393
|
-->
|
|
303
|
-
|
|
394
|
+
### 3.0.0 (2026-03-01)
|
|
395
|
+
|
|
396
|
+
- (@UncleSamSwiss) Enabled incremental loading of devices
|
|
397
|
+
- (@UncleSamSwiss) Removed direct access to `DeviceManagement.handleXxx()` methods (use `handler` and similar properties instead)
|
|
398
|
+
- (@UncleSamSwiss) Added `identifier` property to `DeviceInfo` for human-readable identifiers
|
|
399
|
+
- (@UncleSamSwiss) Device refresh responses can no longer be a `boolean` and `'device'` was renamed to `'devices'`.
|
|
400
|
+
- (@UncleSamSwiss) Added `info` icon and possibility for actions to be a link (by providing a `url` property instead of a `handler` function)
|
|
401
|
+
|
|
402
|
+
### 2.0.2 (2026-01-28)
|
|
403
|
+
|
|
404
|
+
- (@GermanBluefox) BREAKING: Admin/GUI must have version 9 (or higher) of `dm-gui-components`
|
|
405
|
+
- (@GermanBluefox) Added types to update the status of a device directly from the state
|
|
406
|
+
- (@GermanBluefox) Added backend to GUI communication possibility
|
|
407
|
+
- (@GermanBluefox) Added `dm:deviceInfo` command
|
|
408
|
+
- (@GermanBluefox) Added `dm:deviceStatus` command
|
|
409
|
+
|
|
304
410
|
### 1.0.16 (2026-01-02)
|
|
305
|
-
|
|
306
|
-
|
|
411
|
+
|
|
412
|
+
- (@GermanBluefox) Added `ignoreApplyDisabled` flag
|
|
413
|
+
- (@GermanBluefox) Added `update` icon
|
|
307
414
|
|
|
308
415
|
### 1.0.13 (2025-10-21)
|
|
309
|
-
|
|
416
|
+
|
|
417
|
+
- (@GermanBluefox) Updated packages
|
|
310
418
|
|
|
311
419
|
### 1.0.10 (2025-05-05)
|
|
312
420
|
|
|
313
|
-
|
|
314
|
-
|
|
421
|
+
- (@GermanBluefox) Added timeout property to actions
|
|
422
|
+
- (@GermanBluefox) Updated packages
|
|
315
423
|
|
|
316
424
|
### 1.0.9 (2025-01-25)
|
|
317
425
|
|
|
318
|
-
|
|
426
|
+
- (@GermanBluefox) Added copyToClipboard dialog button
|
|
319
427
|
|
|
320
428
|
### 1.0.8 (2025-01-24)
|
|
321
429
|
|
|
322
|
-
|
|
430
|
+
- (@GermanBluefox) Removed `headerTextColor` to device info
|
|
323
431
|
|
|
324
432
|
### 1.0.6 (2025-01-14)
|
|
325
|
-
|
|
326
|
-
|
|
433
|
+
|
|
434
|
+
- (@GermanBluefox) Added the connection type indication
|
|
327
435
|
|
|
328
436
|
### 1.0.5 (2025-01-11)
|
|
329
437
|
|
|
330
|
-
|
|
438
|
+
- (@GermanBluefox) Added action ENABLE_DISABLE and `enabled` status
|
|
331
439
|
|
|
332
440
|
### 1.0.0 (2025-01-08)
|
|
333
441
|
|
|
334
|
-
|
|
335
|
-
|
|
442
|
+
- (@GermanBluefox) Added `disabled` options for a device
|
|
443
|
+
- (@GermanBluefox) Major release just because it is good enough. No breaking changes.
|
|
336
444
|
|
|
337
445
|
### 0.6.11 (2024-12-11)
|
|
338
446
|
|
|
339
|
-
|
|
447
|
+
- (@GermanBluefox) Do not close handler for progress
|
|
340
448
|
|
|
341
449
|
### 0.6.10 (2024-12-10)
|
|
342
450
|
|
|
343
|
-
|
|
451
|
+
- (@GermanBluefox) Export `BackEndCommandJsonFormOptions` type
|
|
344
452
|
|
|
345
453
|
### 0.6.9 (2024-11-22)
|
|
346
454
|
|
|
347
|
-
|
|
455
|
+
- (@GermanBluefox) Added a max-width option for form
|
|
348
456
|
|
|
349
457
|
### 0.6.8 (2024-11-22)
|
|
350
458
|
|
|
351
|
-
|
|
459
|
+
- (@GermanBluefox) Allowed grouping of devices
|
|
352
460
|
|
|
353
461
|
### 0.6.7 (2024-11-20)
|
|
354
462
|
|
|
355
|
-
|
|
463
|
+
- (@GermanBluefox) Updated types
|
|
356
464
|
|
|
357
465
|
### 0.6.6 (2024-11-18)
|
|
358
466
|
|
|
359
|
-
|
|
467
|
+
- (@GermanBluefox) Added configurable buttons for form
|
|
360
468
|
|
|
361
469
|
### 0.6.0 (2024-11-17)
|
|
362
470
|
|
|
363
|
-
|
|
364
|
-
|
|
471
|
+
- (@GermanBluefox) used new ioBroker/eslint-config lib and changed prettifier settings
|
|
472
|
+
- (@GermanBluefox) updated JsonConfig types
|
|
365
473
|
|
|
366
474
|
### 0.5.0 (2024-08-30)
|
|
367
|
-
|
|
475
|
+
|
|
476
|
+
- (bluefox) Migrated to eslint 9
|
|
368
477
|
|
|
369
478
|
### 0.4.0 (2024-08-30)
|
|
370
|
-
|
|
479
|
+
|
|
480
|
+
- (bluefox) Added `state` type for JSON config
|
|
371
481
|
|
|
372
482
|
### 0.3.1 (2024-07-18)
|
|
373
|
-
|
|
483
|
+
|
|
484
|
+
- (bluefox) Added qrCode type for JSON config
|
|
374
485
|
|
|
375
486
|
### 0.3.0 (2024-07-17)
|
|
376
|
-
|
|
377
|
-
|
|
487
|
+
|
|
488
|
+
- (bluefox) packages updated
|
|
489
|
+
- (bluefox) Updated JSON config types
|
|
378
490
|
|
|
379
491
|
### 0.2.2 (2024-06-26)
|
|
380
|
-
|
|
492
|
+
|
|
493
|
+
- (bluefox) packages updated
|
|
381
494
|
|
|
382
495
|
### 0.2.0 (2024-05-29)
|
|
383
|
-
|
|
384
|
-
|
|
496
|
+
|
|
497
|
+
- (bluefox) enhanced type exports
|
|
498
|
+
- (bluefox) added confirmation and input text options
|
|
385
499
|
|
|
386
500
|
### 0.1.9 (2023-12-25)
|
|
387
|
-
|
|
501
|
+
|
|
502
|
+
- (foxriver76) enhanced type exports
|
|
388
503
|
|
|
389
504
|
### 0.1.8 (2023-12-17)
|
|
390
|
-
|
|
505
|
+
|
|
506
|
+
- (bluefox) corrected control error
|
|
391
507
|
|
|
392
508
|
### 0.1.7 (2023-12-17)
|
|
393
|
-
|
|
509
|
+
|
|
510
|
+
- (bluefox) added channel info
|
|
394
511
|
|
|
395
512
|
### 0.1.5 (2023-12-16)
|
|
396
|
-
|
|
513
|
+
|
|
514
|
+
- (bluefox) extended controls with unit and new control types
|
|
397
515
|
|
|
398
516
|
### 0.1.4 (2023-12-13)
|
|
399
|
-
|
|
517
|
+
|
|
518
|
+
- (bluefox) added error codes
|
|
400
519
|
|
|
401
520
|
### 0.1.3 (2023-12-10)
|
|
402
|
-
|
|
403
|
-
|
|
521
|
+
|
|
522
|
+
- (bluefox) added some fields to DeviceInfo interface
|
|
523
|
+
- (bluefox) added control possibilities
|
|
404
524
|
|
|
405
525
|
## License
|
|
526
|
+
|
|
406
527
|
MIT License
|
|
407
528
|
|
|
408
529
|
Copyright (c) 2023-2026 ioBroker Community Developers
|
package/build/ActionContext.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { BackEndCommandJsonFormOptions, JsonFormData, JsonFormSchema } from '.';
|
|
1
|
+
import type { BackEndCommandJsonFormOptions, JsonFormData, JsonFormSchema, ProgressOptions } from '.';
|
|
2
2
|
import type { ProgressDialog } from './ProgressDialog';
|
|
3
3
|
export interface ActionContext {
|
|
4
4
|
showMessage(text: ioBroker.StringOrTranslated): Promise<void>;
|
|
5
5
|
showConfirmation(text: ioBroker.StringOrTranslated): Promise<boolean>;
|
|
6
6
|
showForm(schema: JsonFormSchema, options?: BackEndCommandJsonFormOptions): Promise<JsonFormData | undefined>;
|
|
7
|
-
openProgress(title: string, options?:
|
|
8
|
-
indeterminate?: boolean;
|
|
9
|
-
value?: number;
|
|
10
|
-
label?: ioBroker.StringOrTranslated;
|
|
11
|
-
}): Promise<ProgressDialog>;
|
|
7
|
+
openProgress(title: string, options?: ProgressOptions): Promise<ProgressDialog>;
|
|
12
8
|
}
|