@iobroker/socket-classes 1.6.2 → 2.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 CHANGED
@@ -66,7 +66,7 @@ io.close();
66
66
  ## GUI subscribes
67
67
  GUI client can send to desired instance the `subscribe` message
68
68
  ```js
69
- socket.emit('clientSubscribe', 'cameras.0', 'startCamera', {width: 640, height: 480}, result => console.log('Started: ' + result));
69
+ socket.emit('clientSubscribe', 'cameras.0', 'startCamera', { width: 640, height: 480 }, result => console.log('Started: ' + result));
70
70
  ```
71
71
 
72
72
  The instance 'cameras.0' will receive message `clientSubscribe` with information who want to receive messages.
@@ -83,8 +83,7 @@ adapter.on('message', obj => {
83
83
  this.subscribes = this.subscribes || [];
84
84
  this.subscribes.push({sid: obj.message.sid, from: obj.from, type: obj.message.type, camera});
85
85
  }
86
- } else
87
- if (obj?.command === 'clientUnsubscribe' || obj?.command === 'clientSubscribeError') {
86
+ } else if (obj?.command === 'clientUnsubscribe' || obj?.command === 'clientSubscribeError') {
88
87
  if (obj?.message.type && obj.message.type.startsWith('startCamera/')) {
89
88
  const [, camera] = obj.message.type.split('/');
90
89
  if (this.subscribes) {
@@ -119,857 +118,871 @@ function sendImage(camera, data) {
119
118
  ## Web Methods
120
119
  <!-- WEB_METHODS_START -->
121
120
  ### List of commands
122
- * [authenticate](#authenticate_w)
123
- * [error](#error_w)
124
- * [log](#log_w)
125
- * [checkFeatureSupported](#checkfeaturesupported_w)
126
- * [getHistory](#gethistory_w)
127
- * [httpGet](#httpget_w)
128
- * [sendTo](#sendto_w)
129
- * [sendToHost](#sendtohost_w)
130
- * [authEnabled](#authenabled_w)
131
- * [logout](#logout_w)
132
- * [listPermissions](#listpermissions_w)
133
- * [getUserPermissions](#getuserpermissions_w)
134
- * [getVersion](#getversion_w)
135
- * [getAdapterName](#getadaptername_w)
136
- * [getObject](#getobject_w)
137
- * [getObjects](#getobjects_w)
138
- * [subscribeObjects](#subscribeobjects_w)
139
- * [unsubscribeObjects](#unsubscribeobjects_w)
140
- * [getObjectView](#getobjectview_w)
141
- * [setObject](#setobject_w)
142
- * [delObject](#delobject_w)
143
- * [clientSubscribe](#clientsubscribe_w)
144
- * [clientUnsubscribe](#clientunsubscribe_w)
145
- * [getStates](#getstates_w)
146
- * [getForeignStates](#getforeignstates_w)
147
- * [getState](#getstate_w)
148
- * [setState](#setstate_w)
149
- * [getBinaryState](#getbinarystate_w)
150
- * [setBinaryState](#setbinarystate_w)
151
- * [subscribe](#subscribe_w)
152
- * [subscribeStates](#subscribestates_w)
153
- * [unsubscribe](#unsubscribe_w)
154
- * [unsubscribeStates](#unsubscribestates_w)
155
- * [readFile](#readfile_w)
156
- * [readFile64](#readfile64_w)
157
- * [writeFile64](#writefile64_w)
158
- * [writeFile](#writefile_w)
159
- * [unlink](#unlink_w)
160
- * [deleteFile](#deletefile_w)
161
- * [deleteFolder](#deletefolder_w)
162
- * [renameFile](#renamefile_w)
163
- * [rename](#rename_w)
164
- * [mkdir](#mkdir_w)
165
- * [readDir](#readdir_w)
166
- * [chmodFile](#chmodfile_w)
167
- * [chownFile](#chownfile_w)
168
- * [fileExists](#fileexists_w)
169
- * [subscribeFiles](#subscribefiles_w)
170
- * [unsubscribeFiles](#unsubscribefiles_w)
171
- * [getAdapterInstances](#getadapterinstances_w)
172
- ### <a name="authenticate_w"></a>authenticate(user, pass, callback)
173
- Authenticate user by login and password
174
- * user *(string)*: user name
175
- * pass *(string)*: password
176
- * callback *(function)*: `function (isUserAuthenticated, isAuthenticationUsed)`
177
-
178
- ### <a name="error_w"></a>error(error)
121
+ * [`authenticate`](#authenticate_w)
122
+ * [`error`](#error_w)
123
+ * [`log`](#log_w)
124
+ * [`checkFeatureSupported`](#checkfeaturesupported_w)
125
+ * [`getHistory`](#gethistory_w)
126
+ * [`httpGet`](#httpget_w)
127
+ * [`sendTo`](#sendto_w)
128
+ * [`sendToHost`](#sendtohost_w)
129
+ * [`authEnabled`](#authenabled_w)
130
+ * [`logout`](#logout_w)
131
+ * [`listPermissions`](#listpermissions_w)
132
+ * [`getUserPermissions`](#getuserpermissions_w)
133
+ * [`getVersion`](#getversion_w)
134
+ * [`getAdapterName`](#getadaptername_w)
135
+ * [`clientSubscribe`](#clientsubscribe_w)
136
+ * [`clientUnsubscribe`](#clientunsubscribe_w)
137
+ * [`getAdapterInstances`](#getadapterinstances_w)
138
+ * [`getObject`](#getobject_w)
139
+ * [`getObjects`](#getobjects_w)
140
+ * [`subscribeObjects`](#subscribeobjects_w)
141
+ * [`unsubscribeObjects`](#unsubscribeobjects_w)
142
+ * [`setObject`](#setobject_w)
143
+ * [`delObject`](#delobject_w)
144
+ * [`getStates`](#getstates_w)
145
+ * [`getForeignStates`](#getforeignstates_w)
146
+ * [`getState`](#getstate_w)
147
+ * [`setState`](#setstate_w)
148
+ * [`getBinaryState`](#getbinarystate_w)
149
+ * [`setBinaryState`](#setbinarystate_w)
150
+ * [`subscribe`](#subscribe_w)
151
+ * [`subscribeStates`](#subscribestates_w)
152
+ * [`unsubscribe`](#unsubscribe_w)
153
+ * [`unsubscribeStates`](#unsubscribestates_w)
154
+ * [`readFile`](#readfile_w)
155
+ * [`readFile64`](#readfile64_w)
156
+ * [`writeFile64`](#writefile64_w)
157
+ * [`writeFile`](#writefile_w)
158
+ * [`unlink`](#unlink_w)
159
+ * [`deleteFile`](#deletefile_w)
160
+ * [`deleteFolder`](#deletefolder_w)
161
+ * [`renameFile`](#renamefile_w)
162
+ * [`rename`](#rename_w)
163
+ * [`mkdir`](#mkdir_w)
164
+ * [`readDir`](#readdir_w)
165
+ * [`chmodFile`](#chmodfile_w)
166
+ * [`chownFile`](#chownfile_w)
167
+ * [`fileExists`](#fileexists_w)
168
+ * [`subscribeFiles`](#subscribefiles_w)
169
+ * [`unsubscribeFiles`](#unsubscribefiles_w)
170
+ ### Commands
171
+ #### <a name="authenticate_w"></a>`authenticate(callback)`
172
+ Wait till the user is authenticated.
173
+ As the user authenticates himself, the callback will be called
174
+ * `callback` *(isUserAuthenticated: boolean, isAuthenticationUsed: boolean) => void) => void*: Callback `(isUserAuthenticated: boolean, isAuthenticationUsed: boolean) => void`
175
+
176
+ #### <a name="error_w"></a>`error(error)`
179
177
  Write error into ioBroker log
180
- * error *(string)*: error text
178
+ * `error` *Error | string*: Error object or error text
181
179
 
182
- ### <a name="log_w"></a>log(text, level)
180
+ #### <a name="log_w"></a>`log(text, level)`
183
181
  Write log entry into ioBroker log
184
- * text *(string)*: log text
185
- * level *(string)*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
182
+ * `text` *string*: log text
183
+ * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
186
184
 
187
- ### <a name="checkfeaturesupported_w"></a>checkFeatureSupported(feature, callback)
188
- Checks, if the same feature is supported by the current js-controller
189
- * feature *(string)*: feature name like `CONTROLLER_LICENSE_MANAGER`
190
- * callback *(function)*: `function (error, isSupported)`
185
+ #### <a name="checkfeaturesupported_w"></a>`checkFeatureSupported(feature, callback)`
186
+ Check if the same feature is supported by the current js-controller
187
+ * `feature` *SupportedFeature*: feature name like `CONTROLLER_LICENSE_MANAGER`
188
+ * `callback` *(error: string | Error | null | undefined, isSupported?: boolean) => void) => void*: callback `(error: string | Error | null | undefined, isSupported: boolean) => void`
191
189
 
192
- ### <a name="gethistory_w"></a>getHistory(id, options, callback)
190
+ #### <a name="gethistory_w"></a>`getHistory(id, options, callback)`
193
191
  Get history data from specific instance
194
- * id *(string)*: object ID
195
- * options *(object)*: See object description here: https://github.com/ioBroker/ioBroker.history/blob/master/docs/en/README.md#access-values-from-javascript-adapter
196
- * callback *(function)*: `function (error, result)`
192
+ * `id` *string*: object ID
193
+ * `options` *ioBroker.GetHistoryOptions*: History options
194
+ * `callback` *(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void) => void*: callback `(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void`
197
195
 
198
- ### <a name="httpget_w"></a>httpGet(url, callback)
199
- Read content of HTTP(S) page server-side (without CORS and stuff)
200
- * url *(string)*: Page URL
201
- * callback *(function)*: `function (error, {status, statusText}, body)`
196
+ #### <a name="httpget_w"></a>`httpGet(url, callback)`
197
+ Read content of HTTP(s) page server-side (without CORS and stuff)
198
+ * `url` *string*: Page URL
199
+ * `callback` *(error: Error | null | undefined | string, result?: {status: number; statusText: string}, data?: string) => void*: callback `(error: Error | null, result?: { status: number; statusText: string }, data?: string) => void`
202
200
 
203
- ### <a name="sendto_w"></a>sendTo(adapterInstance, command, message, callback)
201
+ #### <a name="sendto_w"></a>`sendTo(adapterInstance, command, message, callback)`
204
202
  Send the message to specific instance
205
- * adapterInstance *(string)*: instance name, e.g. `history.0`
206
- * command *(string)*: command name
207
- * message *(object)*: the message is instance dependent
208
- * callback *(function)*: `function (result)`
203
+ * `adapterInstance` *string*: instance name, e.g. `history.0`
204
+ * `command` *string*: command name
205
+ * `message` *any*: the message is instance-dependent
206
+ * `callback` *(result: any) => void) => void*: callback `(result: any) => void`
209
207
 
210
- ### <a name="sendtohost_w"></a>sendToHost(host, command, message, callback)
208
+ #### <a name="sendtohost_w"></a>`sendToHost(host, command, message, callback)`
211
209
  Send a message to the specific host.
212
210
  Host can answer to the following commands: `cmdExec, getRepository, getInstalled, getInstalledAdapter, getVersion, getDiagData, getLocationOnDisk, getDevList, getLogs, getHostInfo, delLogs, readDirAsZip, writeDirAsZip, readObjectsAsZip, writeObjectsAsZip, checkLogging, updateMultihost`.
213
- * host *(string)*: instance name, e.g. `history.0`
214
- * command *(string)*: command name
215
- * message *(object)*: the message is command-specific
216
- * callback *(function)*: `function (result)`
211
+ * `host` *string*: Host name. With or without 'system.host.' prefix
212
+ * `command` * 'shell' | 'cmdExec' | 'getRepository' | 'getInstalled' | 'getInstalledAdapter' | 'getVersion' | 'getDiagData' | 'getLocationOnDisk' | 'getDevList' | 'getLogs' | 'getLogFile' | 'getLogFiles' | 'getHostInfo' | 'getHostInfoShort' | 'delLogs' | 'readDirAsZip' | 'writeDirAsZip' | 'readObjectsAsZip' | 'writeObjectsAsZip' | 'checkLogging' | 'updateMultihost' | 'upgradeController' | 'upgradeAdapterWithWebserver' | 'getInterfaces' | 'upload' | 'rebuildAdapter' | 'readBaseSettings' | 'writeBaseSettings' | 'addNotification' | 'clearNotifications' | 'getNotifications' | 'updateLicenses' | 'upgradeOsPackages' | 'restartController' | 'sendToSentry'*: Host command
213
+ * `message` *any*: the message is command-specific
214
+ * `callback` *(result: {error?: string; result?: any}) => void) => void*: callback `(result: { error?: string; result?: any }) => void`
217
215
 
218
- ### <a name="authenabled_w"></a>authEnabled(callback)
216
+ #### <a name="authenabled_w"></a>`authEnabled(callback)`
219
217
  Ask server is authentication enabled, and if the user authenticated
220
- * callback *(function)*: `function (isAuthenticationUsed, userName)`
218
+ * `callback` *(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void) => void*: callback `(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void`
221
219
 
222
- ### <a name="logout_w"></a>logout(callback)
220
+ #### <a name="logout_w"></a>`logout(callback)`
223
221
  Logout user
224
- * callback *(function)*: function (error)
222
+ * `callback` *ioBroker.ErrorCallback*: callback `(error?: Error) => void`
225
223
 
226
- ### <a name="listpermissions_w"></a>listPermissions(callback)
224
+ #### <a name="listpermissions_w"></a>`listPermissions(callback)`
227
225
  List commands and permissions
228
- * callback *(function)*: `function (permissions)`
226
+ * `callback` *(permissions: Record< string, {type: 'object' | 'state' | 'users' | 'other' | 'file' | ''; operation: SocketOperation} >) => void*: callback `(permissions: Record<string, { type: 'object' | 'state' | 'users' | 'other' | 'file' | ''; operation: SocketOperation }>) => void`
229
227
 
230
- ### <a name="getuserpermissions_w"></a>getUserPermissions(callback)
228
+ #### <a name="getuserpermissions_w"></a>`getUserPermissions(callback)`
231
229
  Get user permissions
232
- * callback *(function)*: `function (error, permissions)`
230
+ * `callback` *(error: string | null | undefined, userPermissions?: SocketACL | null) => void) => void*: callback `(error: string | null | undefined, userPermissions?: SocketACL | null) => void`
233
231
 
234
- ### <a name="getversion_w"></a>getVersion(callback)
232
+ #### <a name="getversion_w"></a>`getVersion(callback)`
235
233
  Get the adapter version. Not the socket-classes version!
236
- * callback *(function)*: `function (error, adapterVersion, adapterName)`
237
-
238
- ### <a name="getadaptername_w"></a>getAdapterName(callback)
239
- Get adapter name. Not the socket-classes version!
240
- * callback *(function)*: `function (error, adapterVersion)`
241
-
242
- ### <a name="getobject_w"></a>getObject(id, callback)
243
- Get one object
244
- * id *(string)*: object ID.
245
- * callback *(function)*: `function (error, obj)`
246
-
247
- ### <a name="getobjects_w"></a>getObjects(list, callback)
248
- Get all objects that are relevant for web: all states and enums with rooms
249
- * id *(string)*: object ID.
250
- * list *(string[])*: optional list of IDs.
251
- * callback *(function)*: `function (error, obj)`
252
-
253
- ### <a name="subscribeobjects_w"></a>subscribeObjects(pattern, callback)
234
+ * `callback` *(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void*: callback `(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void`
235
+
236
+ #### <a name="getadaptername_w"></a>`getAdapterName(callback)`
237
+ Get adapter name: "iobroker.ws", "iobroker.socketio", "iobroker.web", "iobroker.admin"
238
+ * `callback` *(error: string | Error | null | undefined, adapterName: string) => void) => void*: callback `(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void`
239
+
240
+ #### <a name="clientsubscribe_w"></a>`clientSubscribe(targetInstance, messageType, data, callback)`
241
+ Client subscribes to specific instance's messages.
242
+ Client informs specific instance about subscription on its messages.
243
+ After subscription, the socket will receive "im" messages from desired instance
244
+ The target instance MUST acknowledge the subscription and return result
245
+ * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
246
+ * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
247
+ * `data` *any*: Optional data object, e.g., {width: 640, height: 480}
248
+ * `callback` *(error: string | null | Error | undefined, result?: {accepted: boolean; heartbeat?: number; error?: string}) => void*: Callback `(error: string | null, result?:{ accepted: boolean; heartbeat?: number; error?: string; }) => void`
249
+
250
+ #### <a name="clientunsubscribe_w"></a>`clientUnsubscribe(targetInstance, messageType, callback)`
251
+ Client unsubscribes from specific instance's messages.
252
+ The target instance MUST NOT acknowledge the un-subscription
253
+ * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
254
+ * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
255
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
256
+
257
+ #### <a name="getadapterinstances_w"></a>`getAdapterInstances(adapterName, callback)`
258
+ Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
259
+ * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters just place here "".
260
+ * `callback` *(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void) => void*: callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
261
+
262
+ ### Objects
263
+ #### <a name="getobject_w"></a>`getObject(id, callback)`
264
+ Get one object.
265
+ * `id` *string*: Object ID
266
+ * `callback` *(error: Error | undefined | string | null, obj?: ioBroker.Object) => void) => void*: Callback `(error: string | null, obj?: ioBroker.Object) => void`
267
+
268
+ #### <a name="getobjects_w"></a>`getObjects(list, callback)`
269
+ Get all objects that are relevant for web: all states and enums with rooms.
270
+ This is non-admin version of "all objects" and will be overloaded in admin
271
+ * `list` *string[] | null*: Optional list of IDs
272
+ * `callback` *(error: Error | undefined | string | null, objs?: Record<string, ioBroker.Object>) => void) => void*: Callback `(error: string | null, objs?: Record<string, ioBroker.Object>) => void`
273
+
274
+ #### <a name="subscribeobjects_w"></a>`subscribeObjects(pattern, callback)`
254
275
  Subscribe to object changes by pattern. The events will come as 'objectChange' events to the socket.
255
- * pattern *(string)*: pattern like 'system.adapter.*' or array of IDs like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
256
- * callback *(function)*: `function (error)`
276
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of IDs like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
277
+ * `callback` *(error: Error | undefined | string | null) => void) => void*: Callback `(error: string | null) => void`
257
278
 
258
- ### <a name="unsubscribeobjects_w"></a>unsubscribeObjects(pattern, callback)
279
+ #### <a name="unsubscribeobjects_w"></a>`unsubscribeObjects(pattern, callback)`
259
280
  Unsubscribe from object changes by pattern.
260
- * pattern *(string)*: pattern like 'system.adapter.*' or array of IDs like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
261
- * callback *(function)*: `function (error)`
262
-
263
- ### <a name="getobjectview_w"></a>getObjectView(design, search, params, callback)
264
- Make a query to the object database.
265
- * design *(string)*: 'system' or other designs like `custom`, but it must exist object `_design/custom`. Too 99,9% use `system`.
266
- * search *(string)*: object type, like `state`, `instance`, `adapter`, `host`, ...
267
- * params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey?: 'system.adapter.\u9999', depth?: number}`
268
- * callback *(function)*: `function (error)`
269
-
270
- ### <a name="setobject_w"></a>setObject(id, obj, callback)
271
- Set object.
272
- * id *(string)*: object ID
273
- * obj *(object)*: object itself
274
- * callback *(function)*: `function (error)`
275
-
276
- ### <a name="delobject_w"></a>delObject(id, options, callback)
277
- Delete object. Only deletion of flot objects is allowed
278
- * id *(string)*: Object ID like, 'flot.0.myChart'
279
- * options *(string)*: ignored
280
- * callback *(function)*: `function (error)`
281
-
282
- ### <a name="clientsubscribe_w"></a>clientSubscribe(targetInstance, messageType, data, callback)
283
- Client informs specific instance about subscription on its messages. After subscription the socket will receive "im" messages from desired instance
284
- * targetInstance *(string)*: instance name, e.g. "cameras.0"
285
- * messageType *(string)*: message type, e.g. "startRecording/cam1"
286
- * data *(object)*: optional data object, e.g. {width: 640, height: 480}
287
- * callback *(function)*: `function (error, result)`, target instance MUST acknowledge the subscription and return some object as result
288
-
289
- ### <a name="clientunsubscribe_w"></a>clientUnsubscribe(targetInstance, messageType, callback)
290
- Client unsubscribes from specific instance's messages
291
- * targetInstance *(string)*: instance name, e.g. "cameras.0"
292
- * messageType *(string)*: message type, e.g. "startRecording/cam1"
293
- * callback *(function)*: `function (error, wasSubscribed)`, target instance MUST NOT acknowledge the un-subscription
294
-
295
- ### <a name="getstates_w"></a>getStates(pattern, callback)
296
- Read states by pattern
297
- * pattern *(string)*: optional pattern, like `system.adapter.*` or array of state IDs
298
- * callback *(function)*: `function (error, states)`, where `states` is an object like `{'system.adapter.history.0': {_id: 'system.adapter.history.0', common: {name: 'history', ...}, native: {...}, 'system.adapter.history.1': {...}}}`
299
-
300
- ### <a name="getforeignstates_w"></a>getForeignStates(pattern, callback)
301
- Read all states (which might not belong to this adapter) which match the given pattern
302
- * pattern *(string)*: pattern like `system.adapter.*` or array of state IDs
303
- * callback *(function)*: `function (error)`
304
-
305
- ### <a name="getstate_w"></a>getState(id, callback)
306
- Read one state.
307
- * id *(string)*: State ID like, 'system.adapter.admin.0.memRss'
308
- * callback *(function)*: `function (error, state)`, where `state` is an object like `{val: 123, ts: 1663915537418, ack: true, from: 'system.adapter.admin.0', q: 0, lc: 1663915537418, c: 'javascript.0'}`
309
-
310
- ### <a name="setstate_w"></a>setState(id, state, callback)
311
- Write one state.
312
- * id *(string)*: State ID like, 'system.adapter.admin.0.memRss'
313
- * state *(any)*: value or object like `{val: 123, ack: true}`
314
- * callback *(function)*: `function (error, state)`, where `state` is an object like `{val: 123, ts: 1663915537418, ack: true, from: 'system.adapter.admin.0', q: 0, lc: 1663915537418, c: 'javascript.0'}`
315
-
316
- ### <a name="getbinarystate_w"></a>getBinaryState(id, callback)
317
- Read one binary state.
318
- * id *(string)*: State ID like, 'javascript.0.binary'
319
- * callback *(function)*: `function (error, base64)`
320
-
321
- ### <a name="setbinarystate_w"></a>setBinaryState(id, base64, callback)
322
- Write one binary state.
323
- * id *(string)*: State ID like, 'javascript.0.binary'
324
- * base64 *(string)*: State value as base64 string. Binary states have no acknowledged flag.
325
- * callback *(function)*: `function (error)`
326
-
327
- ### <a name="subscribe_w"></a>subscribe(pattern, callback)
328
- Subscribe to state changes by pattern. The events will come as 'stateChange' events to the socket.
329
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
330
- * callback *(function)*: `function (error)`
331
-
332
- ### <a name="subscribestates_w"></a>subscribeStates(pattern, callback)
333
- Subscribe to state changes by pattern. Same as `subscribe`. The events will come as 'stateChange' events to the socket.
334
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
335
- * callback *(function)*: `function (error)`
336
-
337
- ### <a name="unsubscribe_w"></a>unsubscribe(pattern, callback)
281
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of IDs like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
282
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
283
+
284
+ #### <a name="setobject_w"></a>`setObject(id, obj, callback)`
285
+ Set an object.
286
+ * `id` *string*: Object ID
287
+ * `obj` *ioBroker.Object*: Object to set
288
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
289
+
290
+ #### <a name="delobject_w"></a>`delObject(id, _options, callback)`
291
+ Delete an object. Only deletion of flot and fullcalendar objects is allowed
292
+ * `id` *string*: Object ID, like 'flot.0.myChart'
293
+ * `_options` *any*: Options for deletion. Ignored
294
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
295
+
296
+ ### States
297
+ #### <a name="getstates_w"></a>`getStates(pattern, callback)`
298
+ Get states by pattern of current adapter
299
+ * `pattern` *string | string[] | undefined*: optional pattern, like `system.adapter.*` or array of state IDs. If the pattern is omitted, you will get ALL states of current adapter
300
+ * `callback` *(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void) => void*: callback `(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void`
301
+
302
+ #### <a name="getforeignstates_w"></a>`getForeignStates(pattern, callback)`
303
+ Same as getStates
304
+ * `pattern` *string | string[]*: pattern like `system.adapter.*` or array of state IDs
305
+ * `callback` *(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void) => void*: callback `(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void`
306
+
307
+ #### <a name="getstate_w"></a>`getState(id, callback)`
308
+ Get a state by ID
309
+ * `id` *string*: State ID, e.g. `system.adapter.admin.0.memRss`
310
+ * `callback` *(error: null | undefined | Error | string, state?: ioBroker.State) => void) => void*: Callback `(error: null | undefined | Error | string, state?: ioBroker.State) => void`
311
+
312
+ #### <a name="setstate_w"></a>`setState(id, state, callback)`
313
+ Set a state by ID
314
+ * `id` *string*: State ID, e.g. `system.adapter.admin.0.memRss`
315
+ * `state` *ioBroker.SettableState*: State value or object, e.g. `{val: 123, ack: true}`
316
+ * `callback` *(error: null | undefined | Error | string, state?: ioBroker.State) => void) => void*: Callback `(error: null | undefined | Error | string, state?: ioBroker.State) => void`
317
+
318
+ #### <a name="getbinarystate_w"></a>`getBinaryState(id, callback)`
319
+ Get a binary state by ID
320
+ * `id` *string*: State ID, e.g. `javascript.0.binary`
321
+ * `callback` *(error: null | undefined | Error | string, base64?: string) => void) => void*: Callback `(error: null | undefined | Error | string, base64?: string) => void`
322
+
323
+ #### <a name="setbinarystate_w"></a>`setBinaryState(id, _base64, callback)`
324
+ Set a binary state by ID
325
+ * `id` *string*: State ID, e.g. `javascript.0.binary`
326
+ * `_base64` *string*: State value as base64 string. Binary states have no acknowledged flag.
327
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
328
+
329
+ #### <a name="subscribe_w"></a>`subscribe(pattern, callback)`
330
+ Subscribe to state changes by pattern.
331
+ The events will come as 'stateChange' events to the socket.
332
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
333
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
334
+
335
+ #### <a name="subscribestates_w"></a>`subscribeStates(pattern, callback)`
336
+ Subscribe to state changes by pattern. Same as `subscribe`.
337
+ The events will come as 'stateChange' events to the socket.
338
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
339
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
340
+
341
+ #### <a name="unsubscribe_w"></a>`unsubscribe(pattern, callback)`
338
342
  Unsubscribe from state changes by pattern.
339
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
340
- * callback *(function)*: `function (error)`
343
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
344
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
341
345
 
342
- ### <a name="unsubscribestates_w"></a>unsubscribeStates(pattern, callback)
346
+ #### <a name="unsubscribestates_w"></a>`unsubscribeStates(pattern, callback)`
343
347
  Unsubscribe from state changes by pattern. Same as `unsubscribe`.
344
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
345
- * callback *(function)*: `function (error)`
346
-
347
- ### <a name="readfile_w"></a>readFile(_adapter, fileName, callback)
348
- Read file from ioBroker DB
349
- * _adapter *(string)*: instance name, e.g. `vis.0`
350
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
351
- * callback *(function)*: `function (error, data, mimeType)`
352
-
353
- ### <a name="readfile64_w"></a>readFile64(_adapter, fileName, callback)
354
- Read file from ioBroker DB as base64 string
355
- * _adapter *(string)*: instance name, e.g. `vis.0`
356
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
357
- * callback *(function)*: `function (error, base64, mimeType)`
358
-
359
- ### <a name="writefile64_w"></a>writeFile64(_adapter, fileName, data64, options, callback)
360
- Write file into ioBroker DB as base64 string
361
- * _adapter *(string)*: instance name, e.g. `vis.0`
362
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
363
- * data64 *(string)*: file content as base64 string
364
- * options *(object)*: optional `{mode: 0x0644}`
365
- * callback *(function)*: `function (error)`
366
-
367
- ### <a name="writefile_w"></a>writeFile(_adapter, fileName, data, options, callback)
368
- Write file into ioBroker DB as text **DEPRECATED**
369
- * _adapter *(string)*: instance name, e.g. `vis.0`
370
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
371
- * data64 *(string)*: file content as base64 string
372
- * options *(object)*: optional `{mode: 0x644}`
373
- * callback *(function)*: `function (error)`
374
-
375
- ### <a name="unlink_w"></a>unlink(_adapter, name, callback)
348
+ The events will come as 'stateChange' events to the socket.
349
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
350
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
351
+
352
+ ### Files
353
+ #### <a name="readfile_w"></a>`readFile(adapter, fileName, callback)`
354
+ Read a file from ioBroker DB
355
+ * `adapter` *string*: instance name, e.g. `vis.0`
356
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
357
+ * `callback` *(error: null | undefined | Error | string, data: Buffer | string, mimeType: string) => void) => void*: Callback `(error: null | undefined | Error | string, data: Buffer | string, mimeType: string) => void`
358
+
359
+ #### <a name="readfile64_w"></a>`readFile64(adapter, fileName, callback)`
360
+ Read a file from ioBroker DB as base64 string
361
+ * `adapter` *string*: instance name, e.g. `vis.0`
362
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
363
+ * `callback` *(error: null | undefined | Error | string, base64?: string, mimeType?: string) => void) => void*: Callback `(error: null | undefined | Error | string, base64: string, mimeType: string) => void`
364
+
365
+ #### <a name="writefile64_w"></a>`writeFile64(adapter, fileName, data64, options, callback?)`
366
+ Write a file into ioBroker DB as base64 string
367
+ * `adapter` *string*: instance name, e.g. `vis.0`
368
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
369
+ * `data64` *string*: file content as base64 string
370
+ * `options` *{mode?: number} | ((error: null | undefined | Error | string) => void)*: optional `{mode: 0x0644}`
371
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
372
+
373
+ #### <a name="writefile_w"></a>`writeFile(adapter, fileName, data, options, callback?)`
374
+ Write a file into ioBroker DB as text
375
+ This function is overloaded in admin (because admin accepts only base64)
376
+ * `adapter` *string*: instance name, e.g. `vis.0`
377
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
378
+ * `data` *string*: file content as text
379
+ * `options` *{mode?: number} | ((error: null | undefined | Error | string) => void)*: optional `{mode: 0x0644}`
380
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
381
+
382
+ #### <a name="unlink_w"></a>`unlink(adapter, name, callback)`
376
383
  Delete file in ioBroker DB
377
- * _adapter *(string)*: instance name, e.g. `vis.0`
378
- * name *(string)*: file name, e.g. `main/vis-views.json`
379
- * callback *(function)*: `function (error)`
380
-
381
- ### <a name="deletefile_w"></a>deleteFile(_adapter, name, callback)
382
- Delete file in ioBroker DB (same as unlink, but only for files)
383
- * _adapter *(string)*: instance name, e.g. `vis.0`
384
- * name *(string)*: file name, e.g. `main/vis-views.json`
385
- * callback *(function)*: `function (error)`
386
-
387
- ### <a name="deletefolder_w"></a>deleteFolder(_adapter, name, callback)
388
- Delete file in ioBroker DB (same as unlink, but only for folders)
389
- * _adapter *(string)*: instance name, e.g. `vis.0`
390
- * name *(string)*: folder name, e.g. `main`
391
- * callback *(function)*: `function (error)`
392
-
393
- ### <a name="renamefile_w"></a>renameFile(_adapter, oldName, newName, callback)
394
- Rename file in ioBroker DB
395
- * _adapter *(string)*: instance name, e.g. `vis.0`
396
- * oldName *(string)*: current file name, e.g. `main/vis-views.json`
397
- * newName *(string)*: new file name, e.g. `main/vis-views-new.json`
398
- * callback *(function)*: `function (error)`
399
-
400
- ### <a name="rename_w"></a>rename(_adapter, oldName, newName, callback)
384
+ * `adapter` *string*: instance name, e.g. `vis.0`
385
+ * `name` *string*: file name, e.g. `main/vis-views.json`
386
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
387
+
388
+ #### <a name="deletefile_w"></a>`deleteFile(adapter, name, callback)`
389
+ Delete a file in ioBroker DB (same as "unlink", but only for files)
390
+ * `adapter` *string*: instance name, e.g. `vis.0`
391
+ * `name` *string*: file name, e.g. `main/vis-views.json`
392
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
393
+
394
+ #### <a name="deletefolder_w"></a>`deleteFolder(adapter, name, callback)`
395
+ Delete folder in ioBroker DB (same as `unlink`, but only for folders)
396
+ * `adapter` *string*: instance name, e.g. `vis.0`
397
+ * `name` *string*: folder name, e.g. `main`
398
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
399
+
400
+ #### <a name="renamefile_w"></a>`renameFile(adapter, oldName, newName, callback)`
401
+ Rename a file in ioBroker DB
402
+ * `adapter` *string*: instance name, e.g. `vis.0`
403
+ * `oldName` *string*: current file name, e.g. `main/vis-views.json`
404
+ * `newName` *string*: new file name, e.g. `main/vis-views-new.json`
405
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
406
+
407
+ #### <a name="rename_w"></a>`rename(adapter, oldName, newName, callback)`
401
408
  Rename file or folder in ioBroker DB
402
- * _adapter *(string)*: instance name, e.g. `vis.0`
403
- * oldName *(string)*: current file name, e.g. `main/vis-views.json`
404
- * newName *(string)*: new file name, e.g. `main/vis-views-new.json`
405
- * callback *(function)*: `function (error)`
406
-
407
- ### <a name="mkdir_w"></a>mkdir(_adapter, dirName, callback)
408
- Create folder in ioBroker DB
409
- * _adapter *(string)*: instance name, e.g. `vis.0`
410
- * dirName *(string)*: desired folder name, e.g. `main`
411
- * callback *(function)*: `function (error)`
412
-
413
- ### <a name="readdir_w"></a>readDir(_adapter, dirName, options, callback)
409
+ * `adapter` *string*: instance name, e.g. `vis.0`
410
+ * `oldName` *string*: current file name, e.g. `main/vis-views.json`
411
+ * `newName` *string*: new file name, e.g. `main/vis-views-new.json`
412
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
413
+
414
+ #### <a name="mkdir_w"></a>`mkdir(adapter, dirName, callback)`
415
+ Create a folder in ioBroker DB
416
+ * `adapter` *string*: instance name, e.g. `vis.0`
417
+ * `dirName` *string*: desired folder name, e.g. `main`
418
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
419
+
420
+ #### <a name="readdir_w"></a>`readDir(adapter, dirName, options, callback?)`
414
421
  Read content of folder in ioBroker DB
415
- * _adapter *(string)*: instance name, e.g. `vis.0`
416
- * dirName *(string)*: folder name, e.g. `main`
417
- * options *(object)*: optional `{filter: '*'}` or `{filter: '*.json'}`
418
- * callback *(function)*: `function (error, files)` where `files` is an array of objects, like `{file: 'vis-views.json', isDir: false, stats: {size: 123}, modifiedAt: 1661336290090, acl: {owner: 'system.user.admin', ownerGroup: 'system.group.administrator', permissions: 1632, read: true, write: true}`
419
-
420
- ### <a name="chmodfile_w"></a>chmodFile(_adapter, fileName, options, callback)
421
- Change file mode in ioBroker DB
422
- * _adapter *(string)*: instance name, e.g. `vis.0`
423
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
424
- * options *(object)*: `{mode: 0x644}` or 0x644. The first digit is user, second group, third others. Bit 1 is `execute`, bit 2 is `write`, bit 3 is `read`
425
- * callback *(function)*: `function (error)`
426
-
427
- ### <a name="chownfile_w"></a>chownFile(_adapter, fileName, options, callback)
422
+ * `adapter` *string*: instance name, e.g. `vis.0`
423
+ * `dirName` *string*: folder name, e.g. `main`
424
+ * `options` *object | ((error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void)*: for future use
425
+ * `callback?` *(error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void*: Callback `(error: null | undefined | Error | string, files: Array<{file: string, isDir: boolean, stats: {size: number}, modifiedAt: number, acl: {owner: string, ownerGroup: string, permissions: number, read: boolean, write: boolean}}>) => void`
426
+
427
+ #### <a name="chmodfile_w"></a>`chmodFile(adapter, fileName, options, callback?)`
428
+ Change a file mode in ioBroker DB
429
+ * `adapter` *string*: instance name, e.g. `vis.0`
430
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
431
+ * `options` *{mode?: number}*: options `{mode: 0x644}`
432
+ * `callback?` *(error: string | Error | null | undefined) => void*: Callback `(error: string | Error | null | undefined) => void`
433
+
434
+ #### <a name="chownfile_w"></a>`chownFile(adapter, fileName, options, callback?)`
428
435
  Change file owner in ioBroker DB
429
- * _adapter *(string)*: instance name, e.g. `vis.0`
430
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
431
- * options *(object)*: `{owner: 'system.user.user', ownerGroup: ''system.group.administrator'}` or 'system.user.user'. If ownerGroup is not defined, it will be taken from owner.
432
- * callback *(function)*: `function (error)`
436
+ * `adapter` *string*: instance name, e.g. `vis.0`
437
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
438
+ * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from owner.
439
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
433
440
 
434
- ### <a name="fileexists_w"></a>fileExists(_adapter, fileName, callback)
441
+ #### <a name="fileexists_w"></a>`fileExists(adapter, fileName, callback)`
435
442
  Check if the file or folder exists in ioBroker DB
436
- * _adapter *(string)*: instance name, e.g. `vis.0`
437
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
438
- * callback *(function)*: `function (error, isExist)`
443
+ * `adapter` *string*: instance name, e.g. `vis.0`
444
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
445
+ * `callback` *(error: null | undefined | Error | string, exists?: boolean) => void) => void*: Callback `(error: null | undefined | Error | string, exists?: boolean) => void`
439
446
 
440
- ### <a name="subscribefiles_w"></a>subscribeFiles(id, pattern, callback)
447
+ #### <a name="subscribefiles_w"></a>`subscribeFiles(id, pattern, callback)`
441
448
  Subscribe to file changes in ioBroker DB
442
- * id *(string)*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
443
- * pattern *(string)*: file name pattern, e.g. `main/*.json`
444
- * callback *(function)*: `function (error)`
449
+ * `id` *string*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
450
+ * `pattern` *string | string[]*: file name pattern, e.g. `main/*.json` or array of names
451
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
445
452
 
446
- ### <a name="unsubscribefiles_w"></a>unsubscribeFiles(id, pattern, callback)
453
+ #### <a name="unsubscribefiles_w"></a>`unsubscribeFiles(id, pattern, callback)`
447
454
  Unsubscribe from file changes in ioBroker DB
448
- * id *(string)*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
449
- * pattern *(string)*: file name pattern, e.g. `main/*.json`
450
- * callback *(function)*: `function (error)`
451
-
452
- ### <a name="getadapterinstances_w"></a>getAdapterInstances(adapterName, callback)
453
- Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
454
- * adapterName *(string)*: optional adapter name, e.g. `history`.
455
- * callback *(function)*: `function (error, instanceList)`, where instanceList is an array of instance objects, e.g. `{_id: 'system.adapter.history.0', common: {name: 'history', ...}, native: {...}}`
455
+ * `id` *string*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
456
+ * `pattern` *string | string[]*: file name pattern, e.g. `main/*.json` or array of names
457
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
456
458
 
457
459
  <!-- WEB_METHODS_END -->
458
460
 
459
461
  ## Admin Methods
460
462
  <!-- ADMIN_METHODS_START -->
461
463
  ### List of commands
462
- * [authenticate](#authenticate_a)
463
- * [error](#error_a)
464
- * [log](#log_a)
465
- * [checkFeatureSupported](#checkfeaturesupported_a)
466
- * [getHistory](#gethistory_a)
467
- * [httpGet](#httpget_a)
468
- * [sendTo](#sendto_a)
469
- * [sendToHost](#sendtohost_a)
470
- * [authEnabled](#authenabled_a)
471
- * [logout](#logout_a)
472
- * [listPermissions](#listpermissions_a)
473
- * [getUserPermissions](#getuserpermissions_a)
474
- * [getVersion](#getversion_a)
475
- * [getAdapterName](#getadaptername_a)
476
- * [getHostByIp](#gethostbyip_a)
477
- * [requireLog](#requirelog_a)
478
- * [readLogs](#readlogs_a)
479
- * [delState](#delstate_a)
480
- * [cmdExec](#cmdexec_a)
481
- * [eventsThreshold](#eventsthreshold_a)
482
- * [getRatings](#getratings_a)
483
- * [getCurrentInstance](#getcurrentinstance_a)
484
- * [decrypt](#decrypt_a)
485
- * [encrypt](#encrypt_a)
486
- * [getIsEasyModeStrict](#getiseasymodestrict_a)
487
- * [getEasyMode](#geteasymode_a)
488
- * [getAdapters](#getadapters_a)
489
- * [updateLicenses](#updatelicenses_a)
490
- * [getCompactInstances](#getcompactinstances_a)
491
- * [getCompactAdapters](#getcompactadapters_a)
492
- * [getCompactInstalled](#getcompactinstalled_a)
493
- * [getCompactSystemConfig](#getcompactsystemconfig_a)
494
- * [getCompactSystemRepositories](#getcompactsystemrepositories_a)
495
- * [getCompactRepository](#getcompactrepository_a)
496
- * [getCompactHosts](#getcompacthosts_a)
497
- * [addUser](#adduser_a)
498
- * [delUser](#deluser_a)
499
- * [addGroup](#addgroup_a)
500
- * [delGroup](#delgroup_a)
501
- * [changePassword](#changepassword_a)
502
- * [getObject](#getobject_a)
503
- * [getObjects](#getobjects_a)
504
- * [subscribeObjects](#subscribeobjects_a)
505
- * [unsubscribeObjects](#unsubscribeobjects_a)
506
- * [getObjectView](#getobjectview_a)
507
- * [setObject](#setobject_a)
508
- * [delObject](#delobject_a)
509
- * [clientSubscribe](#clientsubscribe_a)
510
- * [clientUnsubscribe](#clientunsubscribe_a)
511
- * [getAllObjects](#getallobjects_a)
512
- * [extendObject](#extendobject_a)
513
- * [getForeignObjects](#getforeignobjects_a)
514
- * [delObjects](#delobjects_a)
515
- * [getStates](#getstates_a)
516
- * [getForeignStates](#getforeignstates_a)
517
- * [getState](#getstate_a)
518
- * [setState](#setstate_a)
519
- * [getBinaryState](#getbinarystate_a)
520
- * [setBinaryState](#setbinarystate_a)
521
- * [subscribe](#subscribe_a)
522
- * [subscribeStates](#subscribestates_a)
523
- * [unsubscribe](#unsubscribe_a)
524
- * [unsubscribeStates](#unsubscribestates_a)
525
- * [readFile](#readfile_a)
526
- * [readFile64](#readfile64_a)
527
- * [writeFile64](#writefile64_a)
528
- * [writeFile](#writefile_a)
529
- * [unlink](#unlink_a)
530
- * [deleteFile](#deletefile_a)
531
- * [deleteFolder](#deletefolder_a)
532
- * [renameFile](#renamefile_a)
533
- * [rename](#rename_a)
534
- * [mkdir](#mkdir_a)
535
- * [readDir](#readdir_a)
536
- * [chmodFile](#chmodfile_a)
537
- * [chownFile](#chownfile_a)
538
- * [fileExists](#fileexists_a)
539
- * [subscribeFiles](#subscribefiles_a)
540
- * [unsubscribeFiles](#unsubscribefiles_a)
541
- * [getAdapterInstances](#getadapterinstances_a)
542
- ### <a name="authenticate_a"></a>authenticate(user, pass, callback)
543
- Authenticate user by login and password
544
- * user *(string)*: user name
545
- * pass *(string)*: password
546
- * callback *(function)*: `function (isUserAuthenticated, isAuthenticationUsed)`
547
-
548
- ### <a name="error_a"></a>error(error)
464
+ * [`authenticate`](#authenticate_a)
465
+ * [`error`](#error_a)
466
+ * [`log`](#log_a)
467
+ * [`checkFeatureSupported`](#checkfeaturesupported_a)
468
+ * [`getHistory`](#gethistory_a)
469
+ * [`httpGet`](#httpget_a)
470
+ * [`sendTo`](#sendto_a)
471
+ * [`sendToHost`](#sendtohost_a)
472
+ * [`authEnabled`](#authenabled_a)
473
+ * [`logout`](#logout_a)
474
+ * [`listPermissions`](#listpermissions_a)
475
+ * [`getUserPermissions`](#getuserpermissions_a)
476
+ * [`getVersion`](#getversion_a)
477
+ * [`getAdapterName`](#getadaptername_a)
478
+ * [`clientSubscribe`](#clientsubscribe_a)
479
+ * [`clientUnsubscribe`](#clientunsubscribe_a)
480
+ * [`getAdapterInstances`](#getadapterinstances_a)
481
+ * [`getHostByIp`](#gethostbyip_a)
482
+ * [`requireLog`](#requirelog_a)
483
+ * [`readLogs`](#readlogs_a)
484
+ * [`cmdExec`](#cmdexec_a)
485
+ * [`eventsThreshold`](#eventsthreshold_a)
486
+ * [`getRatings`](#getratings_a)
487
+ * [`getCurrentInstance`](#getcurrentinstance_a)
488
+ * [`decrypt`](#decrypt_a)
489
+ * [`encrypt`](#encrypt_a)
490
+ * [`getIsEasyModeStrict`](#getiseasymodestrict_a)
491
+ * [`getEasyMode`](#geteasymode_a)
492
+ * [`getAdapters`](#getadapters_a)
493
+ * [`updateLicenses`](#updatelicenses_a)
494
+ * [`getCompactInstances`](#getcompactinstances_a)
495
+ * [`getCompactAdapters`](#getcompactadapters_a)
496
+ * [`getCompactInstalled`](#getcompactinstalled_a)
497
+ * [`getCompactSystemConfig`](#getcompactsystemconfig_a)
498
+ * [`getCompactSystemRepositories`](#getcompactsystemrepositories_a)
499
+ * [`getCompactRepository`](#getcompactrepository_a)
500
+ * [`getCompactHosts`](#getcompacthosts_a)
501
+ * [`delState`](#delstate_a)
502
+ * [`getStates`](#getstates_a)
503
+ * [`getForeignStates`](#getforeignstates_a)
504
+ * [`getState`](#getstate_a)
505
+ * [`setState`](#setstate_a)
506
+ * [`getBinaryState`](#getbinarystate_a)
507
+ * [`setBinaryState`](#setbinarystate_a)
508
+ * [`subscribe`](#subscribe_a)
509
+ * [`subscribeStates`](#subscribestates_a)
510
+ * [`unsubscribe`](#unsubscribe_a)
511
+ * [`unsubscribeStates`](#unsubscribestates_a)
512
+ * [`addUser`](#adduser_a)
513
+ * [`delUser`](#deluser_a)
514
+ * [`addGroup`](#addgroup_a)
515
+ * [`delGroup`](#delgroup_a)
516
+ * [`changePassword`](#changepassword_a)
517
+ * [`getObject`](#getobject_a)
518
+ * [`getObjects`](#getobjects_a)
519
+ * [`subscribeObjects`](#subscribeobjects_a)
520
+ * [`unsubscribeObjects`](#unsubscribeobjects_a)
521
+ * [`setObject`](#setobject_a)
522
+ * [`delObject`](#delobject_a)
523
+ * [`getAllObjects`](#getallobjects_a)
524
+ * [`extendObject`](#extendobject_a)
525
+ * [`getForeignObjects`](#getforeignobjects_a)
526
+ * [`delObjects`](#delobjects_a)
527
+ * [`readFile`](#readfile_a)
528
+ * [`readFile64`](#readfile64_a)
529
+ * [`writeFile64`](#writefile64_a)
530
+ * [`writeFile`](#writefile_a)
531
+ * [`unlink`](#unlink_a)
532
+ * [`deleteFile`](#deletefile_a)
533
+ * [`deleteFolder`](#deletefolder_a)
534
+ * [`renameFile`](#renamefile_a)
535
+ * [`rename`](#rename_a)
536
+ * [`mkdir`](#mkdir_a)
537
+ * [`readDir`](#readdir_a)
538
+ * [`chmodFile`](#chmodfile_a)
539
+ * [`chownFile`](#chownfile_a)
540
+ * [`fileExists`](#fileexists_a)
541
+ * [`subscribeFiles`](#subscribefiles_a)
542
+ * [`unsubscribeFiles`](#unsubscribefiles_a)
543
+ ### Commands
544
+ #### <a name="authenticate_a"></a>`authenticate(callback)`
545
+ Wait till the user is authenticated.
546
+ As the user authenticates himself, the callback will be called
547
+ * `callback` *(isUserAuthenticated: boolean, isAuthenticationUsed: boolean) => void) => void*: Callback `(isUserAuthenticated: boolean, isAuthenticationUsed: boolean) => void`
548
+
549
+ #### <a name="error_a"></a>`error(error)`
549
550
  Write error into ioBroker log
550
- * error *(string)*: error text
551
+ * `error` *Error | string*: Error object or error text
551
552
 
552
- ### <a name="log_a"></a>log(text, level)
553
+ #### <a name="log_a"></a>`log(text, level)`
553
554
  Write log entry into ioBroker log
554
- * text *(string)*: log text
555
- * level *(string)*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
555
+ * `text` *string*: log text
556
+ * `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
556
557
 
557
- ### <a name="checkfeaturesupported_a"></a>checkFeatureSupported(feature, callback)
558
- Checks, if the same feature is supported by the current js-controller
559
- * feature *(string)*: feature name like `CONTROLLER_LICENSE_MANAGER`
560
- * callback *(function)*: `function (error, isSupported)`
558
+ #### <a name="checkfeaturesupported_a"></a>`checkFeatureSupported(feature, callback)`
559
+ Check if the same feature is supported by the current js-controller
560
+ * `feature` *SupportedFeature*: feature name like `CONTROLLER_LICENSE_MANAGER`
561
+ * `callback` *(error: string | Error | null | undefined, isSupported?: boolean) => void) => void*: callback `(error: string | Error | null | undefined, isSupported: boolean) => void`
561
562
 
562
- ### <a name="gethistory_a"></a>getHistory(id, options, callback)
563
+ #### <a name="gethistory_a"></a>`getHistory(id, options, callback)`
563
564
  Get history data from specific instance
564
- * id *(string)*: object ID
565
- * options *(object)*: See object description here: https://github.com/ioBroker/ioBroker.history/blob/master/docs/en/README.md#access-values-from-javascript-adapter
566
- * callback *(function)*: `function (error, result)`
565
+ * `id` *string*: object ID
566
+ * `options` *ioBroker.GetHistoryOptions*: History options
567
+ * `callback` *(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void) => void*: callback `(error: string | Error | null | undefined, result: ioBroker.GetHistoryResult) => void`
567
568
 
568
- ### <a name="httpget_a"></a>httpGet(url, callback)
569
- Read content of HTTP(S) page server-side (without CORS and stuff)
570
- * url *(string)*: Page URL
571
- * callback *(function)*: `function (error, {status, statusText}, body)`
569
+ #### <a name="httpget_a"></a>`httpGet(url, callback)`
570
+ Read content of HTTP(s) page server-side (without CORS and stuff)
571
+ * `url` *string*: Page URL
572
+ * `callback` *(error: Error | null | undefined | string, result?: {status: number; statusText: string}, data?: string) => void*: callback `(error: Error | null, result?: { status: number; statusText: string }, data?: string) => void`
572
573
 
573
- ### <a name="sendto_a"></a>sendTo(adapterInstance, command, message, callback)
574
+ #### <a name="sendto_a"></a>`sendTo(adapterInstance, command, message, callback)`
574
575
  Send the message to specific instance
575
- * adapterInstance *(string)*: instance name, e.g. `history.0`
576
- * command *(string)*: command name
577
- * message *(object)*: the message is instance dependent
578
- * callback *(function)*: `function (result)`
576
+ * `adapterInstance` *string*: instance name, e.g. `history.0`
577
+ * `command` *string*: command name
578
+ * `message` *any*: the message is instance-dependent
579
+ * `callback` *(result: any) => void) => void*: callback `(result: any) => void`
579
580
 
580
- ### <a name="sendtohost_a"></a>sendToHost(host, command, message, callback)
581
+ #### <a name="sendtohost_a"></a>`sendToHost(host, command, message, callback)`
581
582
  Send a message to the specific host.
582
583
  Host can answer to the following commands: `cmdExec, getRepository, getInstalled, getInstalledAdapter, getVersion, getDiagData, getLocationOnDisk, getDevList, getLogs, getHostInfo, delLogs, readDirAsZip, writeDirAsZip, readObjectsAsZip, writeObjectsAsZip, checkLogging, updateMultihost`.
583
- * host *(string)*: instance name, e.g. `history.0`
584
- * command *(string)*: command name
585
- * message *(object)*: the message is command-specific
586
- * callback *(function)*: `function (result)`
584
+ * `host` *string*: Host name. With or without 'system.host.' prefix
585
+ * `command` * 'shell' | 'cmdExec' | 'getRepository' | 'getInstalled' | 'getInstalledAdapter' | 'getVersion' | 'getDiagData' | 'getLocationOnDisk' | 'getDevList' | 'getLogs' | 'getLogFile' | 'getLogFiles' | 'getHostInfo' | 'getHostInfoShort' | 'delLogs' | 'readDirAsZip' | 'writeDirAsZip' | 'readObjectsAsZip' | 'writeObjectsAsZip' | 'checkLogging' | 'updateMultihost' | 'upgradeController' | 'upgradeAdapterWithWebserver' | 'getInterfaces' | 'upload' | 'rebuildAdapter' | 'readBaseSettings' | 'writeBaseSettings' | 'addNotification' | 'clearNotifications' | 'getNotifications' | 'updateLicenses' | 'upgradeOsPackages' | 'restartController' | 'sendToSentry'*: Host command
586
+ * `message` *any*: the message is command-specific
587
+ * `callback` *(result: {error?: string; result?: any}) => void) => void*: callback `(result: { error?: string; result?: any }) => void`
587
588
 
588
- ### <a name="authenabled_a"></a>authEnabled(callback)
589
+ #### <a name="authenabled_a"></a>`authEnabled(callback)`
589
590
  Ask server is authentication enabled, and if the user authenticated
590
- * callback *(function)*: `function (isAuthenticationUsed, userName)`
591
+ * `callback` *(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void) => void*: callback `(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void`
591
592
 
592
- ### <a name="logout_a"></a>logout(callback)
593
+ #### <a name="logout_a"></a>`logout(callback)`
593
594
  Logout user
594
- * callback *(function)*: function (error)
595
+ * `callback` *ioBroker.ErrorCallback*: callback `(error?: Error) => void`
595
596
 
596
- ### <a name="listpermissions_a"></a>listPermissions(callback)
597
+ #### <a name="listpermissions_a"></a>`listPermissions(callback)`
597
598
  List commands and permissions
598
- * callback *(function)*: `function (permissions)`
599
+ * `callback` *(permissions: Record< string, {type: 'object' | 'state' | 'users' | 'other' | 'file' | ''; operation: SocketOperation} >) => void*: callback `(permissions: Record<string, { type: 'object' | 'state' | 'users' | 'other' | 'file' | ''; operation: SocketOperation }>) => void`
599
600
 
600
- ### <a name="getuserpermissions_a"></a>getUserPermissions(callback)
601
+ #### <a name="getuserpermissions_a"></a>`getUserPermissions(callback)`
601
602
  Get user permissions
602
- * callback *(function)*: `function (error, permissions)`
603
+ * `callback` *(error: string | null | undefined, userPermissions?: SocketACL | null) => void) => void*: callback `(error: string | null | undefined, userPermissions?: SocketACL | null) => void`
603
604
 
604
- ### <a name="getversion_a"></a>getVersion(callback)
605
+ #### <a name="getversion_a"></a>`getVersion(callback)`
605
606
  Get the adapter version. Not the socket-classes version!
606
- * callback *(function)*: `function (error, adapterVersion, adapterName)`
607
-
608
- ### <a name="getadaptername_a"></a>getAdapterName(callback)
609
- Get adapter name. Not the socket-classes version!
610
- * callback *(function)*: `function (error, adapterVersion)`
611
-
612
- ### <a name="gethostbyip_a"></a>getHostByIp(ip, callback)
613
- Read the host object by IP address
614
- * ip *(string)*: ip address. IPv4 or IPv6
615
- * callback *(function)*: `function (ip, obj)`. If host is not found, obj is null
616
-
617
- ### <a name="requirelog_a"></a>requireLog(isEnabled, callback)
618
- Activate or deactivate logging events. Events will be sent to the socket as `log` event. Adapter must have `common.logTransporter = true`
619
- * isEnabled *(boolean)*: is logging enabled
620
- * callback *(function)*: `function (error)`
621
-
622
- ### <a name="readlogs_a"></a>readLogs(host, callback)
623
- Get logs file from given host
624
- * host *(string)*: host id, like 'system.host.raspberrypi'
625
- * callback *(function)*: `function (error, files)`, where `files` is array of `{fileName: `log/hostname/transport/file`, size: 123}`
626
-
627
- ### <a name="delstate_a"></a>delState(id, callback)
628
- Delete state. The corresponding object will be deleted too.
629
- * id *(string)*: state ID
630
- * callback *(function)*: `function (error)`
631
-
632
- ### <a name="cmdexec_a"></a>cmdExec(host, id, cmd, callback)
633
- Execute the shell command on host/controller. Following response commands are expected: ´cmdStdout, cmdStderr, cmdExit´
634
- * host *(string)*: host name, like 'system.host.raspberrypi'
635
- * id *(string)*: session ID, like `Date.now()´. This session ID will come in events `cmdStdout, cmdStderr, cmdExit`
636
- * cmd *(string)*: command
637
- * callback *(function)*: `function (error)`
638
-
639
- ### <a name="eventsthreshold_a"></a>eventsThreshold(isActive)
640
- Used only for admin to the limited number of events to front-end.
641
- * isActive *(boolean)*: if true, then events will be limited
642
-
643
- ### <a name="getratings_a"></a>getRatings(update, callback)
644
- Read ratings of adapters
645
- * update *(boolean)*: if true, the ratings will be read from central server, if false from local cache
646
- * callback *(function)*: `function (error, ratings)`, where `ratings` is object like `{accuweather: {rating: {r: 3.33, c: 3}, 1.2.1: {r: 3, c: 1}},…}`
647
-
648
- ### <a name="getcurrentinstance_a"></a>getCurrentInstance(callback)
649
- Return current instance name like `admin.0`
650
- * callback *(function)*: `function (error, namespace)`
651
-
652
- ### <a name="decrypt_a"></a>decrypt(encryptedText, callback)
653
- Decrypts text with the system secret key
654
- * encryptedText *(string)*: encrypted text
655
- * callback *(function)*: `function (error, decryptedText)`
656
-
657
- ### <a name="encrypt_a"></a>encrypt(plainText, callback)
658
- Encrypts text with the system secret key
659
- * plainText *(string)*: normal text
660
- * callback *(function)*: `function (error, encryptedText)`
661
-
662
- ### <a name="getiseasymodestrict_a"></a>getIsEasyModeStrict(callback)
663
- Returns if admin has easy mode enabled
664
- * callback *(function)*: `function (error, isEasyModeStrict)`
665
-
666
- ### <a name="geteasymode_a"></a>getEasyMode(callback)
667
- Get easy mode configuration
668
- * callback *(function)*: `function (error, easyModeConfig)`, where `easyModeConfig` is object like `{strict: true, configs: [{_id: 'system.adapter.javascript.0', common: {...}}, {...}]}`
669
-
670
- ### <a name="getadapters_a"></a>getAdapters(adapterName, callback)
671
- Read all adapters objects
672
- * adapterName *(string)*: optional adapter name
673
- * callback *(function)*: `function (error, results)`, where `results` is array of objects like `{_id: 'system.adapter.javascript', common: {...}}`
674
-
675
- ### <a name="updatelicenses_a"></a>updateLicenses(login, password, callback)
607
+ * `callback` *(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void*: callback `(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void`
608
+
609
+ #### <a name="getadaptername_a"></a>`getAdapterName(callback)`
610
+ Get adapter name: "iobroker.ws", "iobroker.socketio", "iobroker.web", "iobroker.admin"
611
+ * `callback` *(error: string | Error | null | undefined, adapterName: string) => void) => void*: callback `(error: string | Error | null | undefined, version: string | undefined, adapterName: string) => void`
612
+
613
+ #### <a name="clientsubscribe_a"></a>`clientSubscribe(targetInstance, messageType, data, callback)`
614
+ Client subscribes to specific instance's messages.
615
+ Client informs specific instance about subscription on its messages.
616
+ After subscription, the socket will receive "im" messages from desired instance
617
+ The target instance MUST acknowledge the subscription and return result
618
+ * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
619
+ * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
620
+ * `data` *any*: Optional data object, e.g., {width: 640, height: 480}
621
+ * `callback` *(error: string | null | Error | undefined, result?: {accepted: boolean; heartbeat?: number; error?: string}) => void*: Callback `(error: string | null, result?:{ accepted: boolean; heartbeat?: number; error?: string; }) => void`
622
+
623
+ #### <a name="clientunsubscribe_a"></a>`clientUnsubscribe(targetInstance, messageType, callback)`
624
+ Client unsubscribes from specific instance's messages.
625
+ The target instance MUST NOT acknowledge the un-subscription
626
+ * `targetInstance` *string*: Instance name, e.g., 'cameras.0'
627
+ * `messageType` *string*: Message type, e.g., 'startRecording/cam1'
628
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
629
+
630
+ #### <a name="getadapterinstances_a"></a>`getAdapterInstances(adapterName, callback)`
631
+ Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
632
+ * `adapterName` *string | undefined*: adapter name, e.g. `history`. To get all instances of all adapters just place here "".
633
+ * `callback` *(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void) => void*: callback `(error: null | undefined | Error | string, instanceList?: ioBroker.InstanceObject[]) => void`
634
+
635
+ ### Admin
636
+ #### <a name="gethostbyip_a"></a>`getHostByIp(ip, callback?)`
637
+ Read the host object by IP address.
638
+ * `ip` *string*: - IP address, e.g., `192.168.1.1`. IPv4 or IPv6
639
+ * `callback?` *(error: string | null | Error | undefined, hostObject?: ioBroker.HostObject | null) => void*: - Callback function `(ip: string, obj: ioBroker.HostObject | null) => void`
640
+
641
+ #### <a name="requirelog_a"></a>`requireLog(isEnabled, callback?)`
642
+ Activate or deactivate logging events. Events will be sent to the socket as `log` event. Adapter must have `common.logTransporter = true`.
643
+ * `isEnabled` *boolean*: - Is logging enabled
644
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
645
+
646
+ #### <a name="readlogs_a"></a>`readLogs(host, callback?)`
647
+ Get the log files from the given host.
648
+ * `host` *string*: - Host ID, e.g., `system.host.raspberrypi`
649
+ * `callback?` *(error: string | null | Error | undefined, list?: {fileName: string; size: number}[]) => void*: - Callback function `(error: string | null, list?: { fileName: string; size: number }[]) => void`
650
+
651
+ #### <a name="cmdexec_a"></a>`cmdExec(host, id, cmd, callback?)`
652
+ Execute the shell command on host/controller.
653
+ Following response commands are expected: `cmdStdout`, `cmdStderr`, `cmdExit`.
654
+ * `host` *string*: - Host name, e.g., `system.host.raspberrypi`
655
+ * `id` *number*: - Session ID, e.g., `Date.now()`. This session ID will come in events `cmdStdout`, `cmdStderr`, `cmdExit`
656
+ * `cmd` *string*: - Command to execute
657
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
658
+
659
+ #### <a name="eventsthreshold_a"></a>`eventsThreshold(isActive)`
660
+ Enable or disable the event threshold. Used only for admin to limit the number of events to the front-end.
661
+ * `isActive` *boolean*: - If true, then events will be limited
662
+
663
+ #### <a name="getratings_a"></a>`getRatings(update, callback?)`
664
+ Get the ratings of adapters.
665
+ * `update` *boolean | ((error: string | null | Error | undefined, ratings?: Ratings) => void)*: - If true, the ratings will be read from the central server, if false from the local cache
666
+ * `callback?` *(error: string | null | Error | undefined, ratings?: Ratings) => void*: - Callback function `(error: string | null, ratings?: Ratings) => void`
667
+
668
+ #### <a name="getcurrentinstance_a"></a>`getCurrentInstance(callback)`
669
+ Get the current instance name, like "admin.0"
670
+ * `callback` *(error: string | null | Error | undefined, namespace: string) => void) => void*: - Callback function `(error: string | null, namespace?: string) => void`
671
+
672
+ #### <a name="decrypt_a"></a>`decrypt(encryptedText, callback)`
673
+ Decrypts text with the system secret key.
674
+ * `encryptedText` *string*: - Encrypted text
675
+ * `callback` *(error: string | null | Error | undefined, decryptedText?: string) => void) => void*: - Callback function `(error: string | null, decryptedText?: string) => void`
676
+
677
+ #### <a name="encrypt_a"></a>`encrypt(plainText, callback)`
678
+ Encrypts text with the system secret key.
679
+ * `plainText` *string*: - Plain text to encrypt
680
+ * `callback` *(error: string | null | Error | undefined, encryptedText?: string) => void) => void*: - Callback function `(error: string | null, encryptedText?: string) => void`
681
+
682
+ #### <a name="getiseasymodestrict_a"></a>`getIsEasyModeStrict(callback)`
683
+ Get if the admin has easy mode enabled.
684
+ * `callback` *(error: string | null | Error | undefined, isEasyModeStrict?: boolean) => void) => void*: - Callback function `(error: string | null, isEasyModeStrict?: boolean) => void`
685
+
686
+ #### <a name="geteasymode_a"></a>`getEasyMode(callback)`
687
+ Get easy mode configuration.
688
+ * `callback` *(error: string | null | Error | undefined, easyModeConfig?: {strict: boolean; configs: InstanceConfig[]}) => void*: - Callback function `(error: string | null, easyModeConfig?: { strict: boolean; configs: InstanceConfig[] }) => void`
689
+
690
+ #### <a name="getadapters_a"></a>`getAdapters(adapterName, callback)`
691
+ Get all adapter as objects.
692
+ * `adapterName` *string*: - Optional adapter name
693
+ * `callback` *(error: string | null | Error | undefined, result?: ioBroker.AdapterObject[]) => void) => void*: - Callback function `(error: string | null, results?: ioBroker.Object[]) => void`
694
+
695
+ #### <a name="updatelicenses_a"></a>`updateLicenses(login, password, callback)`
676
696
  Read software licenses (vis, knx, ...) from ioBroker.net cloud for given user
677
- * login *(string)*: cloud login
678
- * password *(string)*: cloud password
679
- * callback *(function)*: `function (error, results)`, where `results` is array of objects like `[{"json":"xxx","id":"ab","email":"dogafox@gmail.com","product":"iobroker.knx.year","version":"2","invoice":"Pxx","uuid":"uuid","time":"2021-11-16T19:53:02.000Z","validTill":"2022-11-16T22:59:59.000Z","datapoints":1000}]`
680
-
681
- ### <a name="getcompactinstances_a"></a>getCompactInstances(callback)
682
- Read all instances in short form to save bandwidth
683
- * callback *(function)*: `function (error, results)`, where `results` is an object like `{'system.adapter.javascript.0': {adminTab, name, icon, enabled}}`
684
-
685
- ### <a name="getcompactadapters_a"></a>getCompactAdapters(callback)
686
- Read all adapters in short for to save bandwidth
687
- * callback *(function)*: `function (error, results)`, where `results` is an object like `{'javascript': {icon, v: '1.0.1', iv: 'ignoredVersion}}`
688
-
689
- ### <a name="getcompactinstalled_a"></a>getCompactInstalled(host, callback)
690
- Read all installed adapters in short form to save bandwidth
691
- * callback *(function)*: `function (error, results)`, where `results` is an object like `{'javascript': {version: '1.0.1'}}``
692
-
693
- ### <a name="getcompactsystemconfig_a"></a>getCompactSystemConfig(callback)
694
- Read system config in short form to save bandwidth
695
- * callback *(function)*: `function (error, systemConfig)`, where `systemConfig` is an object like `{common: {...}, native: {secret: 'aaa'}}`
696
-
697
- ### <a name="getcompactsystemrepositories_a"></a>getCompactSystemRepositories(callback)
698
- Read repositories from cache in short form to save bandwidth
699
- * callback *(function)*: `function (error, repositories)`, where `repositories` is an object like `{_id: 'system.repositories', common: {...}, native: {repositories: {default: {json: {_repoInfo: {...}}}}}}`
700
-
701
- ### <a name="getcompactrepository_a"></a>getCompactRepository(host, callback)
702
- Read current repository in short form to save bandwidth
703
- * callback *(function)*: `function (error, repository)`, where `repository` is an object like `{'javascript': {version: '1.0.1', icon}, 'admin': {version: '1.0.1', icon}}`
704
-
705
- ### <a name="getcompacthosts_a"></a>getCompactHosts(callback)
706
- Read all hosts in short form to save bandwidth
707
- * callback *(function)*: `function (error, hosts)`, where `hosts` is an array of objects like `[{_id:'system.host.raspi',common:{name:'raspi',icon:'icon',color:'blue',installedVersion:'2.1.0'},native:{hardware:{networkInterfaces:[...]}}}]`
708
-
709
- ### <a name="adduser_a"></a>addUser(user, pass, callback)
710
- Add new user
711
- * user *(string)*: user name, like `benjamin`
712
- * pass *(string)*: user password
713
- * callback *(function)*: `function (error)`
714
-
715
- ### <a name="deluser_a"></a>delUser(user, callback)
716
- Delete existing user. Admin cannot be deleted.
717
- * user *(string)*: user name, like 'benjamin
718
- * callback *(function)*: `function (error)`
719
-
720
- ### <a name="addgroup_a"></a>addGroup(group, desc, acl, callback)
697
+ * `login` *string*: - Cloud login
698
+ * `password` *string*: - Cloud password
699
+ * `callback` *(error: string | null | Error | undefined, result?: License[]) => void) => void*: - Callback function `(error: string | null, results?: License[]) => void`
700
+
701
+ #### <a name="getcompactinstances_a"></a>`getCompactInstances(callback)`
702
+ Get all instances in a compact form to save bandwidth.
703
+ * `callback` *(error: string | null | Error | undefined, result?: Record<string, CompactInstanceInfo>) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { adminTab: boolean; name: string; icon: string; enabled: boolean }>) => void`
704
+
705
+ #### <a name="getcompactadapters_a"></a>`getCompactAdapters(callback)`
706
+ Get all adapters in a compact form to save bandwidth.
707
+ * `callback` *(error: string | null | Error | undefined, result?: Record<string, CompactAdapterInfo>) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { icon: string; v: string; iv: string }>) => void`
708
+
709
+ #### <a name="getcompactinstalled_a"></a>`getCompactInstalled(host, callback)`
710
+ Get all installed adapters in a compact form to save bandwidth.
711
+ * `host` *string*: - Host name, e.g., `system.host.raspberrypi`
712
+ * `callback` *(result?: Record<string, {version: string}>) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { version: string }>) => void`
713
+
714
+ #### <a name="getcompactsystemconfig_a"></a>`getCompactSystemConfig(callback)`
715
+ Get the system configuration in a compact form to save bandwidth.
716
+ * `callback` *(error: string | null | Error | undefined, systemConfig?: {common: ioBroker.SystemConfigCommon; native?: {secret: string}}) => void*: - Callback function `(error: string | null, systemConfig?: { common: any; native?: { secret: string } }) => void`
717
+
718
+ #### <a name="getcompactsystemrepositories_a"></a>`getCompactSystemRepositories(callback)`
719
+ Get system repositories in a compact form to save bandwidth.
720
+ * `callback` *(error: string | null | Error | undefined, systemRepositories?: CompactSystemRepository) => void) => void*: - Callback function `(error: string | null, systemRepositories?: { common: any; native?: { repositories: Record<string, { json: { _repoInfo: any } } } } }) => void`
721
+
722
+ #### <a name="getcompactrepository_a"></a>`getCompactRepository(host, callback)`
723
+ Get the repository in a compact form to save bandwidth.
724
+ * `host` *string*: - Host name, e.g., `system.host.raspberrypi`
725
+ * `callback` *(result: Record<string, {version: string; icon?: string}>) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { version: string; icon?: string }>) => void`
726
+
727
+ #### <a name="getcompacthosts_a"></a>`getCompactHosts(callback)`
728
+ Get all hosts in a compact form to save bandwidth.
729
+ * `callback` *(error: string | null | Error | undefined, hosts?: CompactHost[]) => void) => void*: - Callback function `(error: string | null, results?: Record<string, { common: { name: string; icon: string; color: string; installedVersion: string }; native: { hardware: { networkInterfaces: any[] } } }>) => void`
730
+
731
+ ### States
732
+ #### <a name="delstate_a"></a>`delState(id, callback?)`
733
+ Delete a state. The corresponding object will be deleted too.
734
+ * `id` *string*: - State ID
735
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
736
+
737
+ #### <a name="getstates_a"></a>`getStates(pattern, callback)`
738
+ Get states by pattern of current adapter
739
+ * `pattern` *string | string[] | undefined*: optional pattern, like `system.adapter.*` or array of state IDs. If the pattern is omitted, you will get ALL states of current adapter
740
+ * `callback` *(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void) => void*: callback `(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void`
741
+
742
+ #### <a name="getforeignstates_a"></a>`getForeignStates(pattern, callback)`
743
+ Same as getStates
744
+ * `pattern` *string | string[]*: pattern like `system.adapter.*` or array of state IDs
745
+ * `callback` *(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void) => void*: callback `(error: null | undefined | Error | string, states?: Record<string, ioBroker.State>) => void`
746
+
747
+ #### <a name="getstate_a"></a>`getState(id, callback)`
748
+ Get a state by ID
749
+ * `id` *string*: State ID, e.g. `system.adapter.admin.0.memRss`
750
+ * `callback` *(error: null | undefined | Error | string, state?: ioBroker.State) => void) => void*: Callback `(error: null | undefined | Error | string, state?: ioBroker.State) => void`
751
+
752
+ #### <a name="setstate_a"></a>`setState(id, state, callback)`
753
+ Set a state by ID
754
+ * `id` *string*: State ID, e.g. `system.adapter.admin.0.memRss`
755
+ * `state` *ioBroker.SettableState*: State value or object, e.g. `{val: 123, ack: true}`
756
+ * `callback` *(error: null | undefined | Error | string, state?: ioBroker.State) => void) => void*: Callback `(error: null | undefined | Error | string, state?: ioBroker.State) => void`
757
+
758
+ #### <a name="getbinarystate_a"></a>`getBinaryState(id, callback)`
759
+ Get a binary state by ID
760
+ * `id` *string*: State ID, e.g. `javascript.0.binary`
761
+ * `callback` *(error: null | undefined | Error | string, base64?: string) => void) => void*: Callback `(error: null | undefined | Error | string, base64?: string) => void`
762
+
763
+ #### <a name="setbinarystate_a"></a>`setBinaryState(id, _base64, callback)`
764
+ Set a binary state by ID
765
+ * `id` *string*: State ID, e.g. `javascript.0.binary`
766
+ * `_base64` *string*: State value as base64 string. Binary states have no acknowledged flag.
767
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
768
+
769
+ #### <a name="subscribe_a"></a>`subscribe(pattern, callback)`
770
+ Subscribe to state changes by pattern.
771
+ The events will come as 'stateChange' events to the socket.
772
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
773
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
774
+
775
+ #### <a name="subscribestates_a"></a>`subscribeStates(pattern, callback)`
776
+ Subscribe to state changes by pattern. Same as `subscribe`.
777
+ The events will come as 'stateChange' events to the socket.
778
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
779
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
780
+
781
+ #### <a name="unsubscribe_a"></a>`unsubscribe(pattern, callback)`
782
+ Unsubscribe from state changes by pattern.
783
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
784
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
785
+
786
+ #### <a name="unsubscribestates_a"></a>`unsubscribeStates(pattern, callback)`
787
+ Unsubscribe from state changes by pattern. Same as `unsubscribe`.
788
+ The events will come as 'stateChange' events to the socket.
789
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of states like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
790
+ * `callback` *(error: string | null) => void) => void*: Callback `(error: string | null) => void`
791
+
792
+ ### Users
793
+ #### <a name="adduser_a"></a>`addUser(user, pass, callback?)`
794
+ Add a new user.
795
+ * `user` *string*: - User name, e.g., `benjamin`
796
+ * `pass` *string*: - User password
797
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
798
+
799
+ #### <a name="deluser_a"></a>`delUser(user, callback?)`
800
+ Delete an existing user. Admin cannot be deleted.
801
+ * `user` *string*: - User name, e.g., `benjamin`
802
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
803
+
804
+ #### <a name="addgroup_a"></a>`addGroup(group, desc, acl, callback?)`
721
805
  Add a new group.
722
- * group *(string)*: user name, like 'benjamin
723
- * desc *(string)*: optional description
724
- * acl *(object)*: optional access control list object, like `{"object":{"list":true,"read":true,"write":false,"delete":false},"state":{"list":true,"read":true,"write":true,"create":true,"delete":false},"users":{"list":true,"read":true,"write":false,"create":false,"delete":false},"other":{"execute":false,"http":true,"sendto":false},"file":{"list":true,"read":true,"write":false,"create":false,"delete":false}}`
725
- * callback *(function)*: `function (error)`
726
-
727
- ### <a name="delgroup_a"></a>delGroup(group, callback)
728
- Delete the existing group. Administrator group cannot be deleted.
729
- * group *(string)*: group name, like 'users`
730
- * callback *(function)*: `function (error)`
731
-
732
- ### <a name="changepassword_a"></a>changePassword(user, pass, callback)
733
- Change user password
734
- * user *(string)*: user name, like 'benjamin`
735
- * pass *(string)*: new password
736
- * callback *(function)*: `function (error)`
737
-
738
- ### <a name="getobject_a"></a>getObject(id, callback)
739
- Get one object
740
- * id *(string)*: object ID.
741
- * callback *(function)*: `function (error, obj)`
742
-
743
- ### <a name="getobjects_a"></a>getObjects(list, callback)
744
- Read absolutely all objects. Same as `getAllObjects`.
745
- * list *(string[])*: optional list of IDs.
746
- * callback *(function)*: `function (error, objects)`, where `objects` is an object like `{'system.adapter.admin.0': {...}, 'system.adapter.web.0': {...}}`
747
-
748
- ### <a name="subscribeobjects_a"></a>subscribeObjects(pattern, callback)
806
+ * `group` *string*: - Group name, e.g., `users`
807
+ * `desc` *ioBroker.StringOrTranslated | null*: - Optional description
808
+ * `acl` *Omit<ioBroker.PermissionSet, 'user' | 'groups'> | null*: - Optional access control list object, e.g., `{"object":{"list":true,"read":true,"write":false,"delete":false},"state":{"list":true,"read":true,"write":true,"create":true,"delete":false},"users":{"list":true,"read":true,"write":false,"create":false,"delete":false},"other":{"execute":false,"http":true,"sendto":false},"file":{"list":true,"read":true,"write":false,"create":false,"delete":false}}`
809
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
810
+
811
+ #### <a name="delgroup_a"></a>`delGroup(group, callback?)`
812
+ Delete an existing group. Administrator group cannot be deleted.
813
+ * `group` *string*: - Group name, e.g., `users`
814
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
815
+
816
+ #### <a name="changepassword_a"></a>`changePassword(user, pass, callback?)`
817
+ Change user password.
818
+ * `user` *string*: - User name, e.g., `benjamin`
819
+ * `pass` *string*: - New password
820
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
821
+
822
+ ### Objects
823
+ #### <a name="getobject_a"></a>`getObject(id, callback)`
824
+ Get one object.
825
+ * `id` *string*: Object ID
826
+ * `callback` *(error: Error | undefined | string | null, obj?: ioBroker.Object) => void) => void*: Callback `(error: string | null, obj?: ioBroker.Object) => void`
827
+
828
+ #### <a name="getobjects_a"></a>`getObjects(list, callback)`
829
+ Get all objects that are relevant for web: all states and enums with rooms.
830
+ This is non-admin version of "all objects" and will be overloaded in admin
831
+ * `list` *string[] | null*: Optional list of IDs
832
+ * `callback` *(error: Error | undefined | string | null, objs?: Record<string, ioBroker.Object>) => void) => void*: Callback `(error: string | null, objs?: Record<string, ioBroker.Object>) => void`
833
+
834
+ #### <a name="subscribeobjects_a"></a>`subscribeObjects(pattern, callback)`
749
835
  Subscribe to object changes by pattern. The events will come as 'objectChange' events to the socket.
750
- * pattern *(string)*: pattern like 'system.adapter.*' or array of IDs like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
751
- * callback *(function)*: `function (error)`
836
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of IDs like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
837
+ * `callback` *(error: Error | undefined | string | null) => void) => void*: Callback `(error: string | null) => void`
752
838
 
753
- ### <a name="unsubscribeobjects_a"></a>unsubscribeObjects(pattern, callback)
839
+ #### <a name="unsubscribeobjects_a"></a>`unsubscribeObjects(pattern, callback)`
754
840
  Unsubscribe from object changes by pattern.
755
- * pattern *(string)*: pattern like 'system.adapter.*' or array of IDs like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
756
- * callback *(function)*: `function (error)`
757
-
758
- ### <a name="getobjectview_a"></a>getObjectView(design, search, params, callback)
759
- Make a query to the object database.
760
- * design *(string)*: 'system' or other designs like `custom`, but it must exist object `_design/custom`. Too 99,9% use `system`.
761
- * search *(string)*: object type, like `state`, `instance`, `adapter`, `host`, ...
762
- * params *(string)*: parameters for the query in form `{startkey: 'system.adapter.', endkey?: 'system.adapter.\u9999', depth?: number}`
763
- * callback *(function)*: `function (error)`
764
-
765
- ### <a name="setobject_a"></a>setObject(id, obj, callback)
766
- Set object.
767
- * id *(string)*: object ID
768
- * obj *(object)*: object itself
769
- * callback *(function)*: `function (error)`
770
-
771
- ### <a name="delobject_a"></a>delObject(id, options, callback)
772
- Delete an object or objects recursively. Objects with `dontDelete` cannot be deleted.
773
- * id *(string)*: Object ID like, 'adapterName.0.channel'
774
- * options *(string)*: `{recursive: true}`
775
- * callback *(function)*: `function (error)`
776
-
777
- ### <a name="clientsubscribe_a"></a>clientSubscribe(targetInstance, messageType, data, callback)
778
- Client informs specific instance about subscription on its messages. After subscription the socket will receive "im" messages from desired instance
779
- * targetInstance *(string)*: instance name, e.g. "cameras.0"
780
- * messageType *(string)*: message type, e.g. "startRecording/cam1"
781
- * data *(object)*: optional data object, e.g. {width: 640, height: 480}
782
- * callback *(function)*: `function (error, result)`, target instance MUST acknowledge the subscription and return some object as result
783
-
784
- ### <a name="clientunsubscribe_a"></a>clientUnsubscribe(targetInstance, messageType, callback)
785
- Client unsubscribes from specific instance's messages
786
- * targetInstance *(string)*: instance name, e.g. "cameras.0"
787
- * messageType *(string)*: message type, e.g. "startRecording/cam1"
788
- * callback *(function)*: `function (error, wasSubscribed)`, target instance MUST NOT acknowledge the un-subscription
789
-
790
- ### <a name="getallobjects_a"></a>getAllObjects(callback)
791
- Read absolutely all objects
792
- * callback *(function)*: `function (error, objects)`, where `objects` is an object like `{'system.adapter.admin.0': {...}, 'system.adapter.web.0': {...}}`
793
-
794
- ### <a name="extendobject_a"></a>extendObject(id, obj, callback)
795
- Extend the existing object
796
- * id *(string)*: object ID
797
- * obj *(object)*: new parts of the object, like `{common: {name: 'new name'}}`
798
- * callback *(function)*: `function (error)`
799
-
800
- ### <a name="getforeignobjects_a"></a>getForeignObjects(pattern, type, callback)
801
- Read objects by pattern
802
- * pattern *(string)*: pattern like `system.adapter.admin.0.*`
803
- * type *(string)*: type of objects to delete, like `state`, `channel`, `device`, `host`, `adapter`. Default - `state`
804
- * callback *(function)*: `function (error, objects)`, where `objects` is an object like `{'system.adapter.admin.0': {...}, 'system.adapter.web.0': {...}}`
805
-
806
- ### <a name="delobjects_a"></a>delObjects(id, options, callback)
807
- Delete objects recursively. Objects with `dontDelete` cannot be deleted. Same as `delObject` but with `recursive: true`.
808
- * id *(string)*: Object ID like, 'adapterName.0.channel'
809
- * options *(string)*: optional
810
- * callback *(function)*: `function (error)`
811
-
812
- ### <a name="getstates_a"></a>getStates(pattern, callback)
813
- Read states by pattern
814
- * pattern *(string)*: optional pattern, like `system.adapter.*` or array of state IDs
815
- * callback *(function)*: `function (error, states)`, where `states` is an object like `{'system.adapter.history.0': {_id: 'system.adapter.history.0', common: {name: 'history', ...}, native: {...}, 'system.adapter.history.1': {...}}}`
816
-
817
- ### <a name="getforeignstates_a"></a>getForeignStates(pattern, callback)
818
- Read all states (which might not belong to this adapter) which match the given pattern
819
- * pattern *(string)*: pattern like `system.adapter.*` or array of state IDs
820
- * callback *(function)*: `function (error)`
821
-
822
- ### <a name="getstate_a"></a>getState(id, callback)
823
- Read one state.
824
- * id *(string)*: State ID like, 'system.adapter.admin.0.memRss'
825
- * callback *(function)*: `function (error, state)`, where `state` is an object like `{val: 123, ts: 1663915537418, ack: true, from: 'system.adapter.admin.0', q: 0, lc: 1663915537418, c: 'javascript.0'}`
826
-
827
- ### <a name="setstate_a"></a>setState(id, state, callback)
828
- Write one state.
829
- * id *(string)*: State ID like, 'system.adapter.admin.0.memRss'
830
- * state *(any)*: value or object like `{val: 123, ack: true}`
831
- * callback *(function)*: `function (error, state)`, where `state` is an object like `{val: 123, ts: 1663915537418, ack: true, from: 'system.adapter.admin.0', q: 0, lc: 1663915537418, c: 'javascript.0'}`
832
-
833
- ### <a name="getbinarystate_a"></a>getBinaryState(id, callback)
834
- Read one binary state.
835
- * id *(string)*: State ID like, 'javascript.0.binary'
836
- * callback *(function)*: `function (error, base64)`
837
-
838
- ### <a name="setbinarystate_a"></a>setBinaryState(id, base64, callback)
839
- Write one binary state.
840
- * id *(string)*: State ID like, 'javascript.0.binary'
841
- * base64 *(string)*: State value as base64 string. Binary states have no acknowledged flag.
842
- * callback *(function)*: `function (error)`
843
-
844
- ### <a name="subscribe_a"></a>subscribe(pattern, callback)
845
- Subscribe to state changes by pattern. The events will come as 'stateChange' events to the socket.
846
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
847
- * callback *(function)*: `function (error)`
848
-
849
- ### <a name="subscribestates_a"></a>subscribeStates(pattern, callback)
850
- Subscribe to state changes by pattern. Same as `subscribe`. The events will come as 'stateChange' events to the socket.
851
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
852
- * callback *(function)*: `function (error)`
853
-
854
- ### <a name="unsubscribe_a"></a>unsubscribe(pattern, callback)
855
- Unsubscribe from state changes by pattern.
856
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
857
- * callback *(function)*: `function (error)`
858
-
859
- ### <a name="unsubscribestates_a"></a>unsubscribeStates(pattern, callback)
860
- Unsubscribe from state changes by pattern. Same as `unsubscribe`.
861
- * pattern *(string)*: pattern like 'system.adapter.*' or array of states like ['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']
862
- * callback *(function)*: `function (error)`
863
-
864
- ### <a name="readfile_a"></a>readFile(_adapter, fileName, callback)
865
- Read file from ioBroker DB
866
- * _adapter *(string)*: instance name, e.g. `vis.0`
867
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
868
- * callback *(function)*: `function (error, data, mimeType)`
869
-
870
- ### <a name="readfile64_a"></a>readFile64(_adapter, fileName, callback)
871
- Read file from ioBroker DB as base64 string
872
- * _adapter *(string)*: instance name, e.g. `vis.0`
873
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
874
- * callback *(function)*: `function (error, base64, mimeType)`
875
-
876
- ### <a name="writefile64_a"></a>writeFile64(_adapter, fileName, data64, options, callback)
877
- Write file into ioBroker DB as base64 string
878
- * _adapter *(string)*: instance name, e.g. `vis.0`
879
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
880
- * data64 *(string)*: file content as base64 string
881
- * options *(object)*: optional `{mode: 0x0644}`
882
- * callback *(function)*: `function (error)`
883
-
884
- ### <a name="writefile_a"></a>writeFile(_adapter, fileName, data64, options, callback)
885
- Write file into ioBroker DB as base64 string
886
- * _adapter *(string)*: instance name, e.g. `vis.0`
887
- * fileName *(string)*: file name, e.g `main/vis-views.json`
888
- * data64 *(string)*: file content as base64 string
889
- * options *(object)*: optional `{mode: 0x0644}`
890
- * callback *(function)*: `function (error)`
891
-
892
- ### <a name="unlink_a"></a>unlink(_adapter, name, callback)
841
+ * `pattern` *string | string[]*: Pattern like `system.adapter.*` or array of IDs like `['system.adapter.admin.0.memRss', 'system.adapter.admin.0.memHeapTotal']`
842
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
843
+
844
+ #### <a name="setobject_a"></a>`setObject(id, obj, callback)`
845
+ Set an object.
846
+ * `id` *string*: Object ID
847
+ * `obj` *ioBroker.Object*: Object to set
848
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
849
+
850
+ #### <a name="delobject_a"></a>`delObject(id, _options, callback)`
851
+ Delete an object. Only deletion of flot and fullcalendar objects is allowed
852
+ * `id` *string*: Object ID, like 'flot.0.myChart'
853
+ * `_options` *any*: Options for deletion. Ignored
854
+ * `callback` *(error: string | null | Error | undefined) => void) => void*: Callback `(error: string | null) => void`
855
+
856
+ #### <a name="getallobjects_a"></a>`getAllObjects(callback)`
857
+ Read absolutely all objects.
858
+ * `callback` *(error: null | undefined | Error | string, result?: Record<string, ioBroker.Object>) => void) => void*: - Callback function `(error: string | null, objects?: Record<string, ioBroker.Object>) => void`
859
+
860
+ #### <a name="extendobject_a"></a>`extendObject(id, obj, callback?)`
861
+ Extend the existing object.
862
+ * `id` *string*: - Object ID
863
+ * `obj` *Partial<ioBroker.Object>*: - New parts of the object, e.g., `{common: {name: 'new name'}}`
864
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
865
+
866
+ #### <a name="getforeignobjects_a"></a>`getForeignObjects(pattern, type, callback?)`
867
+ Read objects by pattern.
868
+ * `pattern` *string*: - Pattern like `system.adapter.admin.0.*`
869
+ * `type` * ioBroker.ObjectType | undefined | ((error: string | null | Error | undefined, objects?: Record<string, ioBroker.Object>) => void)*: - Type of objects to delete, like `state`, `channel`, `device`, `host`, `adapter`. Default - `state`
870
+ * `callback?` *(error: string | null | Error | undefined, objects?: Record<string, ioBroker.Object>) => void*: - Callback function `(error: string | null, objects?: Record<string, ioBroker.Object>) => void`
871
+
872
+ #### <a name="delobjects_a"></a>`delObjects(id, options?, callback?)`
873
+ Delete an object or objects recursively.
874
+ Objects with `dontDelete` cannot be deleted.
875
+ Same as `delObject` but with `recursive: true`.
876
+ * `id` *string*: - Object ID, like 'adapterName.0.channel'
877
+ * `options?` *ioBroker.DelObjectOptions | ((error: string | null | Error | undefined) => void) | null*: - Options for deletion.
878
+ * `callback?` *(error: string | null | Error | undefined) => void*: - Callback function `(error: string | null) => void`
879
+
880
+ ### Files
881
+ #### <a name="readfile_a"></a>`readFile(adapter, fileName, callback)`
882
+ Read a file from ioBroker DB
883
+ * `adapter` *string*: instance name, e.g. `vis.0`
884
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
885
+ * `callback` *(error: null | undefined | Error | string, data: Buffer | string, mimeType: string) => void) => void*: Callback `(error: null | undefined | Error | string, data: Buffer | string, mimeType: string) => void`
886
+
887
+ #### <a name="readfile64_a"></a>`readFile64(adapter, fileName, callback)`
888
+ Read a file from ioBroker DB as base64 string
889
+ * `adapter` *string*: instance name, e.g. `vis.0`
890
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
891
+ * `callback` *(error: null | undefined | Error | string, base64?: string, mimeType?: string) => void) => void*: Callback `(error: null | undefined | Error | string, base64: string, mimeType: string) => void`
892
+
893
+ #### <a name="writefile64_a"></a>`writeFile64(adapter, fileName, data64, options, callback?)`
894
+ Write a file into ioBroker DB as base64 string
895
+ * `adapter` *string*: instance name, e.g. `vis.0`
896
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
897
+ * `data64` *string*: file content as base64 string
898
+ * `options` *{mode?: number} | ((error: null | undefined | Error | string) => void)*: optional `{mode: 0x0644}`
899
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
900
+
901
+ #### <a name="writefile_a"></a>`writeFile(adapter, fileName, data, options, callback?)`
902
+ Write a file into ioBroker DB as text
903
+ This function is overloaded in admin (because admin accepts only base64)
904
+ * `adapter` *string*: instance name, e.g. `vis.0`
905
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
906
+ * `data` *string*: file content as text
907
+ * `options` *{mode?: number} | ((error: null | undefined | Error | string) => void)*: optional `{mode: 0x0644}`
908
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
909
+
910
+ #### <a name="unlink_a"></a>`unlink(adapter, name, callback)`
893
911
  Delete file in ioBroker DB
894
- * _adapter *(string)*: instance name, e.g. `vis.0`
895
- * name *(string)*: file name, e.g. `main/vis-views.json`
896
- * callback *(function)*: `function (error)`
897
-
898
- ### <a name="deletefile_a"></a>deleteFile(_adapter, name, callback)
899
- Delete file in ioBroker DB (same as unlink, but only for files)
900
- * _adapter *(string)*: instance name, e.g. `vis.0`
901
- * name *(string)*: file name, e.g. `main/vis-views.json`
902
- * callback *(function)*: `function (error)`
903
-
904
- ### <a name="deletefolder_a"></a>deleteFolder(_adapter, name, callback)
905
- Delete file in ioBroker DB (same as unlink, but only for folders)
906
- * _adapter *(string)*: instance name, e.g. `vis.0`
907
- * name *(string)*: folder name, e.g. `main`
908
- * callback *(function)*: `function (error)`
909
-
910
- ### <a name="renamefile_a"></a>renameFile(_adapter, oldName, newName, callback)
911
- Rename file in ioBroker DB
912
- * _adapter *(string)*: instance name, e.g. `vis.0`
913
- * oldName *(string)*: current file name, e.g. `main/vis-views.json`
914
- * newName *(string)*: new file name, e.g. `main/vis-views-new.json`
915
- * callback *(function)*: `function (error)`
916
-
917
- ### <a name="rename_a"></a>rename(_adapter, oldName, newName, callback)
912
+ * `adapter` *string*: instance name, e.g. `vis.0`
913
+ * `name` *string*: file name, e.g. `main/vis-views.json`
914
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
915
+
916
+ #### <a name="deletefile_a"></a>`deleteFile(adapter, name, callback)`
917
+ Delete a file in ioBroker DB (same as "unlink", but only for files)
918
+ * `adapter` *string*: instance name, e.g. `vis.0`
919
+ * `name` *string*: file name, e.g. `main/vis-views.json`
920
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
921
+
922
+ #### <a name="deletefolder_a"></a>`deleteFolder(adapter, name, callback)`
923
+ Delete folder in ioBroker DB (same as `unlink`, but only for folders)
924
+ * `adapter` *string*: instance name, e.g. `vis.0`
925
+ * `name` *string*: folder name, e.g. `main`
926
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
927
+
928
+ #### <a name="renamefile_a"></a>`renameFile(adapter, oldName, newName, callback)`
929
+ Rename a file in ioBroker DB
930
+ * `adapter` *string*: instance name, e.g. `vis.0`
931
+ * `oldName` *string*: current file name, e.g. `main/vis-views.json`
932
+ * `newName` *string*: new file name, e.g. `main/vis-views-new.json`
933
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
934
+
935
+ #### <a name="rename_a"></a>`rename(adapter, oldName, newName, callback)`
918
936
  Rename file or folder in ioBroker DB
919
- * _adapter *(string)*: instance name, e.g. `vis.0`
920
- * oldName *(string)*: current file name, e.g. `main/vis-views.json`
921
- * newName *(string)*: new file name, e.g. `main/vis-views-new.json`
922
- * callback *(function)*: `function (error)`
923
-
924
- ### <a name="mkdir_a"></a>mkdir(_adapter, dirName, callback)
925
- Create folder in ioBroker DB
926
- * _adapter *(string)*: instance name, e.g. `vis.0`
927
- * dirName *(string)*: desired folder name, e.g. `main`
928
- * callback *(function)*: `function (error)`
929
-
930
- ### <a name="readdir_a"></a>readDir(_adapter, dirName, options, callback)
937
+ * `adapter` *string*: instance name, e.g. `vis.0`
938
+ * `oldName` *string*: current file name, e.g. `main/vis-views.json`
939
+ * `newName` *string*: new file name, e.g. `main/vis-views-new.json`
940
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
941
+
942
+ #### <a name="mkdir_a"></a>`mkdir(adapter, dirName, callback)`
943
+ Create a folder in ioBroker DB
944
+ * `adapter` *string*: instance name, e.g. `vis.0`
945
+ * `dirName` *string*: desired folder name, e.g. `main`
946
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
947
+
948
+ #### <a name="readdir_a"></a>`readDir(adapter, dirName, options, callback?)`
931
949
  Read content of folder in ioBroker DB
932
- * _adapter *(string)*: instance name, e.g. `vis.0`
933
- * dirName *(string)*: folder name, e.g. `main`
934
- * options *(object)*: optional `{filter: '*'}` or `{filter: '*.json'}`
935
- * callback *(function)*: `function (error, files)` where `files` is an array of objects, like `{file: 'vis-views.json', isDir: false, stats: {size: 123}, modifiedAt: 1661336290090, acl: {owner: 'system.user.admin', ownerGroup: 'system.group.administrator', permissions: 1632, read: true, write: true}`
936
-
937
- ### <a name="chmodfile_a"></a>chmodFile(_adapter, fileName, options, callback)
938
- Change file mode in ioBroker DB
939
- * _adapter *(string)*: instance name, e.g. `vis.0`
940
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
941
- * options *(object)*: `{mode: 0x644}` or 0x644. The first digit is user, second group, third others. Bit 1 is `execute`, bit 2 is `write`, bit 3 is `read`
942
- * callback *(function)*: `function (error)`
943
-
944
- ### <a name="chownfile_a"></a>chownFile(_adapter, fileName, options, callback)
950
+ * `adapter` *string*: instance name, e.g. `vis.0`
951
+ * `dirName` *string*: folder name, e.g. `main`
952
+ * `options` *object | ((error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void)*: for future use
953
+ * `callback?` *(error: null | undefined | Error | string, files: ioBroker.ReadDirResult[]) => void*: Callback `(error: null | undefined | Error | string, files: Array<{file: string, isDir: boolean, stats: {size: number}, modifiedAt: number, acl: {owner: string, ownerGroup: string, permissions: number, read: boolean, write: boolean}}>) => void`
954
+
955
+ #### <a name="chmodfile_a"></a>`chmodFile(adapter, fileName, options, callback?)`
956
+ Change a file mode in ioBroker DB
957
+ * `adapter` *string*: instance name, e.g. `vis.0`
958
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
959
+ * `options` *{mode?: number}*: options `{mode: 0x644}`
960
+ * `callback?` *(error: string | Error | null | undefined) => void*: Callback `(error: string | Error | null | undefined) => void`
961
+
962
+ #### <a name="chownfile_a"></a>`chownFile(adapter, fileName, options, callback?)`
945
963
  Change file owner in ioBroker DB
946
- * _adapter *(string)*: instance name, e.g. `vis.0`
947
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
948
- * options *(object)*: `{owner: 'system.user.user', ownerGroup: ''system.group.administrator'}` or 'system.user.user'. If ownerGroup is not defined, it will be taken from owner.
949
- * callback *(function)*: `function (error)`
964
+ * `adapter` *string*: instance name, e.g. `vis.0`
965
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
966
+ * `options` *{owner: `system.user.${string}`; ownerGroup?: `system.group.${string}`}*: options `{owner: 'system.user.user', ownerGroup: 'system.group.administrator'}` or `system.user.user`. If ownerGroup is not defined, it will be taken from owner.
967
+ * `callback?` *(error: null | undefined | Error | string) => void*: Callback `(error: null | undefined | Error | string) => void`
950
968
 
951
- ### <a name="fileexists_a"></a>fileExists(_adapter, fileName, callback)
969
+ #### <a name="fileexists_a"></a>`fileExists(adapter, fileName, callback)`
952
970
  Check if the file or folder exists in ioBroker DB
953
- * _adapter *(string)*: instance name, e.g. `vis.0`
954
- * fileName *(string)*: file name, e.g. `main/vis-views.json`
955
- * callback *(function)*: `function (error, isExist)`
971
+ * `adapter` *string*: instance name, e.g. `vis.0`
972
+ * `fileName` *string*: file name, e.g. `main/vis-views.json`
973
+ * `callback` *(error: null | undefined | Error | string, exists?: boolean) => void) => void*: Callback `(error: null | undefined | Error | string, exists?: boolean) => void`
956
974
 
957
- ### <a name="subscribefiles_a"></a>subscribeFiles(id, pattern, callback)
975
+ #### <a name="subscribefiles_a"></a>`subscribeFiles(id, pattern, callback)`
958
976
  Subscribe to file changes in ioBroker DB
959
- * id *(string)*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
960
- * pattern *(string)*: file name pattern, e.g. `main/*.json`
961
- * callback *(function)*: `function (error)`
977
+ * `id` *string*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
978
+ * `pattern` *string | string[]*: file name pattern, e.g. `main/*.json` or array of names
979
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
962
980
 
963
- ### <a name="unsubscribefiles_a"></a>unsubscribeFiles(id, pattern, callback)
981
+ #### <a name="unsubscribefiles_a"></a>`unsubscribeFiles(id, pattern, callback)`
964
982
  Unsubscribe from file changes in ioBroker DB
965
- * id *(string)*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
966
- * pattern *(string)*: file name pattern, e.g. `main/*.json`
967
- * callback *(function)*: `function (error)`
968
-
969
- ### <a name="getadapterinstances_a"></a>getAdapterInstances(adapterName, callback)
970
- Read all instances of the given adapter, or all instances of all adapters if adapterName is not defined
971
- * adapterName *(string)*: optional adapter name, e.g. `history`.
972
- * callback *(function)*: `function (error, instanceList)`, where instanceList is an array of instance objects, e.g. `{_id: 'system.adapter.history.0', common: {name: 'history', ...}, native: {...}}`
983
+ * `id` *string*: instance name, e.g. `vis.0` or any object ID of type `meta`. `id` could have wildcards `*` too.
984
+ * `pattern` *string | string[]*: file name pattern, e.g. `main/*.json` or array of names
985
+ * `callback` *(error: null | undefined | Error | string) => void) => void*: Callback `(error: null | undefined | Error | string) => void`
973
986
 
974
987
  <!-- ADMIN_METHODS_END -->
975
988
 
@@ -979,6 +992,9 @@ Read all instances of the given adapter, or all instances of all adapters if ada
979
992
  -->
980
993
 
981
994
  ## Changelog
995
+ ### 2.0.0 (2025-02-07)
996
+ * (@GermanBluefox) Code migrated to TypeScript
997
+
982
998
  ### 1.6.2 (2024-12-01)
983
999
  * (@GermanBluefox) Caught the error if no authentication and logout called
984
1000
 
@@ -1138,7 +1154,7 @@ Read all instances of the given adapter, or all instances of all adapters if ada
1138
1154
  ## License
1139
1155
  The MIT License (MIT)
1140
1156
 
1141
- Copyright (c) 2020-2024 @GermanBluefox <dogafox@gmail.com>
1157
+ Copyright (c) 2020-2025 @GermanBluefox <dogafox@gmail.com>
1142
1158
 
1143
1159
  Permission is hereby granted, free of charge, to any person obtaining a copy
1144
1160
  of this software and associated documentation files (the "Software"), to deal