@iobroker/socket-classes 1.6.2 → 2.0.2
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/LICENSE +1 -1
- package/README.md +791 -775
- package/dist/index.d.ts +8 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/passportSocket.d.ts +34 -0
- package/dist/lib/passportSocket.js +91 -0
- package/dist/lib/passportSocket.js.map +1 -0
- package/dist/lib/socketAdmin.d.ts +42 -0
- package/dist/lib/socketAdmin.js +246 -0
- package/dist/lib/socketAdmin.js.map +1 -0
- package/dist/lib/socketCommands.d.ts +83 -0
- package/dist/lib/socketCommands.js +2015 -0
- package/dist/lib/socketCommands.js.map +1 -0
- package/dist/lib/socketCommandsAdmin.d.ts +145 -0
- package/dist/lib/socketCommandsAdmin.js +1586 -0
- package/dist/lib/socketCommandsAdmin.js.map +1 -0
- package/dist/lib/socketCommon.d.ts +143 -0
- package/dist/lib/socketCommon.js +521 -0
- package/dist/lib/socketCommon.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/package.json +23 -17
- package/index.js +0 -19
- package/lib/passportSocket.js +0 -105
- package/lib/socketAdmin.js +0 -203
- package/lib/socketCommands.js +0 -1886
- package/lib/socketCommandsAdmin.js +0 -1492
- package/lib/socketCommon.js +0 -480
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
|
-
* [
|
|
137
|
-
* [
|
|
138
|
-
* [
|
|
139
|
-
* [
|
|
140
|
-
* [
|
|
141
|
-
* [
|
|
142
|
-
* [
|
|
143
|
-
* [
|
|
144
|
-
* [
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
|
|
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 *
|
|
178
|
+
* `error` *Error | string*: Error object or error text
|
|
181
179
|
|
|
182
|
-
|
|
180
|
+
#### <a name="log_w"></a>`log(text, level)`
|
|
183
181
|
Write log entry into ioBroker log
|
|
184
|
-
* text *
|
|
185
|
-
* level *
|
|
182
|
+
* `text` *string*: log text
|
|
183
|
+
* `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
|
|
186
184
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* feature *
|
|
190
|
-
* callback *(
|
|
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
|
-
|
|
190
|
+
#### <a name="gethistory_w"></a>`getHistory(id, options, callback)`
|
|
193
191
|
Get history data from specific instance
|
|
194
|
-
* id *
|
|
195
|
-
* options *
|
|
196
|
-
* callback *(
|
|
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
|
-
|
|
199
|
-
Read content of HTTP(
|
|
200
|
-
* url *
|
|
201
|
-
* callback *(
|
|
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
|
-
|
|
201
|
+
#### <a name="sendto_w"></a>`sendTo(adapterInstance, command, message, callback)`
|
|
204
202
|
Send the message to specific instance
|
|
205
|
-
* adapterInstance *
|
|
206
|
-
* command *
|
|
207
|
-
* message *
|
|
208
|
-
* callback *(
|
|
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
|
-
|
|
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 *
|
|
214
|
-
* command *
|
|
215
|
-
* message *
|
|
216
|
-
* callback *(
|
|
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
|
-
|
|
216
|
+
#### <a name="authenabled_w"></a>`authEnabled(callback)`
|
|
219
217
|
Ask server is authentication enabled, and if the user authenticated
|
|
220
|
-
* callback *(
|
|
218
|
+
* `callback` *(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void) => void*: callback `(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void`
|
|
221
219
|
|
|
222
|
-
|
|
220
|
+
#### <a name="logout_w"></a>`logout(callback)`
|
|
223
221
|
Logout user
|
|
224
|
-
* callback *
|
|
222
|
+
* `callback` *ioBroker.ErrorCallback*: callback `(error?: Error) => void`
|
|
225
223
|
|
|
226
|
-
|
|
224
|
+
#### <a name="listpermissions_w"></a>`listPermissions(callback)`
|
|
227
225
|
List commands and permissions
|
|
228
|
-
* callback *(
|
|
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
|
-
|
|
228
|
+
#### <a name="getuserpermissions_w"></a>`getUserPermissions(callback)`
|
|
231
229
|
Get user permissions
|
|
232
|
-
* callback *(
|
|
230
|
+
* `callback` *(error: string | null | undefined, userPermissions?: SocketACL | null) => void) => void*: callback `(error: string | null | undefined, userPermissions?: SocketACL | null) => void`
|
|
233
231
|
|
|
234
|
-
|
|
232
|
+
#### <a name="getversion_w"></a>`getVersion(callback)`
|
|
235
233
|
Get the adapter version. Not the socket-classes version!
|
|
236
|
-
* callback *(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Get adapter name.
|
|
240
|
-
* callback *(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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 *
|
|
256
|
-
* callback *(
|
|
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
|
-
|
|
279
|
+
#### <a name="unsubscribeobjects_w"></a>`unsubscribeObjects(pattern, callback)`
|
|
259
280
|
Unsubscribe from object changes by pattern.
|
|
260
|
-
* pattern *
|
|
261
|
-
* callback *(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
*
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
*
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
*
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
*
|
|
319
|
-
|
|
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 *
|
|
340
|
-
* callback *(
|
|
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
|
-
|
|
346
|
+
#### <a name="unsubscribestates_w"></a>`unsubscribeStates(pattern, callback)`
|
|
343
347
|
Unsubscribe from state changes by pattern. Same as `unsubscribe`.
|
|
344
|
-
|
|
345
|
-
*
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
*
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
*
|
|
378
|
-
* name *
|
|
379
|
-
* callback *(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
Delete file in ioBroker DB (same as unlink, but only for files)
|
|
383
|
-
*
|
|
384
|
-
* name *
|
|
385
|
-
* callback *(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
Delete
|
|
389
|
-
*
|
|
390
|
-
* name *
|
|
391
|
-
* callback *(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
Rename file in ioBroker DB
|
|
395
|
-
*
|
|
396
|
-
* oldName *
|
|
397
|
-
* newName *
|
|
398
|
-
* callback *(
|
|
399
|
-
|
|
400
|
-
|
|
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
|
-
*
|
|
403
|
-
* oldName *
|
|
404
|
-
* newName *
|
|
405
|
-
* callback *(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
Create folder in ioBroker DB
|
|
409
|
-
*
|
|
410
|
-
* dirName *
|
|
411
|
-
* callback *(
|
|
412
|
-
|
|
413
|
-
|
|
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
|
-
*
|
|
416
|
-
* dirName *
|
|
417
|
-
* options *
|
|
418
|
-
* callback *(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Change file mode in ioBroker DB
|
|
422
|
-
*
|
|
423
|
-
* fileName *
|
|
424
|
-
* options *
|
|
425
|
-
* callback *(
|
|
426
|
-
|
|
427
|
-
|
|
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
|
-
*
|
|
430
|
-
* fileName *
|
|
431
|
-
* options *
|
|
432
|
-
* callback *(
|
|
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
|
-
|
|
441
|
+
#### <a name="fileexists_w"></a>`fileExists(adapter, fileName, callback)`
|
|
435
442
|
Check if the file or folder exists in ioBroker DB
|
|
436
|
-
*
|
|
437
|
-
* fileName *
|
|
438
|
-
* callback *(
|
|
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
|
-
|
|
447
|
+
#### <a name="subscribefiles_w"></a>`subscribeFiles(id, pattern, callback)`
|
|
441
448
|
Subscribe to file changes in ioBroker DB
|
|
442
|
-
* id *
|
|
443
|
-
* pattern *
|
|
444
|
-
* callback *(
|
|
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
|
-
|
|
453
|
+
#### <a name="unsubscribefiles_w"></a>`unsubscribeFiles(id, pattern, callback)`
|
|
447
454
|
Unsubscribe from file changes in ioBroker DB
|
|
448
|
-
* id *
|
|
449
|
-
* pattern *
|
|
450
|
-
* callback *(
|
|
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
|
-
* [
|
|
477
|
-
* [
|
|
478
|
-
* [
|
|
479
|
-
* [
|
|
480
|
-
* [
|
|
481
|
-
* [
|
|
482
|
-
* [
|
|
483
|
-
* [
|
|
484
|
-
* [
|
|
485
|
-
* [
|
|
486
|
-
* [
|
|
487
|
-
* [
|
|
488
|
-
* [
|
|
489
|
-
* [
|
|
490
|
-
* [
|
|
491
|
-
* [
|
|
492
|
-
* [
|
|
493
|
-
* [
|
|
494
|
-
* [
|
|
495
|
-
* [
|
|
496
|
-
* [
|
|
497
|
-
* [
|
|
498
|
-
* [
|
|
499
|
-
* [
|
|
500
|
-
* [
|
|
501
|
-
* [
|
|
502
|
-
* [
|
|
503
|
-
* [
|
|
504
|
-
* [
|
|
505
|
-
* [
|
|
506
|
-
* [
|
|
507
|
-
* [
|
|
508
|
-
* [
|
|
509
|
-
* [
|
|
510
|
-
* [
|
|
511
|
-
* [
|
|
512
|
-
* [
|
|
513
|
-
* [
|
|
514
|
-
* [
|
|
515
|
-
* [
|
|
516
|
-
* [
|
|
517
|
-
* [
|
|
518
|
-
* [
|
|
519
|
-
* [
|
|
520
|
-
* [
|
|
521
|
-
* [
|
|
522
|
-
* [
|
|
523
|
-
* [
|
|
524
|
-
* [
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
*
|
|
546
|
-
|
|
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 *
|
|
551
|
+
* `error` *Error | string*: Error object or error text
|
|
551
552
|
|
|
552
|
-
|
|
553
|
+
#### <a name="log_a"></a>`log(text, level)`
|
|
553
554
|
Write log entry into ioBroker log
|
|
554
|
-
* text *
|
|
555
|
-
* level *
|
|
555
|
+
* `text` *string*: log text
|
|
556
|
+
* `level` *ioBroker.LogLevel*: one of `['silly', 'debug', 'info', 'warn', 'error']`. Default is 'debug'.
|
|
556
557
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
* feature *
|
|
560
|
-
* callback *(
|
|
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
|
-
|
|
563
|
+
#### <a name="gethistory_a"></a>`getHistory(id, options, callback)`
|
|
563
564
|
Get history data from specific instance
|
|
564
|
-
* id *
|
|
565
|
-
* options *
|
|
566
|
-
* callback *(
|
|
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
|
-
|
|
569
|
-
Read content of HTTP(
|
|
570
|
-
* url *
|
|
571
|
-
* callback *(
|
|
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
|
-
|
|
574
|
+
#### <a name="sendto_a"></a>`sendTo(adapterInstance, command, message, callback)`
|
|
574
575
|
Send the message to specific instance
|
|
575
|
-
* adapterInstance *
|
|
576
|
-
* command *
|
|
577
|
-
* message *
|
|
578
|
-
* callback *(
|
|
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
|
-
|
|
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 *
|
|
584
|
-
* command *
|
|
585
|
-
* message *
|
|
586
|
-
* callback *(
|
|
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
|
-
|
|
589
|
+
#### <a name="authenabled_a"></a>`authEnabled(callback)`
|
|
589
590
|
Ask server is authentication enabled, and if the user authenticated
|
|
590
|
-
* callback *(
|
|
591
|
+
* `callback` *(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void) => void*: callback `(isUserAuthenticated: boolean | Error | string, isAuthenticationUsed: boolean) => void`
|
|
591
592
|
|
|
592
|
-
|
|
593
|
+
#### <a name="logout_a"></a>`logout(callback)`
|
|
593
594
|
Logout user
|
|
594
|
-
* callback *
|
|
595
|
+
* `callback` *ioBroker.ErrorCallback*: callback `(error?: Error) => void`
|
|
595
596
|
|
|
596
|
-
|
|
597
|
+
#### <a name="listpermissions_a"></a>`listPermissions(callback)`
|
|
597
598
|
List commands and permissions
|
|
598
|
-
* callback *(
|
|
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
|
-
|
|
601
|
+
#### <a name="getuserpermissions_a"></a>`getUserPermissions(callback)`
|
|
601
602
|
Get user permissions
|
|
602
|
-
* callback *(
|
|
603
|
+
* `callback` *(error: string | null | undefined, userPermissions?: SocketACL | null) => void) => void*: callback `(error: string | null | undefined, userPermissions?: SocketACL | null) => void`
|
|
603
604
|
|
|
604
|
-
|
|
605
|
+
#### <a name="getversion_a"></a>`getVersion(callback)`
|
|
605
606
|
Get the adapter version. Not the socket-classes version!
|
|
606
|
-
* callback *(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
Get adapter name.
|
|
610
|
-
* callback *(
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
*
|
|
620
|
-
* callback *(
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
*
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
*
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
*
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
*
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
*
|
|
674
|
-
|
|
675
|
-
|
|
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 *
|
|
678
|
-
* password *
|
|
679
|
-
* callback *(
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
* callback *(
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
* callback *(
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
*
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
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 *
|
|
723
|
-
* desc *
|
|
724
|
-
* acl *
|
|
725
|
-
* callback *(
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
Delete
|
|
729
|
-
* group *
|
|
730
|
-
* callback *(
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
Change user password
|
|
734
|
-
* user *
|
|
735
|
-
* pass *
|
|
736
|
-
* callback *(
|
|
737
|
-
|
|
738
|
-
###
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
*
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
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 *
|
|
751
|
-
* callback *(
|
|
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
|
-
|
|
839
|
+
#### <a name="unsubscribeobjects_a"></a>`unsubscribeObjects(pattern, callback)`
|
|
754
840
|
Unsubscribe from object changes by pattern.
|
|
755
|
-
* pattern *
|
|
756
|
-
* callback *(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
*
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
* callback *(
|
|
793
|
-
|
|
794
|
-
###
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
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
|
-
*
|
|
895
|
-
* name *
|
|
896
|
-
* callback *(
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
Delete file in ioBroker DB (same as unlink, but only for files)
|
|
900
|
-
*
|
|
901
|
-
* name *
|
|
902
|
-
* callback *(
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
Delete
|
|
906
|
-
*
|
|
907
|
-
* name *
|
|
908
|
-
* callback *(
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
Rename file in ioBroker DB
|
|
912
|
-
*
|
|
913
|
-
* oldName *
|
|
914
|
-
* newName *
|
|
915
|
-
* callback *(
|
|
916
|
-
|
|
917
|
-
|
|
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
|
-
*
|
|
920
|
-
* oldName *
|
|
921
|
-
* newName *
|
|
922
|
-
* callback *(
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
Create folder in ioBroker DB
|
|
926
|
-
*
|
|
927
|
-
* dirName *
|
|
928
|
-
* callback *(
|
|
929
|
-
|
|
930
|
-
|
|
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
|
-
*
|
|
933
|
-
* dirName *
|
|
934
|
-
* options *
|
|
935
|
-
* callback *(
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
Change file mode in ioBroker DB
|
|
939
|
-
*
|
|
940
|
-
* fileName *
|
|
941
|
-
* options *
|
|
942
|
-
* callback *(
|
|
943
|
-
|
|
944
|
-
|
|
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
|
-
*
|
|
947
|
-
* fileName *
|
|
948
|
-
* options *
|
|
949
|
-
* callback *(
|
|
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
|
-
|
|
969
|
+
#### <a name="fileexists_a"></a>`fileExists(adapter, fileName, callback)`
|
|
952
970
|
Check if the file or folder exists in ioBroker DB
|
|
953
|
-
*
|
|
954
|
-
* fileName *
|
|
955
|
-
* callback *(
|
|
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
|
-
|
|
975
|
+
#### <a name="subscribefiles_a"></a>`subscribeFiles(id, pattern, callback)`
|
|
958
976
|
Subscribe to file changes in ioBroker DB
|
|
959
|
-
* id *
|
|
960
|
-
* pattern *
|
|
961
|
-
* callback *(
|
|
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
|
-
|
|
981
|
+
#### <a name="unsubscribefiles_a"></a>`unsubscribeFiles(id, pattern, callback)`
|
|
964
982
|
Unsubscribe from file changes in ioBroker DB
|
|
965
|
-
* id *
|
|
966
|
-
* pattern *
|
|
967
|
-
* callback *(
|
|
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,11 +992,14 @@ 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.2 (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
|
|
|
985
1001
|
### 1.6.1 (2024-10-05)
|
|
986
|
-
* (@GermanBluefox) Added support
|
|
1002
|
+
* (@GermanBluefox) Added support for iobroker.SocketIO with TypeScript
|
|
987
1003
|
|
|
988
1004
|
### 1.5.6 (2024-06-26)
|
|
989
1005
|
* (@GermanBluefox) Corrected call of getObjectView with null parameter
|
|
@@ -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-
|
|
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
|