@iobroker/js-controller-adapter 7.2.3 → 8.0.0-alpha.1-20260921-e5941ca8a

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.
Files changed (101) hide show
  1. package/build/cjs/index.d.ts +0 -1
  2. package/build/cjs/index.js +5 -8
  3. package/build/cjs/index.js.map +2 -2
  4. package/build/cjs/lib/_Types.d.ts +394 -63
  5. package/build/cjs/lib/adapter/adapter.d.ts +1818 -177
  6. package/build/cjs/lib/adapter/adapter.js +715 -1035
  7. package/build/cjs/lib/adapter/adapter.js.map +2 -2
  8. package/build/cjs/lib/adapter/asyncAdapter.d.ts +124 -0
  9. package/build/cjs/lib/adapter/asyncAdapter.js +184 -0
  10. package/build/cjs/lib/adapter/asyncAdapter.js.map +7 -0
  11. package/build/cjs/lib/adapter/context.d.ts +34 -0
  12. package/build/cjs/lib/adapter/context.js +17 -0
  13. package/build/cjs/lib/adapter/context.js.map +7 -0
  14. package/build/cjs/lib/adapter/defaultObjs.d.ts +5 -0
  15. package/build/cjs/lib/adapter/defaultObjs.js +2 -0
  16. package/build/cjs/lib/adapter/defaultObjs.js.map +2 -2
  17. package/build/cjs/lib/adapter/log.d.ts +25 -0
  18. package/build/cjs/lib/adapter/log.js +29 -0
  19. package/build/cjs/lib/adapter/log.js.map +2 -2
  20. package/build/cjs/lib/adapter/managers/AdapterContextBase.d.ts +49 -0
  21. package/build/cjs/lib/adapter/managers/AdapterContextBase.js +98 -0
  22. package/build/cjs/lib/adapter/managers/AdapterContextBase.js.map +7 -0
  23. package/build/cjs/lib/adapter/managers/AliasManager.d.ts +103 -0
  24. package/build/cjs/lib/adapter/managers/AliasManager.js +293 -0
  25. package/build/cjs/lib/adapter/managers/AliasManager.js.map +7 -0
  26. package/build/cjs/lib/adapter/managers/CertificateManager.d.ts +50 -0
  27. package/build/cjs/lib/adapter/managers/CertificateManager.js +174 -0
  28. package/build/cjs/lib/adapter/managers/CertificateManager.js.map +7 -0
  29. package/build/cjs/lib/adapter/managers/MessagingManager.d.ts +58 -0
  30. package/build/cjs/lib/adapter/managers/MessagingManager.js +289 -0
  31. package/build/cjs/lib/adapter/managers/MessagingManager.js.map +7 -0
  32. package/build/cjs/lib/adapter/managers/SubscriptionManager.d.ts +107 -0
  33. package/build/cjs/lib/adapter/managers/SubscriptionManager.js +349 -0
  34. package/build/cjs/lib/adapter/managers/SubscriptionManager.js.map +7 -0
  35. package/build/cjs/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  36. package/build/cjs/lib/adapter/userInterfaceMessagingController.js +9 -2
  37. package/build/cjs/lib/adapter/userInterfaceMessagingController.js.map +2 -2
  38. package/build/cjs/lib/adapter/utils.js +15 -1
  39. package/build/cjs/lib/adapter/utils.js.map +2 -2
  40. package/build/cjs/lib/adapter/validator.d.ts +10 -5
  41. package/build/cjs/lib/adapter/validator.js +6 -5
  42. package/build/cjs/lib/adapter/validator.js.map +2 -2
  43. package/build/esm/index.d.ts +0 -1
  44. package/build/esm/index.d.ts.map +1 -1
  45. package/build/esm/index.js +0 -1
  46. package/build/esm/index.js.map +1 -1
  47. package/build/esm/lib/_Types.d.ts +394 -63
  48. package/build/esm/lib/_Types.d.ts.map +1 -1
  49. package/build/esm/lib/adapter/adapter.d.ts +1818 -177
  50. package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
  51. package/build/esm/lib/adapter/adapter.js +827 -1215
  52. package/build/esm/lib/adapter/adapter.js.map +1 -1
  53. package/build/esm/lib/adapter/asyncAdapter.d.ts +124 -0
  54. package/build/esm/lib/adapter/asyncAdapter.d.ts.map +1 -0
  55. package/build/esm/lib/adapter/asyncAdapter.js +157 -0
  56. package/build/esm/lib/adapter/asyncAdapter.js.map +1 -0
  57. package/build/esm/lib/adapter/context.d.ts +34 -0
  58. package/build/esm/lib/adapter/context.d.ts.map +1 -0
  59. package/build/esm/lib/adapter/context.js +2 -0
  60. package/build/esm/lib/adapter/context.js.map +1 -0
  61. package/build/esm/lib/adapter/defaultObjs.d.ts +5 -0
  62. package/build/esm/lib/adapter/defaultObjs.d.ts.map +1 -1
  63. package/build/esm/lib/adapter/defaultObjs.js +5 -0
  64. package/build/esm/lib/adapter/defaultObjs.js.map +1 -1
  65. package/build/esm/lib/adapter/log.d.ts +25 -0
  66. package/build/esm/lib/adapter/log.d.ts.map +1 -1
  67. package/build/esm/lib/adapter/log.js +25 -0
  68. package/build/esm/lib/adapter/log.js.map +1 -1
  69. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts +49 -0
  70. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts.map +1 -0
  71. package/build/esm/lib/adapter/managers/AdapterContextBase.js +77 -0
  72. package/build/esm/lib/adapter/managers/AdapterContextBase.js.map +1 -0
  73. package/build/esm/lib/adapter/managers/AliasManager.d.ts +103 -0
  74. package/build/esm/lib/adapter/managers/AliasManager.d.ts.map +1 -0
  75. package/build/esm/lib/adapter/managers/AliasManager.js +269 -0
  76. package/build/esm/lib/adapter/managers/AliasManager.js.map +1 -0
  77. package/build/esm/lib/adapter/managers/CertificateManager.d.ts +50 -0
  78. package/build/esm/lib/adapter/managers/CertificateManager.d.ts.map +1 -0
  79. package/build/esm/lib/adapter/managers/CertificateManager.js +142 -0
  80. package/build/esm/lib/adapter/managers/CertificateManager.js.map +1 -0
  81. package/build/esm/lib/adapter/managers/MessagingManager.d.ts +58 -0
  82. package/build/esm/lib/adapter/managers/MessagingManager.d.ts.map +1 -0
  83. package/build/esm/lib/adapter/managers/MessagingManager.js +267 -0
  84. package/build/esm/lib/adapter/managers/MessagingManager.js.map +1 -0
  85. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts +107 -0
  86. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts.map +1 -0
  87. package/build/esm/lib/adapter/managers/SubscriptionManager.js +374 -0
  88. package/build/esm/lib/adapter/managers/SubscriptionManager.js.map +1 -0
  89. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  90. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts.map +1 -1
  91. package/build/esm/lib/adapter/userInterfaceMessagingController.js +8 -2
  92. package/build/esm/lib/adapter/userInterfaceMessagingController.js.map +1 -1
  93. package/build/esm/lib/adapter/utils.d.ts.map +1 -1
  94. package/build/esm/lib/adapter/utils.js +1 -1
  95. package/build/esm/lib/adapter/utils.js.map +1 -1
  96. package/build/esm/lib/adapter/validator.d.ts +10 -5
  97. package/build/esm/lib/adapter/validator.d.ts.map +1 -1
  98. package/build/esm/lib/adapter/validator.js +8 -5
  99. package/build/esm/lib/adapter/validator.js.map +1 -1
  100. package/build/tsconfig.build.tsbuildinfo +1 -1
  101. package/package.json +25 -20
@@ -2,20 +2,28 @@ import { EventEmitter } from 'node:events';
2
2
  import type { CommandResult } from '@alcalzone/pak';
3
3
  import { Log } from '../../lib/adapter/log.js';
4
4
  import { STATE_QUALITY } from '../../lib/adapter/constants.js';
5
- import type { AdapterOptions, CalculatePermissionsCallback, CheckGroupCallback, CheckPasswordCallback, CommandsPermissions, GetCertificatesCallback, GetCertificatesPromiseReturnType, GetEncryptedConfigCallback, GetUserGroupsOptions, InstallNodeModuleOptions, MaybePromise, NotificationOptions, Pattern, SendToOptions, SendToUserInterfaceClientOptions, StopParameters, TimeoutCallback } from '../../lib/_Types.js';
5
+ import type { AdapterOptions, CalculatePermissionsCallback, CheckGroupCallback, CheckPasswordCallback, CommandsPermissions, GetCertificatesCallback, GetCertificatesPromiseReturnType, GetEncryptedConfigCallback, InstallNodeModuleOptions, MaybePromise, NotificationOptions, Pattern, SendToOptions, SendToUserInterfaceClientOptions, StopParameters, SuitableLicense, TimeoutCallback } from '../../lib/_Types.js';
6
6
  /**
7
7
  * Here we define dynamically created methods
8
8
  */
9
9
  export interface AdapterClass {
10
+ /** Listen for state changes */
10
11
  on(event: 'stateChange', listener: ioBroker.StateChangeHandler): this;
12
+ /** Listen for object changes */
11
13
  on(event: 'objectChange', listener: ioBroker.ObjectChangeHandler): this;
14
+ /** Listen for file changes */
12
15
  on(event: 'fileChange', listener: ioBroker.FileChangeHandler): this;
16
+ /** Emitted when the adapter is ready */
13
17
  on(event: 'ready', listener: ioBroker.ReadyHandler): this;
18
+ /** Emitted when the adapter is installed */
14
19
  on(event: 'install', listener: ioBroker.ReadyHandler): this;
20
+ /** Emitted when the adapter is unloaded */
15
21
  on(event: 'unload', listener: ioBroker.UnloadHandler): this;
22
+ /** Emitted when a message is received */
16
23
  on(event: 'message', listener: ioBroker.MessageHandler): this;
17
24
  /** Only emitted for compact instances */
18
25
  on(event: 'exit', listener: (exitCode: number, reason: string) => Promise<void> | void): this;
26
+ /** Emitted on a new log message */
19
27
  on(event: 'log', listener: (message: ioBroker.LogMessage) => Promise<void> | void): this;
20
28
  /**
21
29
  * Extend an object and create it if it might not exist
@@ -38,61 +46,121 @@ export interface AdapterClass {
38
46
  /** Returns a list of objects with id between params.startkey and params.endkey */
39
47
  getObjectListAsync(params: ioBroker.GetObjectListParams | null, options?: {
40
48
  sorted?: boolean;
41
- } | Record<string, any>): ioBroker.GetObjectListPromise;
49
+ user?: ioBroker.ObjectIDs.User;
50
+ } | null): ioBroker.GetObjectListPromise;
42
51
  /** Returns the enum tree, filtered by the optional enum name */
43
- getEnumAsync(name: string, options?: unknown): Promise<{
44
- result: Record<string, any>;
52
+ getEnumAsync(name: string, options?: {
53
+ user?: ioBroker.ObjectIDs.User;
54
+ } | null): Promise<{
55
+ result: Record<string, ioBroker.EnumObject>;
45
56
  requestEnum: string;
46
57
  }>;
47
58
  /** Returns the enum tree, filtered by the optional enum name */
48
- getEnumsAsync(enumList?: ioBroker.EnumList, options?: unknown): ioBroker.GetEnumsPromise;
59
+ getEnumsAsync(enumList?: ioBroker.EnumList, options?: {
60
+ user?: ioBroker.ObjectIDs.User;
61
+ } | null): ioBroker.GetEnumsPromise;
49
62
  /** Deletes an object from the object db */
50
63
  delObjectAsync(id: string, options?: ioBroker.DelObjectOptions): Promise<void>;
51
64
  /** Deletes an object (which might not belong to this adapter) from the object db */
52
65
  delForeignObjectAsync(id: string, options?: ioBroker.DelObjectOptions): Promise<void>;
53
66
  /** Subscribe to changes of objects in this instance */
54
- subscribeObjectsAsync(pattern: string, options?: unknown): Promise<void>;
67
+ subscribeObjectsAsync(pattern: string, options?: {
68
+ user?: ioBroker.ObjectIDs.User;
69
+ } | null): Promise<void>;
55
70
  /** Unsubscribe from changes of objects in this instance */
56
- unsubscribeObjectsAsync(pattern: string, options?: unknown): Promise<void>;
71
+ unsubscribeObjectsAsync(pattern: string, options?: {
72
+ user?: ioBroker.ObjectIDs.User;
73
+ } | null): Promise<void>;
57
74
  /** Read a value from the states DB. */
58
- getStateAsync(id: string, options?: unknown): ioBroker.GetStatePromise;
75
+ getStateAsync(id: string, options?: {
76
+ user?: ioBroker.ObjectIDs.User;
77
+ } | null): ioBroker.GetStatePromise;
59
78
  /** Subscribe to changes of objects (which might not belong to this adapter) */
60
- subscribeForeignObjectsAsync(pattern: string | string[], options?: unknown): Promise<void>;
79
+ subscribeForeignObjectsAsync(pattern: string | string[], options?: {
80
+ user?: ioBroker.ObjectIDs.User;
81
+ } | null): Promise<void>;
61
82
  /** Unsubscribe from changes of objects (which might not belong to this adapter) */
62
- unsubscribeForeignObjectsAsync(pattern: string | string[], options?: unknown): Promise<void>;
83
+ unsubscribeForeignObjectsAsync(pattern: string | string[], options?: {
84
+ user?: ioBroker.ObjectIDs.User;
85
+ } | null): Promise<void>;
63
86
  /** Creates an object in the object db. Existing objects are not overwritten. */
64
- setObjectNotExistsAsync(id: string, obj: ioBroker.SettableObject, options?: unknown): ioBroker.SetObjectPromise;
87
+ setObjectNotExistsAsync(id: string, obj: ioBroker.SettableObject, options?: {
88
+ user?: ioBroker.ObjectIDs.User;
89
+ } | null): ioBroker.SetObjectPromise;
65
90
  /** Creates an object (which might not belong to this adapter) in the object db. Existing objects are not overwritten. */
66
- setForeignObjectNotExistsAsync<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: unknown): ioBroker.SetObjectPromise;
91
+ setForeignObjectNotExistsAsync<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: {
92
+ user?: ioBroker.ObjectIDs.User;
93
+ } | null): ioBroker.SetObjectPromise;
67
94
  /** deletes a device, its channels and states */
68
95
  deleteDeviceAsync(deviceName: string, options?: unknown): Promise<void>;
69
- addChannelToEnumAsync(enumName: string, addTo: string, parentDevice: string, channelName: string, options?: unknown): Promise<void>;
70
- deleteChannelFromEnumAsync(enumName: string, parentDevice: string, channelName: string, options?: unknown): Promise<void>;
96
+ /** Adds a channel to an enum */
97
+ addChannelToEnumAsync(enumName: string, addTo: string, parentDevice: string, channelName: string, options?: {
98
+ user?: ioBroker.ObjectIDs.User;
99
+ } | null): Promise<void>;
100
+ /** Removes a channel from an enum */
101
+ deleteChannelFromEnumAsync(enumName: string, parentDevice: string, channelName: string, options?: {
102
+ user?: ioBroker.ObjectIDs.User;
103
+ } | null): Promise<void>;
71
104
  /** Returns a list of all devices in this adapter instance */
72
- getDevicesAsync(options?: unknown): Promise<ioBroker.DeviceObject[]>;
73
- addStateToEnumAsync(enumName: string, addTo: string, parentDevice: string, parentChannel: string, stateName: string, options?: unknown): Promise<void>;
74
- deleteStateFromEnumAsync(enumName: string, parentDevice: string, parentChannel: string, stateName: string, options?: unknown): Promise<void>;
105
+ getDevicesAsync(options?: {
106
+ user?: ioBroker.ObjectIDs.User;
107
+ } | null): Promise<ioBroker.DeviceObject[]>;
108
+ /** Adds a state to an enum */
109
+ addStateToEnumAsync(enumName: string, addTo: string, parentDevice: string, parentChannel: string, stateName: string, options?: {
110
+ user?: ioBroker.ObjectIDs.User;
111
+ } | null): Promise<void>;
112
+ /** Removes a state from an enum */
113
+ deleteStateFromEnumAsync(enumName: string, parentDevice: string, parentChannel: string, stateName: string, options?: {
114
+ user?: ioBroker.ObjectIDs.User;
115
+ } | null): Promise<void>;
75
116
  /** Changes access rights of all files in the adapter directory */
76
117
  chmodFileAsync(adapter: string | null, path: string, options: {
77
118
  mode: number | string;
78
- } | Record<string, any>): Promise<{
119
+ user?: ioBroker.ObjectIDs.User;
120
+ }): Promise<{
79
121
  entries: ioBroker.ChownFileResult[];
80
122
  id: string;
81
123
  }>;
124
+ /** Changes the owner of all files in the adapter directory */
82
125
  chownFileAsync(...args: any[]): Promise<any>;
83
126
  /** reads the content of directory from DB for given adapter and path */
84
- readDirAsync(adapterName: string | null, path: string, options?: unknown): ioBroker.ReadDirPromise;
127
+ readDirAsync(adapterName: string | null, path: string, options?: {
128
+ user?: ioBroker.ObjectIDs.User;
129
+ } | null): ioBroker.ReadDirPromise;
85
130
  /** Deletes a given file */
86
- unlinkAsync(adapterName: string | null, path: string, options?: unknown): Promise<void>;
131
+ unlinkAsync(adapterName: string | null, path: string, options?: {
132
+ user?: ioBroker.ObjectIDs.User;
133
+ } | null): Promise<void>;
87
134
  /** Deletes a given file */
88
- delFileAsync(adapterName: string | null, path: string, options?: unknown): Promise<void>;
89
- renameAsync(adapterName: string | null, oldName: string, newName: string, options?: unknown): Promise<void>;
90
- mkdirAsync(adapterName: string | null, path: string, options?: unknown): Promise<void>;
135
+ delFileAsync(adapterName: string | null, path: string, options?: {
136
+ user?: ioBroker.ObjectIDs.User;
137
+ } | null): Promise<void>;
138
+ /** Renames a file in the DB */
139
+ renameAsync(adapterName: string | null, oldName: string, newName: string, options?: {
140
+ user?: ioBroker.ObjectIDs.User;
141
+ } | null): Promise<void>;
142
+ /** Creates a directory in the DB */
143
+ mkdirAsync(adapterName: string | null, path: string, options?: {
144
+ user?: ioBroker.ObjectIDs.User;
145
+ owner?: ioBroker.ObjectIDs.User;
146
+ ownerGroup?: ioBroker.ObjectIDs.Group;
147
+ } | null): Promise<void>;
91
148
  /** reads the content of directory from DB for given adapter and path */
92
- readFileAsync(adapterName: string | null, path: string, options?: unknown): ioBroker.ReadFilePromise;
93
- writeFileAsync(adapterName: string | null, path: string, data: Buffer | string, options?: unknown): Promise<void>;
149
+ readFileAsync(adapterName: string | null, path: string, options?: {
150
+ user?: ioBroker.ObjectIDs.User;
151
+ } | null): ioBroker.ReadFilePromise;
152
+ /** Writes a file into the DB */
153
+ writeFileAsync(adapterName: string | null, path: string, data: Buffer | string, options?: {
154
+ virtualFile?: boolean;
155
+ user?: ioBroker.ObjectIDs.User;
156
+ group?: ioBroker.ObjectIDs.Group;
157
+ mode?: number;
158
+ mimeType?: string;
159
+ } | null): Promise<void>;
94
160
  /** Checks if a file exists in the DB */
95
- fileExistsAsync(adapterName: string | null, path: string, options?: unknown): Promise<boolean>;
161
+ fileExistsAsync(adapterName: string | null, path: string, options?: {
162
+ user?: ioBroker.ObjectIDs.User;
163
+ } | null): Promise<boolean>;
96
164
  /** Read historian data for states of any instance or system state. */
97
165
  getHistoryAsync(id: string, options?: ioBroker.GetHistoryOptions): Promise<{
98
166
  result?: ioBroker.GetHistoryResult;
@@ -100,79 +168,181 @@ export interface AdapterClass {
100
168
  sessionId?: number;
101
169
  }>;
102
170
  /** Deletes a state from the states DB, but not the associated object. Consider using deleteState instead */
103
- delStateAsync(id: string, options?: unknown): Promise<void>;
171
+ delStateAsync(id: string, options?: {
172
+ user?: ioBroker.ObjectIDs.User;
173
+ } | null): Promise<void>;
104
174
  /** Deletes a state from the states DB, but not the associated object */
105
- delForeignStateAsync(id: string, options?: unknown): Promise<void>;
175
+ delForeignStateAsync(id: string, options?: {
176
+ user?: ioBroker.ObjectIDs.User;
177
+ } | null): Promise<void>;
106
178
  /** Read all states of this adapter that match the given pattern */
107
- getStatesAsync(pattern: string, options?: unknown): ioBroker.GetStatesPromise;
179
+ getStatesAsync(pattern: string, options?: {
180
+ user?: ioBroker.ObjectIDs.User;
181
+ } | null): ioBroker.GetStatesPromise;
108
182
  /** Read all states (which might not belong to this adapter) which match the given pattern */
109
- getForeignStatesAsync(pattern: Pattern, options?: unknown): ioBroker.GetStatesPromise;
183
+ getForeignStatesAsync(pattern: Pattern, options?: {
184
+ user?: ioBroker.ObjectIDs.User;
185
+ } | null): ioBroker.GetStatesPromise;
110
186
  /** Subscribe to changes of states (which might not belong to this adapter) */
111
- subscribeForeignStatesAsync(pattern: string | string[], options?: unknown): Promise<void>;
187
+ subscribeForeignStatesAsync(pattern: string | string[], options?: {
188
+ user?: ioBroker.ObjectIDs.User;
189
+ } | null): Promise<void>;
112
190
  /** Subscribe from changes of states (which might not belong to this adapter) */
113
- unsubscribeForeignStatesAsync(pattern: string | string[], options?: unknown): Promise<void>;
191
+ unsubscribeForeignStatesAsync(pattern: string | string[], options?: {
192
+ user?: ioBroker.ObjectIDs.User;
193
+ } | null): Promise<void>;
114
194
  /** Subscribe to changes of states in this instance */
115
- subscribeStatesAsync(pattern: Pattern, options?: unknown): Promise<void>;
195
+ subscribeStatesAsync(pattern: Pattern, options?: {
196
+ user?: ioBroker.ObjectIDs.User;
197
+ } | null): Promise<void>;
116
198
  /** Subscribe from changes of states in this instance */
117
- unsubscribeStatesAsync(pattern: Pattern, options?: unknown): Promise<void>;
199
+ unsubscribeStatesAsync(pattern: Pattern, options?: {
200
+ user?: ioBroker.ObjectIDs.User;
201
+ } | null): Promise<void>;
118
202
  /**
119
203
  * Helper function that looks for the first free TCP port starting with the given one.
120
204
  */
121
205
  getPortAsync(port: number): Promise<number>;
122
206
  /** Read a value (which might not belong to this adapter) from the state's DB. */
123
- getForeignStateAsync(id: string, options?: unknown): ioBroker.GetStatePromise;
207
+ getForeignStateAsync(id: string, options?: {
208
+ user?: ioBroker.ObjectIDs.User;
209
+ } | null): ioBroker.GetStatePromise;
124
210
  /** Validates username and password */
125
- checkPasswordAsync(user: string, password: string, options?: unknown): Promise<[isPasswordCorrect: boolean, user: `system.user.${string}`]>;
211
+ checkPasswordAsync(user: string, password: string, options?: {
212
+ user?: ioBroker.ObjectIDs.User;
213
+ } | null): Promise<[isPasswordCorrect: boolean, user: `system.user.${string}`]>;
126
214
  /** Sets a new password for the given user */
127
- setPasswordAsync(user: string, password: string, options?: unknown): Promise<void>;
215
+ setPasswordAsync(user: string, password: string, options?: {
216
+ user?: ioBroker.ObjectIDs.User;
217
+ } | null): Promise<void>;
128
218
  /** <INTERNAL> Checks if a user exists and is in the given group. */
129
- checkGroupAsync(user: string, group: string, options?: unknown): Promise<boolean>;
219
+ checkGroupAsync(user: string, group: string, options?: {
220
+ user?: ioBroker.ObjectIDs.User;
221
+ } | null): Promise<boolean>;
130
222
  /** <INTERNAL> Determines the users permissions */
131
- calculatePermissionsAsync(user: string, commandsPermissions: CommandsPermissions, options?: unknown): Promise<ioBroker.PermissionSet>;
223
+ calculatePermissionsAsync(user: string, commandsPermissions: CommandsPermissions, options?: {
224
+ user?: ioBroker.ObjectIDs.User;
225
+ } | null): Promise<ioBroker.PermissionSet>;
132
226
  /**
133
227
  * Creates or overwrites an object in the object db
134
228
  *
135
229
  * @deprecated use `adapter.setObject` without a callback instead
136
230
  */
137
- setObjectAsync(id: string, obj: ioBroker.SettableObject, options?: unknown): ioBroker.SetObjectPromise;
231
+ setObjectAsync(id: string, obj: ioBroker.SettableObject, options?: {
232
+ user?: ioBroker.ObjectIDs.User;
233
+ } | null): ioBroker.SetObjectPromise;
138
234
  /**
139
235
  * Creates or overwrites an object (which might not belong to this adapter) in the object db
140
236
  *
141
237
  * @deprecated use `adapter.setForeignObject` without a callback instead
142
238
  */
143
- setForeignObjectAsync<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: unknown): ioBroker.SetObjectPromise;
239
+ setForeignObjectAsync<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: {
240
+ user?: ioBroker.ObjectIDs.User;
241
+ } | null): ioBroker.SetObjectPromise;
242
+ /**
243
+ * Get the certificates of the system.
244
+ *
245
+ * @param publicName name of the public certificate
246
+ * @param privateName name of the private key
247
+ * @param chainedName name of the chained certificate
248
+ */
144
249
  getCertificatesAsync(publicName?: string, privateName?: string, chainedName?: string): Promise<GetCertificatesPromiseReturnType>;
145
250
  /** Get all states, channels, devices and folders of this adapter */
146
251
  getAdapterObjectsAsync(): Promise<Record<string, ioBroker.AdapterScopedObject>>;
147
252
  /** Reads an object (which might not belong to this adapter) from the object db*/
148
- getForeignObjectAsync<T extends string>(id: T, options?: unknown): ioBroker.GetObjectPromise<T>;
253
+ getForeignObjectAsync<T extends string>(id: T, options?: {
254
+ user?: ioBroker.ObjectIDs.User;
255
+ } | null): ioBroker.GetObjectPromise<T>;
149
256
  /**
150
257
  * Writes a value (which might not belong to this adapter) into the states DB only if it has changed.
151
258
  */
152
259
  setForeignStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack?: boolean): ioBroker.SetStateChangedPromise;
153
- setForeignStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: unknown): ioBroker.SetStateChangedPromise;
154
- setForeignStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown): ioBroker.SetStateChangedPromise;
260
+ /**
261
+ * Writes a value (which might not belong to this adapter) into the states DB only if it has changed.
262
+ *
263
+ * @param id object ID of the state
264
+ * @param state simple value or object with attributes
265
+ * @param options optional user context
266
+ */
267
+ setForeignStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
268
+ user?: ioBroker.ObjectIDs.User;
269
+ } | null): ioBroker.SetStateChangedPromise;
270
+ /**
271
+ * Writes a value (which might not belong to this adapter) into the states DB only if it has changed.
272
+ *
273
+ * @param id object ID of the state
274
+ * @param state simple value or object with attributes
275
+ * @param ack is command(false) or status(true)
276
+ * @param options optional user context
277
+ */
278
+ setForeignStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
279
+ user?: ioBroker.ObjectIDs.User;
280
+ } | null): ioBroker.SetStateChangedPromise;
155
281
  /**
156
282
  * Writes a value into the states DB only if it has changed.
157
283
  */
158
284
  setStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack?: boolean): ioBroker.SetStateChangedPromise;
159
- setStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: unknown): ioBroker.SetStateChangedPromise;
160
- setStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown): ioBroker.SetStateChangedPromise;
285
+ /**
286
+ * Writes a value into the states DB only if it has changed.
287
+ *
288
+ * @param id object ID of the state
289
+ * @param state simple value or object with attributes
290
+ * @param options optional user context
291
+ */
292
+ setStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
293
+ user?: ioBroker.ObjectIDs.User;
294
+ } | null): ioBroker.SetStateChangedPromise;
295
+ /**
296
+ * Writes a value into the states DB only if it has changed.
297
+ *
298
+ * @param id object ID of the state
299
+ * @param state simple value or object with attributes
300
+ * @param ack is command(false) or status(true)
301
+ * @param options optional user context
302
+ */
303
+ setStateChangedAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
304
+ user?: ioBroker.ObjectIDs.User;
305
+ } | null): ioBroker.SetStateChangedPromise;
161
306
  /**
162
307
  * Sends a message to a specific host or all hosts.
163
308
  */
164
- sendToHostAsync(hostName: string, message: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
165
- sendToHostAsync(hostName: string, command: string, message: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
309
+ sendToHostAsync(hostName: string, message: ioBroker.MessagePayload): Promise<ioBroker.MessagePayload>;
310
+ /**
311
+ * Sends a message to a specific host or all hosts.
312
+ *
313
+ * @param hostName name of the host
314
+ * @param command command name
315
+ * @param message message to send
316
+ */
317
+ sendToHostAsync(hostName: string, command: string, message: ioBroker.MessagePayload): Promise<ioBroker.MessagePayload>;
166
318
  /**
167
319
  * Sends a message to a specific instance or all instances of some specific adapter.
168
320
  */
169
- sendToAsync(instanceName: string, message: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
170
- sendToAsync(instanceName: string, command: string, message: ioBroker.MessagePayload, options?: SendToOptions): Promise<ioBroker.Message | undefined>;
321
+ sendToAsync(instanceName: string, message: ioBroker.MessagePayload): Promise<ioBroker.MessagePayload>;
322
+ /**
323
+ * Sends a message to a specific instance or all instances of some specific adapter.
324
+ *
325
+ * @param instanceName name of the instance
326
+ * @param command command name
327
+ * @param message message to send
328
+ * @param options optional options to control the send behaviour
329
+ */
330
+ sendToAsync(instanceName: string, command: string, message: ioBroker.MessagePayload, options?: SendToOptions): Promise<ioBroker.MessagePayload>;
171
331
  /**
172
332
  * Deletes a given file
173
333
  */
174
334
  delFile(adapterName: string | null, path: string, callback: ioBroker.ErrnoCallback): void;
175
- delFile(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ErrnoCallback): void;
335
+ /**
336
+ * Deletes a given file
337
+ *
338
+ * @param adapterName adapter name, or null for the current adapter
339
+ * @param path path to the file
340
+ * @param options optional user context
341
+ * @param callback return result
342
+ */
343
+ delFile(adapterName: string | null, path: string, options: {
344
+ user?: ioBroker.ObjectIDs.User;
345
+ } | null | undefined, callback: ioBroker.ErrnoCallback): void;
176
346
  /**
177
347
  * Writes a value into the states DB.
178
348
  *
@@ -180,21 +350,63 @@ export interface AdapterClass {
180
350
  */
181
351
  setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack?: boolean): ioBroker.SetStatePromise;
182
352
  /** @deprecated use `adapter.setState` without callback instead */
183
- setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: unknown): ioBroker.SetStatePromise;
353
+ setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options: {
354
+ user?: ioBroker.ObjectIDs.User;
355
+ } | null | undefined): ioBroker.SetStatePromise;
184
356
  /** @deprecated use `adapter.setState` without callback instead */
185
- setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown): ioBroker.SetStatePromise;
357
+ setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: {
358
+ user?: ioBroker.ObjectIDs.User;
359
+ } | null | undefined): ioBroker.SetStatePromise;
186
360
  /**
187
361
  * Writes a value (which might not belong to this adapter) into the states DB.
188
362
  */
189
363
  setForeignStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack?: boolean): ioBroker.SetStatePromise;
190
- setForeignStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: unknown): ioBroker.SetStatePromise;
191
- setForeignStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown): ioBroker.SetStatePromise;
364
+ /**
365
+ * Writes a value (which might not belong to this adapter) into the states DB.
366
+ *
367
+ * @param id object ID of the state
368
+ * @param state simple value or object with attributes
369
+ * @param options optional user context
370
+ */
371
+ setForeignStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
372
+ user?: ioBroker.ObjectIDs.User;
373
+ } | null): ioBroker.SetStatePromise;
374
+ /**
375
+ * Writes a value (which might not belong to this adapter) into the states DB.
376
+ *
377
+ * @param id object ID of the state
378
+ * @param state simple value or object with attributes
379
+ * @param ack is command(false) or status(true)
380
+ * @param options optional user context
381
+ */
382
+ setForeignStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: {
383
+ user?: ioBroker.ObjectIDs.User;
384
+ } | null | undefined): ioBroker.SetStatePromise;
192
385
  /**
193
386
  * Get foreign objects by pattern, by specific type and resolve their enums.
194
387
  */
195
- getForeignObjectsAsync<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, enums?: ioBroker.EnumList | null, options?: unknown): ioBroker.GetObjectsPromiseTyped<T>;
196
- getForeignObjectsAsync<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, options?: unknown): ioBroker.GetObjectsPromiseTyped<T>;
197
- getForeignObjectsAsync(pattern: Pattern, options?: unknown): ioBroker.GetObjectsPromise;
388
+ getForeignObjectsAsync<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, enums?: ioBroker.EnumList | null, options?: {
389
+ user?: ioBroker.ObjectIDs.User;
390
+ } | null): ioBroker.GetObjectsPromiseTyped<T>;
391
+ /**
392
+ * Get foreign objects by pattern and specific type.
393
+ *
394
+ * @param pattern the pattern to match object ids against
395
+ * @param type restrict the result to objects of this type
396
+ * @param options optional user context
397
+ */
398
+ getForeignObjectsAsync<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, options?: {
399
+ user?: ioBroker.ObjectIDs.User;
400
+ } | null): ioBroker.GetObjectsPromiseTyped<T>;
401
+ /**
402
+ * Get foreign objects by pattern.
403
+ *
404
+ * @param pattern the pattern to match object ids against
405
+ * @param options optional user context
406
+ */
407
+ getForeignObjectsAsync(pattern: Pattern, options?: {
408
+ user?: ioBroker.ObjectIDs.User;
409
+ } | null): ioBroker.GetObjectsPromise;
198
410
  /**
199
411
  * creates an object with type device
200
412
  *
@@ -204,7 +416,9 @@ export interface AdapterClass {
204
416
  /** @deprecated use `extendObject` instead */
205
417
  createDeviceAsync(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native?: Record<string, any>): ioBroker.SetObjectPromise;
206
418
  /** @deprecated use `extendObject` instead */
207
- createDeviceAsync(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native: Record<string, any>, options?: unknown): ioBroker.SetObjectPromise;
419
+ createDeviceAsync(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native: Record<string, any>, options?: {
420
+ user?: ioBroker.ObjectIDs.User;
421
+ } | null): ioBroker.SetObjectPromise;
208
422
  /**
209
423
  * Creates an object with a type channel. It must be located under a device
210
424
  *
@@ -214,7 +428,9 @@ export interface AdapterClass {
214
428
  /** @deprecated use `extendObject` instead */
215
429
  createChannelAsync(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native?: Record<string, any>): ioBroker.SetObjectPromise;
216
430
  /** @deprecated use `extendObject` instead */
217
- createChannelAsync(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native: Record<string, any>, options?: unknown): ioBroker.SetObjectPromise;
431
+ createChannelAsync(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native: Record<string, any>, options?: {
432
+ user?: ioBroker.ObjectIDs.User;
433
+ } | null): ioBroker.SetObjectPromise;
218
434
  /**
219
435
  * Creates a state and the corresponding object. It must be located in a channel under a device
220
436
  *
@@ -224,15 +440,21 @@ export interface AdapterClass {
224
440
  /** @deprecated use `extendObject` instead */
225
441
  createStateAsync(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native?: Record<string, any>): ioBroker.SetObjectPromise;
226
442
  /** @deprecated use `extendObject` instead */
227
- createStateAsync(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native: Record<string, any>, options?: unknown): ioBroker.SetObjectPromise;
443
+ createStateAsync(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native: Record<string, any>, options?: {
444
+ user?: ioBroker.ObjectIDs.User;
445
+ } | null): ioBroker.SetObjectPromise;
228
446
  /**
229
447
  * Deletes a channel and its states. It must have been created with createChannel
230
448
  *
231
449
  * @deprecated use `this.delObject` instead
232
450
  */
233
- deleteChannelAsync(channelName: string, options?: unknown): Promise<void>;
451
+ deleteChannelAsync(channelName: string, options?: {
452
+ user?: ioBroker.ObjectIDs.User;
453
+ } | null): Promise<void>;
234
454
  /** @deprecated use `this.delObject` instead */
235
- deleteChannelAsync(parentDevice: string, channelName: string, options?: unknown): Promise<void>;
455
+ deleteChannelAsync(parentDevice: string, channelName: string, options?: {
456
+ user?: ioBroker.ObjectIDs.User;
457
+ } | null): Promise<void>;
236
458
  /**
237
459
  * Deletes a state. It must have been created with createState
238
460
  *
@@ -240,35 +462,82 @@ export interface AdapterClass {
240
462
  */
241
463
  deleteStateAsync(stateName: string, options?: unknown): Promise<void>;
242
464
  /** @deprecated use `this.delObject` instead */
243
- deleteStateAsync(parentChannel: string, stateName: string, options?: unknown): Promise<void>;
465
+ deleteStateAsync(parentChannel: string, stateName: string, options?: {
466
+ user?: ioBroker.ObjectIDs.User;
467
+ } | null): Promise<void>;
244
468
  /** @deprecated use `this.delObject` instead */
245
- deleteStateAsync(parentDevice: string, parentChannel: string, stateName: string, options?: unknown): Promise<void>;
469
+ deleteStateAsync(parentDevice: string, parentChannel: string, stateName: string, options?: {
470
+ user?: ioBroker.ObjectIDs.User;
471
+ } | null): Promise<void>;
246
472
  /**
247
- * Returns a list of all channels in this adapter instance @param parentDevice (optional) Name
248
- * of the parent device to filter the channels by @param options (optional) Some internal options.
473
+ * Returns a list of all channels in this adapter instance
249
474
  */
250
475
  getChannelsOfAsync(): Promise<ioBroker.ChannelObject[]>;
251
- getChannelsOfAsync(parentDevice: string, options?: unknown): Promise<ioBroker.ChannelObject[]>;
476
+ /**
477
+ * Returns a list of all channels in this adapter instance, optionally filtered by parent device.
478
+ *
479
+ * @param parentDevice Name of the parent device to filter the channels by
480
+ * @param options Some internal options
481
+ */
482
+ getChannelsOfAsync(parentDevice: string, options?: {
483
+ user?: ioBroker.ObjectIDs.User;
484
+ } | null): Promise<ioBroker.ChannelObject[]>;
252
485
  /**
253
486
  * Returns a list of all channels in this adapter instance
254
487
  */
255
488
  getChannels(callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
489
+ /**
490
+ * Returns a list of all channels in this adapter instance
491
+ *
492
+ * @param parentDevice Name of the parent device to filter the channels by
493
+ * @param callback return result
494
+ */
256
495
  getChannels(parentDevice: string, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
257
- getChannels(parentDevice: string, options: unknown, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
258
496
  /**
259
- * Returns a list of all channels in this adapter instance @param parentDevice (optional)
260
- * Name of the parent device to filter the channels by @param options (optional) Some internal options.
497
+ * Returns a list of all channels in this adapter instance
498
+ *
499
+ * @param parentDevice Name of the parent device to filter the channels by
500
+ * @param options optional user context
501
+ * @param callback return result
502
+ */
503
+ getChannels(parentDevice: string, options: {
504
+ user?: ioBroker.ObjectIDs.User;
505
+ } | null | undefined, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
506
+ /**
507
+ * Returns a list of all channels in this adapter instance {@link parentDevice} (optional)
508
+ * Name of the parent device to filter the channels by {@link options} (optional) Some internal options.
261
509
  */
262
510
  getChannelsAsync(): Promise<ioBroker.ChannelObject[]>;
263
- getChannelsAsync(parentDevice: string, options?: unknown): Promise<ioBroker.ChannelObject[]>;
264
511
  /**
265
- * Returns a list of all states in this adapter instance @param parentDevice (optional)
266
- * Name of the parent device to filter the channels by @param parentChannel (optional)
267
- * Name of the parent channel to filter the channels by @param options (optional) Some internal options.
512
+ * Returns a list of all channels in this adapter instance, optionally filtered by parent device.
513
+ *
514
+ * @param parentDevice Name of the parent device to filter the channels by
515
+ * @param options Some internal options
516
+ */
517
+ getChannelsAsync(parentDevice: string, options?: {
518
+ user?: ioBroker.ObjectIDs.User;
519
+ } | null): Promise<ioBroker.ChannelObject[]>;
520
+ /**
521
+ * Returns a list of all states in this adapter instance
268
522
  */
269
523
  getStatesOfAsync(): Promise<ioBroker.StateObject[]>;
524
+ /**
525
+ * Returns a list of all states in this adapter instance, optionally filtered by parent device/channel.
526
+ *
527
+ * @param parentDevice Name of the parent device to filter the states by
528
+ * @param parentChannel Name of the parent channel to filter the states by
529
+ */
270
530
  getStatesOfAsync(parentDevice: string, parentChannel?: string): Promise<ioBroker.StateObject[]>;
271
- getStatesOfAsync(parentDevice: string, parentChannel: string, options?: unknown): Promise<ioBroker.StateObject[]>;
531
+ /**
532
+ * Returns a list of all states in this adapter instance, optionally filtered by parent device/channel.
533
+ *
534
+ * @param parentDevice Name of the parent device to filter the states by
535
+ * @param parentChannel Name of the parent channel to filter the states by
536
+ * @param options Some internal options
537
+ */
538
+ getStatesOfAsync(parentDevice: string, parentChannel: string, options?: {
539
+ user?: ioBroker.ObjectIDs.User;
540
+ } | null): Promise<ioBroker.StateObject[]>;
272
541
  }
273
542
  /**
274
543
  * Contents of iobroker.json plus some internal variables
@@ -304,14 +573,10 @@ export declare class AdapterClass extends EventEmitter {
304
573
  private readonly startedInCompactMode;
305
574
  /** List of instances which want our logs */
306
575
  private readonly logList;
307
- private readonly aliases;
308
- private readonly aliasPatterns;
309
576
  private enums;
310
577
  private eventLoopLags;
311
578
  private overwriteLogLevel;
312
579
  adapterReady: boolean;
313
- /** Callbacks from sendTo */
314
- private readonly messageCallbacks;
315
580
  /**
316
581
  * Contains a live cache of the adapter's states.
317
582
  * NOTE: This is only defined if the adapter was initialized with the option states: true.
@@ -323,7 +588,6 @@ export declare class AdapterClass extends EventEmitter {
323
588
  */
324
589
  oObjects?: Record<string, ioBroker.Object | undefined>;
325
590
  private _stopInProgress;
326
- private _callbackId;
327
591
  private _firstConnection;
328
592
  private readonly _timers;
329
593
  private readonly _intervals;
@@ -338,6 +602,8 @@ export declare class AdapterClass extends EventEmitter {
338
602
  namespace: `${string}.${number}`;
339
603
  name: string;
340
604
  private _systemSecret?;
605
+ /** Attributes of `encryptedNative`: their values in `this.config` are decrypted on start */
606
+ private _decryptedNativeAttributes;
341
607
  /** Whether the adapter has already terminated */
342
608
  private terminated;
343
609
  /** The cache of usernames */
@@ -350,8 +616,6 @@ export declare class AdapterClass extends EventEmitter {
350
616
  private users;
351
617
  /** The cache of user groups */
352
618
  private groups;
353
- /** An array of instances, that support auto subscribe */
354
- private autoSubscribe;
355
619
  private defaultHistory;
356
620
  private pluginHandler?;
357
621
  private _reportInterval?;
@@ -372,7 +636,7 @@ export declare class AdapterClass extends EventEmitter {
372
636
  /** contents of iobroker.json if required via AdapterOptions */
373
637
  systemConfig?: InternalAdapterJsonConfig;
374
638
  /** the configured date format of system.config, only available if requested via AdapterOptions `useFormatDate` */
375
- dateFormat?: any;
639
+ dateFormat?: string;
376
640
  /** if float comma instead of dot is used, only available if requested via AdapterOptions `useFormatDate` */
377
641
  isFloatComma?: boolean;
378
642
  /** configured language of system.config, only available if requested via AdapterOptions `useFormatDate` */
@@ -382,11 +646,9 @@ export declare class AdapterClass extends EventEmitter {
382
646
  /** latitude configured in system.config, only available if requested via AdapterOptions `useFormatDate`*/
383
647
  latitude?: number;
384
648
  private _defaultObjs?;
385
- private _aliasObjectsSubscribed?;
386
649
  config: ioBroker.AdapterConfig;
387
650
  host?: string;
388
651
  common?: ioBroker.InstanceCommon;
389
- private mboxSubscribed?;
390
652
  /** Stop the adapter */
391
653
  stop?: (params?: StopParameters) => Promise<void>;
392
654
  version?: string;
@@ -401,7 +663,9 @@ export declare class AdapterClass extends EventEmitter {
401
663
  * @param isActive - if log subscription should be activated or deactivated
402
664
  * @param options - options passed to setState e.g. user permissions
403
665
  */
404
- requireLog?: (isActive: boolean, options?: Partial<GetUserGroupsOptions>) => Promise<void> | void;
666
+ requireLog?: (isActive: boolean, options?: {
667
+ user?: ioBroker.ObjectIDs.User;
668
+ } | null) => Promise<void> | void;
405
669
  private logOffTimer?;
406
670
  private logRequired?;
407
671
  private patterns?;
@@ -414,6 +678,9 @@ export declare class AdapterClass extends EventEmitter {
414
678
  private readonly SUPPORTED_FEATURES;
415
679
  /** Controller for messaging related functionality */
416
680
  private readonly uiMessagingController;
681
+ /**
682
+ * @param options Adapter options, or the adapter name as a string
683
+ */
417
684
  constructor(options: AdapterOptions | string);
418
685
  /**
419
686
  * Get the adapter scoped package identifier of a node module
@@ -421,47 +688,209 @@ export declare class AdapterClass extends EventEmitter {
421
688
  * @param moduleName name of the node module
422
689
  */
423
690
  getAdapterScopedPackageIdentifier(moduleName: string): string;
691
+ /**
692
+ * Install specified npm module
693
+ *
694
+ * @param moduleName name of the node module
695
+ * @param options install options including the version
696
+ */
424
697
  installNodeModule(moduleName: string, options: InstallNodeModuleOptions): Promise<CommandResult>;
425
698
  private _installNodeModule;
426
699
  /**
427
700
  * List all additional installed node modules from this adapter
428
701
  */
429
702
  listInstalledNodeModules(): Promise<string[]>;
703
+ /**
704
+ * Uninstall specified npm module
705
+ *
706
+ * @param moduleName name of the node module
707
+ */
430
708
  uninstallNodeModule(moduleName: string): Promise<CommandResult>;
709
+ /**
710
+ * Import a node module which has been installed via `installNodeModule`
711
+ *
712
+ * @param moduleName name of the node module
713
+ * @returns the required node module
714
+ */
431
715
  importNodeModule(moduleName: string): Promise<unknown>;
716
+ /**
717
+ * Decrypt the password/value with given key
718
+ *
719
+ * @param secretVal to use for decrypt (or value if only one parameter is given)
720
+ * @param value value to decrypt (if secret is provided)
721
+ */
432
722
  decrypt(secretVal: string, value?: string): string;
723
+ /**
724
+ * Decrypt the password/value with the system secret
725
+ *
726
+ * @param value value to decrypt
727
+ */
433
728
  decrypt(value: string): string;
729
+ /**
730
+ * Encrypt the password/value with given key
731
+ *
732
+ * @param secretVal to use for encrypting (or value if only one parameter is given)
733
+ * @param value value to encrypt (if secret is provided)
734
+ */
434
735
  encrypt(secretVal: string, value?: string): string;
736
+ /**
737
+ * Encrypt the password/value with the system secret
738
+ *
739
+ * @param value value to encrypt
740
+ */
435
741
  encrypt(value: string): string;
742
+ /**
743
+ * Read a session from the states DB
744
+ *
745
+ * @param id the session id
746
+ * @param callback return result
747
+ */
436
748
  getSession(id: string, callback: ioBroker.GetSessionCallback): MaybePromise;
437
749
  private _getSession;
438
- setSession(id: string, ttl: number, data: Record<string, any>, callback?: ioBroker.ErrorCallback): MaybePromise;
750
+ /**
751
+ * Store a session in the states DB
752
+ *
753
+ * @param id the session id
754
+ * @param ttl time to live in seconds
755
+ * @param data the session data to store
756
+ * @param callback return result
757
+ */
758
+ setSession(id: string, ttl: number, data: ioBroker.Session, callback?: ioBroker.ErrorCallback): MaybePromise;
439
759
  private _setSession;
760
+ /**
761
+ * Destroy a session in the states DB
762
+ *
763
+ * @param id the session id
764
+ * @param callback return result
765
+ */
440
766
  destroySession(id: string, callback?: ioBroker.ErrorCallback): MaybePromise;
441
767
  private _destroySession;
442
768
  private _getObjectsByArray;
769
+ /**
770
+ * Stops the execution of adapter, but does not disable it.
771
+ *
772
+ * @param exitCode optional exit code
773
+ */
443
774
  terminate(exitCode?: number): never;
775
+ /**
776
+ * Stops the execution of adapter, but does not disable it.
777
+ *
778
+ * @param reason optional reason for termination
779
+ * @param exitCode optional exit code
780
+ */
444
781
  terminate(reason?: string, exitCode?: number): never;
782
+ /**
783
+ * Helper function to find next free port
784
+ *
785
+ * @param port port to start searching from
786
+ * @param host host to bind to
787
+ * @param callback return result
788
+ */
445
789
  getPort(port: number, host?: string, callback?: (port: number) => void): void;
790
+ /**
791
+ * Helper function to find next free port
792
+ *
793
+ * @param port port to start searching from
794
+ * @param callback return result
795
+ */
446
796
  getPort(port: number, callback?: (port: number) => void): void;
447
797
  private _getPort;
798
+ /**
799
+ * Method to check for available Features for adapter development
800
+ *
801
+ * @param featureName the name of the feature to check
802
+ * @returns true/false if the feature is in the list of supported features
803
+ */
448
804
  supportsFeature(featureName: ioBroker.SupportedFeature): boolean;
449
- checkPassword(user: string, pw: string, options: Record<string, any>, callback: CheckPasswordCallback): Promise<void>;
805
+ /**
806
+ * Validates user and password
807
+ *
808
+ * @param user user name as text
809
+ * @param pw password as text
810
+ * @param options optional user context
811
+ * @param callback return result
812
+ */
813
+ checkPassword(user: string, pw: string, options: {
814
+ user?: ioBroker.ObjectIDs.User;
815
+ } | null | undefined, callback: CheckPasswordCallback): Promise<void>;
816
+ /**
817
+ * Validates user and password
818
+ *
819
+ * @param user user name as text
820
+ * @param pw password as text
821
+ * @param callback return result
822
+ */
450
823
  checkPassword(user: string, pw: string, callback: CheckPasswordCallback): Promise<void>;
451
824
  private _checkPassword;
452
825
  /**
453
826
  * This method updates the cached values in `this.usernames`
454
827
  */
455
828
  private _updateUsernameCache;
829
+ /**
830
+ * Return ID of given username
831
+ *
832
+ * @param username name of the user
833
+ */
456
834
  getUserID(username: string): Promise<string | undefined>;
457
835
  private _getUserID;
458
- setPassword(user: string, pw: string, options: Record<string, any>, callback?: ioBroker.ErrorCallback): Promise<void>;
836
+ /**
837
+ * Sets the user's password
838
+ *
839
+ * @param user user name as text
840
+ * @param pw password as text
841
+ * @param options optional user context
842
+ * @param callback return result
843
+ */
844
+ setPassword(user: string, pw: string, options: {
845
+ user?: ioBroker.ObjectIDs.User;
846
+ } | null | undefined, callback?: ioBroker.ErrorCallback): Promise<void>;
847
+ /**
848
+ * Sets the user's password
849
+ *
850
+ * @param user user name as text
851
+ * @param pw password as text
852
+ * @param callback return result
853
+ */
459
854
  setPassword(user: string, pw: string, callback?: ioBroker.ErrorCallback): Promise<void>;
460
855
  private _setPassword;
461
- checkGroup(user: string, group: string, options: Record<string, any>, callback?: CheckGroupCallback): Promise<void>;
856
+ /**
857
+ * Returns if user exists and is in the group
858
+ *
859
+ * @param user user name as text
860
+ * @param group group name
861
+ * @param options optional user context
862
+ * @param callback return result
863
+ */
864
+ checkGroup(user: string, group: string, options?: {
865
+ user?: ioBroker.ObjectIDs.User;
866
+ } | null, callback?: CheckGroupCallback): Promise<void>;
867
+ /**
868
+ * Returns if user exists and is in the group
869
+ *
870
+ * @param user user name as text
871
+ * @param group group name
872
+ * @param callback return result
873
+ */
462
874
  checkGroup(user: string, group: string, callback?: CheckGroupCallback): Promise<void>;
463
875
  private _checkGroup;
464
- calculatePermissions(user: string, commandsPermissions: CommandsPermissions, options?: Record<string, any>, callback?: CalculatePermissionsCallback): Promise<void | ioBroker.PermissionSet>;
876
+ /**
877
+ * Calculate the effective permissions of a user for the given commands
878
+ *
879
+ * @param user user name as text
880
+ * @param commandsPermissions the permission requirements of the commands
881
+ * @param options optional user context
882
+ * @param callback return result
883
+ */
884
+ calculatePermissions(user: string, commandsPermissions: CommandsPermissions, options?: {
885
+ user?: ioBroker.ObjectIDs.User;
886
+ } | null, callback?: CalculatePermissionsCallback): Promise<void | ioBroker.PermissionSet>;
887
+ /**
888
+ * Calculate the effective permissions of a user for the given commands
889
+ *
890
+ * @param user user name as text
891
+ * @param commandsPermissions the permission requirements of the commands
892
+ * @param callback return result
893
+ */
465
894
  calculatePermissions(user: string, commandsPermissions: CommandsPermissions, callback?: CalculatePermissionsCallback): Promise<void | ioBroker.PermissionSet>;
466
895
  private _calculatePermissions;
467
896
  /**
@@ -471,19 +900,30 @@ export declare class AdapterClass extends EventEmitter {
471
900
  */
472
901
  private _stop;
473
902
  /**
474
- * Reads the file certificate from a given path and adds a file watcher to restart adapter on cert changes
475
- * if a cert is passed it is returned as it is
903
+ * Tears down the certificate watching installed by {@link getCertificatesAsync}: closes the file
904
+ * watchers, unsubscribes from `system.certificates`, and forgets the certificates handed out by the
905
+ * last call, so a later change no longer schedules a restart. Called on adapter stop.
906
+ */
907
+ private stopWatchingCertificates;
908
+ /**
909
+ * Get the certificates of the system.
476
910
  *
477
- * @param cert cert or path to cert
911
+ * @param publicName name of the public certificate
912
+ * @param privateName name of the private key
913
+ * @param chainedName name of the chained certificate
914
+ * @param callback return result
478
915
  */
479
- private _readFileCertificate;
480
916
  getCertificates(publicName?: string, privateName?: string, chainedName?: string, callback?: GetCertificatesCallback): void;
481
- private _getCertificates;
482
917
  /**
483
918
  * Restarts an instance of the adapter.
484
919
  *
485
920
  */
486
921
  restart(): void;
922
+ /**
923
+ * Updates the adapter config with new values, merged with the existing config.
924
+ *
925
+ * @param newConfig the new configuration values to merge into the existing config
926
+ */
487
927
  updateConfig(newConfig: Record<string, any>): ioBroker.SetObjectPromise;
488
928
  private _updateConfig;
489
929
  /**
@@ -491,21 +931,94 @@ export declare class AdapterClass extends EventEmitter {
491
931
  *
492
932
  */
493
933
  disable(): ioBroker.SetObjectPromise;
934
+ /**
935
+ * Reads a parameter which is stored encrypted and returns its decrypted value.
936
+ *
937
+ * An attribute listed in `encryptedNative` is already decrypted in `this.config` when the adapter
938
+ * starts, and is returned as it is.
939
+ *
940
+ * @param attribute the config attribute to decrypt
941
+ * @param callback return result
942
+ */
494
943
  getEncryptedConfig(attribute: string, callback?: GetEncryptedConfigCallback): Promise<string | string[] | void>;
495
944
  private _getEncryptedConfig;
496
945
  /**
497
946
  * Get the system secret, after retrieved once it will be read from the cache
498
947
  */
499
948
  private getSystemSecret;
949
+ /**
950
+ * Same as setTimeout, but it clears the running timers during the unloading process
951
+ *
952
+ * @param cb timer callback
953
+ * @param timeout timeout in milliseconds
954
+ * @param args as many arguments as needed, which will be passed to setTimeout
955
+ * @returns timer id
956
+ */
500
957
  setTimeout<TCallback extends TimeoutCallback>(cb: TCallback, timeout: number, ...args: Parameters<TCallback>): ioBroker.Timeout | undefined;
958
+ /**
959
+ * Same as clearTimeout but it checks the running timers on unload
960
+ *
961
+ * @param timer the timer object
962
+ */
501
963
  clearTimeout(timer: ioBroker.Timeout | undefined): void;
964
+ /**
965
+ * Delays the fulfillment of the promise the amount of time.
966
+ *
967
+ * @param timeout timeout in milliseconds
968
+ * @returns promise when timeout is over
969
+ */
502
970
  delay(timeout: number): Promise<void>;
971
+ /**
972
+ * Same as setInterval, but it clears the running intervals during the unloading process
973
+ *
974
+ * @param cb interval callback
975
+ * @param timeout interval in milliseconds
976
+ * @param args as many arguments as needed, which will be passed to setInterval
977
+ * @returns interval id
978
+ */
503
979
  setInterval<TCallback extends TimeoutCallback>(cb: TCallback, timeout: number, ...args: Parameters<TCallback>): ioBroker.Interval | undefined;
980
+ /**
981
+ * Same as clearInterval but it checks the running intervals on unload
982
+ *
983
+ * @param interval interval object
984
+ */
504
985
  clearInterval(interval: ioBroker.Interval | undefined): void;
986
+ /**
987
+ * Creates or overwrites an object in objectDB.
988
+ *
989
+ * @param id object ID (without namespace)
990
+ * @param obj the object to write
991
+ */
505
992
  setObject(id: string, obj: ioBroker.SettableObject): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
993
+ /**
994
+ * Creates or overwrites an object in objectDB.
995
+ *
996
+ * @param id object ID (without namespace)
997
+ * @param obj the object to write
998
+ * @param callback return result
999
+ */
506
1000
  setObject(id: string, obj: ioBroker.SettableObject, callback: ioBroker.SetObjectCallback): void;
507
- setObject(id: string, obj: ioBroker.SettableObject, options: unknown, callback: ioBroker.SetObjectCallback): void;
508
- setObject(id: string, obj: ioBroker.SettableObject, options: unknown): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
1001
+ /**
1002
+ * Creates or overwrites an object in objectDB.
1003
+ *
1004
+ * @param id object ID (without namespace)
1005
+ * @param obj the object to write
1006
+ * @param options optional user context
1007
+ * @param callback return result
1008
+ */
1009
+ setObject(id: string, obj: ioBroker.SettableObject, options: {
1010
+ user?: ioBroker.ObjectIDs.User;
1011
+ } | null | undefined, callback: ioBroker.SetObjectCallback): void;
1012
+ /**
1013
+ * Creates or overwrites an object in objectDB.
1014
+ *
1015
+ * @param id object ID (without namespace)
1016
+ * @param obj the object to write
1017
+ * @param options optional user context
1018
+ */
1019
+ setObject(id: string, obj: ioBroker.SettableObject, options?: {
1020
+ user?: ioBroker.ObjectIDs.User;
1021
+ } | null): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
509
1022
  private _setObject;
510
1023
  /**
511
1024
  * Helper method for `set[Foreign]Object[NotExists]` that also sets the default value if one is configured
@@ -516,51 +1029,317 @@ export declare class AdapterClass extends EventEmitter {
516
1029
  * @param callback optional callback
517
1030
  */
518
1031
  private _setObjectWithDefaultValue;
1032
+ /**
1033
+ * Get all states, channels and devices of this adapter.
1034
+ *
1035
+ * @param callback return result
1036
+ */
519
1037
  getAdapterObjects(callback: (objects: Record<string, ioBroker.AdapterScopedObject>) => void): Promise<Record<string, ioBroker.AdapterScopedObject> | void>;
520
1038
  private _getAdapterObjects;
1039
+ /**
1040
+ * Extend some object and create it if it does not exist
1041
+ *
1042
+ * @param id object ID (without namespace)
1043
+ * @param objPart the partial object to merge into the existing object
1044
+ */
521
1045
  extendObject(id: string, objPart: ioBroker.PartialObject): ioBroker.SetObjectPromise;
1046
+ /**
1047
+ * Extend some object and create it if it does not exist
1048
+ *
1049
+ * @param id object ID (without namespace)
1050
+ * @param objPart the partial object to merge into the existing object
1051
+ * @param callback return result
1052
+ */
522
1053
  extendObject(id: string, objPart: ioBroker.PartialObject, callback?: ioBroker.SetObjectCallback): void;
1054
+ /**
1055
+ * Extend some object and create it if it does not exist
1056
+ *
1057
+ * @param id object ID (without namespace)
1058
+ * @param objPart the partial object to merge into the existing object
1059
+ * @param options optional user context
1060
+ */
523
1061
  extendObject(id: string, objPart: ioBroker.PartialObject, options: ioBroker.ExtendObjectOptions): ioBroker.SetObjectPromise;
1062
+ /**
1063
+ * Extend some object and create it if it does not exist
1064
+ *
1065
+ * @param id object ID (without namespace)
1066
+ * @param objPart the partial object to merge into the existing object
1067
+ * @param options optional user context
1068
+ * @param callback return result
1069
+ */
524
1070
  extendObject(id: string, objPart: ioBroker.PartialObject, options: ioBroker.ExtendObjectOptions, callback?: ioBroker.SetObjectCallback): void;
525
1071
  private _extendObject;
1072
+ /**
1073
+ * Same as {@link AdapterClass.setObject}, but for any object.
1074
+ *
1075
+ * @param id object ID with namespace
1076
+ * @param obj new object
1077
+ */
526
1078
  setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
1079
+ /**
1080
+ * Same as {@link AdapterClass.setObject}, but for any object.
1081
+ *
1082
+ * @param id object ID with namespace
1083
+ * @param obj new object
1084
+ * @param callback return result
1085
+ */
527
1086
  setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, callback: ioBroker.SetObjectCallback): void;
528
- setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: unknown): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
529
- setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: unknown, callback?: ioBroker.SetObjectCallback): void | Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
1087
+ /**
1088
+ * Same as {@link AdapterClass.setObject}, but for any object.
1089
+ *
1090
+ * @param id object ID with namespace
1091
+ * @param obj new object
1092
+ * @param options optional user context
1093
+ */
1094
+ setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: {
1095
+ user?: ioBroker.ObjectIDs.User;
1096
+ } | null | undefined): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
1097
+ /**
1098
+ * Same as {@link AdapterClass.setObject}, but for any object.
1099
+ *
1100
+ * @param id object ID with namespace
1101
+ * @param obj new object
1102
+ * @param options optional user context
1103
+ * @param callback return result
1104
+ */
1105
+ setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: {
1106
+ user?: ioBroker.ObjectIDs.User;
1107
+ } | null, callback?: ioBroker.SetObjectCallback): void | Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
530
1108
  private _setForeignObject;
1109
+ /**
1110
+ * Extend any object and create it if it might not exist.
1111
+ *
1112
+ * @param id object ID with namespace
1113
+ * @param objPart the partial object to merge into the existing object
1114
+ */
531
1115
  extendForeignObject<T extends string>(id: T, objPart: ioBroker.PartialObject<ioBroker.ObjectIdToObjectType<T, 'write'>>): Promise<ioBroker.CallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
1116
+ /**
1117
+ * Extend any object and create it if it might not exist.
1118
+ *
1119
+ * @param id object ID with namespace
1120
+ * @param objPart the partial object to merge into the existing object
1121
+ * @param callback return result
1122
+ */
532
1123
  extendForeignObject<T extends string>(id: T, objPart: ioBroker.PartialObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, callback: ioBroker.SetObjectCallback): void;
1124
+ /**
1125
+ * Extend any object and create it if it might not exist.
1126
+ *
1127
+ * @param id object ID with namespace
1128
+ * @param objPart the partial object to merge into the existing object
1129
+ * @param options optional user context
1130
+ * @param callback return result
1131
+ */
533
1132
  extendForeignObject<T extends string>(id: T, objPart: ioBroker.PartialObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: ioBroker.ExtendObjectOptions, callback: ioBroker.SetObjectCallback): void;
1133
+ /**
1134
+ * Extend any object and create it if it might not exist.
1135
+ *
1136
+ * @param id object ID with namespace
1137
+ * @param objPart the partial object to merge into the existing object
1138
+ * @param options optional user context
1139
+ */
534
1140
  extendForeignObject<T extends string>(id: T, objPart: ioBroker.PartialObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: ioBroker.ExtendObjectOptions): Promise<ioBroker.CallbackReturnTypeOf<ioBroker.SetObjectCallback>>;
535
1141
  private _extendForeignObjectAsync;
536
- objectExists(id: string, options?: Record<string, any> | null): Promise<boolean | void>;
1142
+ /**
1143
+ * Checks if an object exists to the given id, id will be fixed first
1144
+ *
1145
+ * @param id id of the object
1146
+ * @param options optional user context
1147
+ */
1148
+ objectExists(id: string, options?: {
1149
+ user?: ioBroker.ObjectIDs.User;
1150
+ } | null): Promise<boolean | void>;
1151
+ /**
1152
+ * Checks if an object exists to the given id
1153
+ *
1154
+ * @param id id of the object
1155
+ * @param options optional user context
1156
+ */
537
1157
  foreignObjectExists(id: string, options?: Record<string, any> | null): Promise<boolean | void>;
1158
+ /**
1159
+ * Get object of this instance.
1160
+ *
1161
+ * @param id exactly object ID (without namespace)
1162
+ * @param callback return result
1163
+ */
538
1164
  getObject(id: string, callback: ioBroker.GetObjectCallback): void;
539
- getObject(id: string, options: unknown, callback: ioBroker.GetObjectCallback): void;
540
- getObjectView<Design extends string = string, Search extends string = string>(design: Design, search: Search, params: ioBroker.GetObjectViewParams | null | undefined, callback: ioBroker.GetObjectViewCallback<ioBroker.InferGetObjectViewItemType<Design, Search>>): void;
541
- getObjectView<Design extends string = string, Search extends string = string>(design: Design, search: Search, params: ioBroker.GetObjectViewParams | null | undefined, options: unknown, callback: ioBroker.GetObjectViewCallback<ioBroker.InferGetObjectViewItemType<Design, Search>>): void;
542
- private _getObjectView;
543
- getObjectList(params: ioBroker.GetObjectListParams | null, callback: ioBroker.GetObjectListCallback<ioBroker.Object>): void;
544
- getObjectList(params: ioBroker.GetObjectListParams | null, options: {
1165
+ /**
1166
+ * Get object of this instance.
1167
+ *
1168
+ * @param id exactly object ID (without namespace)
1169
+ * @param options optional user context
1170
+ * @param callback return result
1171
+ */
1172
+ getObject(id: string, options: {
1173
+ user?: ioBroker.ObjectIDs.User;
1174
+ } | null | undefined, callback: ioBroker.GetObjectCallback): void;
1175
+ /**
1176
+ * Read object view from DB.
1177
+ *
1178
+ * @param design name of the design
1179
+ * @param search name of the view
1180
+ * @param params object containing startkey: first id to include in result; endkey: last id to include in result
1181
+ * @param callback return result
1182
+ */
1183
+ getObjectView<Design extends string = string, Search extends string = string>(design: Design, search: Search, params: ioBroker.GetObjectViewParams | null | undefined, callback: ioBroker.GetObjectViewCallback<ioBroker.InferGetObjectViewItemType<Design, Search>>): void;
1184
+ /**
1185
+ * Read object view from DB.
1186
+ *
1187
+ * @param design name of the design
1188
+ * @param search name of the view
1189
+ * @param params object containing startkey: first id to include in result; endkey: last id to include in result
1190
+ * @param options additional options, e.g. for permissions
1191
+ * @param callback return result
1192
+ */
1193
+ getObjectView<Design extends string = string, Search extends string = string>(design: Design, search: Search, params: ioBroker.GetObjectViewParams | null | undefined, options: {
1194
+ user?: ioBroker.ObjectIDs.User;
1195
+ } | null | undefined, callback: ioBroker.GetObjectViewCallback<ioBroker.InferGetObjectViewItemType<Design, Search>>): void;
1196
+ private _getObjectView;
1197
+ /**
1198
+ * Read object list from DB.
1199
+ *
1200
+ * @param params startkey and endkey information
1201
+ * @param callback optional callback
1202
+ */
1203
+ getObjectList(params: ioBroker.GetObjectListParams | null, callback: ioBroker.GetObjectListCallback<ioBroker.Object>): void;
1204
+ /**
1205
+ * Read object list from DB.
1206
+ *
1207
+ * @param params startkey and endkey information
1208
+ * @param options additional options, e.g. for permissions
1209
+ * @param callback optional callback
1210
+ */
1211
+ getObjectList(params: ioBroker.GetObjectListParams | null, options: {
545
1212
  sorted?: boolean;
546
- } | Record<string, any>, callback: ioBroker.GetObjectListCallback<ioBroker.Object>): void;
1213
+ user?: ioBroker.ObjectIDs.User;
1214
+ }, callback: ioBroker.GetObjectListCallback<ioBroker.Object>): void;
1215
+ /**
1216
+ * Get the enum tree.
1217
+ *
1218
+ * @param callback return result
1219
+ */
547
1220
  getEnum(callback: ioBroker.GetEnumCallback): void;
1221
+ /**
1222
+ * Get the enum tree.
1223
+ *
1224
+ * @param name the enum name to read
1225
+ * @param callback return result
1226
+ */
548
1227
  getEnum(name: string, callback: ioBroker.GetEnumCallback): void;
549
- getEnum(name: string, options: unknown, callback: ioBroker.GetEnumCallback): void;
1228
+ /**
1229
+ * Get the enum tree.
1230
+ *
1231
+ * @param name the enum name to read
1232
+ * @param options optional user context
1233
+ * @param callback return result
1234
+ */
1235
+ getEnum(name: string, options: {
1236
+ user?: ioBroker.ObjectIDs.User;
1237
+ } | null | undefined, callback: ioBroker.GetEnumCallback): void;
550
1238
  private _getEnum;
1239
+ /**
1240
+ * Read the members of given enums.
1241
+ *
1242
+ * @param callback return result
1243
+ */
551
1244
  getEnums(callback: ioBroker.GetEnumsCallback): void;
1245
+ /**
1246
+ * Read the members of given enums.
1247
+ *
1248
+ * @param enumList the enum(s) to read
1249
+ * @param callback return result
1250
+ */
552
1251
  getEnums(enumList: ioBroker.EnumList, callback: ioBroker.GetEnumsCallback): void;
553
- getEnums(enumList: ioBroker.EnumList, options: unknown, callback: ioBroker.GetEnumsCallback): void;
1252
+ /**
1253
+ * Read the members of given enums.
1254
+ *
1255
+ * @param enumList the enum(s) to read
1256
+ * @param options optional user context
1257
+ * @param callback return result
1258
+ */
1259
+ getEnums(enumList: ioBroker.EnumList, options: {
1260
+ user?: ioBroker.ObjectIDs.User;
1261
+ } | null | undefined, callback: ioBroker.GetEnumsCallback): void;
554
1262
  private _getEnums;
1263
+ /**
1264
+ * Get all objects matching the given pattern.
1265
+ *
1266
+ * @param patter the pattern to match object ids against
1267
+ */
555
1268
  getForeignObjects(patter: Pattern): Promise<ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectsCallback>>;
1269
+ /**
1270
+ * Get all objects matching the given pattern.
1271
+ *
1272
+ * @param pattern the pattern to match object ids against
1273
+ * @param callback return result
1274
+ */
556
1275
  getForeignObjects(pattern: Pattern, callback: ioBroker.GetObjectsCallback): void;
557
- getForeignObjects(pattern: Pattern, options: unknown, callback: ioBroker.GetObjectsCallback): void;
1276
+ /**
1277
+ * Get all objects matching the given pattern.
1278
+ *
1279
+ * @param pattern the pattern to match object ids against
1280
+ * @param options optional user context
1281
+ * @param callback return result
1282
+ */
1283
+ getForeignObjects(pattern: Pattern, options: {
1284
+ user?: ioBroker.ObjectIDs.User;
1285
+ } | null | undefined, callback: ioBroker.GetObjectsCallback): void;
1286
+ /**
1287
+ * Get all objects of the given type matching the given pattern.
1288
+ *
1289
+ * @param pattern the pattern to match object ids against
1290
+ * @param type restrict the result to objects of this type
1291
+ * @param callback return result
1292
+ */
558
1293
  getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
1294
+ /**
1295
+ * Get all objects of the given type matching the given pattern.
1296
+ *
1297
+ * @param pattern the pattern to match object ids against
1298
+ * @param type restrict the result to objects of this type
1299
+ * @param enums restrict the result to objects within these enums
1300
+ * @param callback return result
1301
+ */
559
1302
  getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, enums: ioBroker.EnumList, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
560
- getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, options: unknown, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
561
- getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, enums: ioBroker.EnumList | null, options: unknown, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
1303
+ /**
1304
+ * Get all objects of the given type matching the given pattern.
1305
+ *
1306
+ * @param pattern the pattern to match object ids against
1307
+ * @param type restrict the result to objects of this type
1308
+ * @param options optional user context
1309
+ * @param callback return result
1310
+ */
1311
+ getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, options: {
1312
+ user?: ioBroker.ObjectIDs.User;
1313
+ } | null | undefined, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
1314
+ /**
1315
+ * Get all objects of the given type matching the given pattern.
1316
+ *
1317
+ * @param pattern the pattern to match object ids against
1318
+ * @param type restrict the result to objects of this type
1319
+ * @param enums restrict the result to objects within these enums
1320
+ * @param options optional user context
1321
+ * @param callback return result
1322
+ */
1323
+ getForeignObjects<T extends ioBroker.ObjectType>(pattern: Pattern, type: T, enums: ioBroker.EnumList | null, options: {
1324
+ user?: ioBroker.ObjectIDs.User;
1325
+ } | null | undefined, callback: ioBroker.GetObjectsCallbackTyped<T>): void;
562
1326
  private _getForeignObjects;
1327
+ /**
1328
+ * Find any object by name or ID.
1329
+ *
1330
+ * @param idOrName exactly object ID or name (without namespace)
1331
+ * @param type optional `common.type` of state: 'number', 'string', 'boolean', 'file', ...
1332
+ * @param callback return result
1333
+ */
563
1334
  findForeignObject(idOrName: string, type: ioBroker.CommonType | null, callback: ioBroker.FindObjectCallback): void;
1335
+ /**
1336
+ * Find any object by name or ID.
1337
+ *
1338
+ * @param idOrName exactly object ID or name (without namespace)
1339
+ * @param type optional `common.type` of state: 'number', 'string', 'boolean', 'file', ...
1340
+ * @param options optional user context
1341
+ * @param callback return result
1342
+ */
564
1343
  findForeignObject(idOrName: string, type: ioBroker.CommonType | null, options: {
565
1344
  user?: `system.user.${string}`;
566
1345
  language?: ioBroker.Languages;
@@ -577,7 +1356,7 @@ export declare class AdapterClass extends EventEmitter {
577
1356
  * @param options optional user context with language
578
1357
  * @param options.user current user
579
1358
  * @param options.language language in which the search must be done for multi-language names
580
- * @result if the object was found by ID it will return id and may be the multi-language name it exists. If the object was found by name it will return id and the multi-language name. If the object was not found, it will return only name that was searched for.
1359
+ * @returns if the object was found by ID it will return id and may be the multi-language name it exists. If the object was found by name it will return id and the multi-language name. If the object was not found, it will return only name that was searched for.
581
1360
  */
582
1361
  findForeignObjectAsync(id: string, type: ioBroker.CommonType | null, options?: {
583
1362
  user?: `system.user.${string}`;
@@ -586,30 +1365,185 @@ export declare class AdapterClass extends EventEmitter {
586
1365
  id?: string;
587
1366
  name: ioBroker.StringOrTranslated;
588
1367
  }>;
589
- getForeignObject<T extends string>(id: T, callback: ioBroker.GetObjectCallback<T>): void | Promise<void | ioBroker.ObjectIdToObjectType<T> | null>;
590
- getForeignObject<T extends string>(id: T, options: unknown, callback: ioBroker.GetObjectCallback<T>): void | Promise<void | ioBroker.ObjectIdToObjectType<T> | null>;
1368
+ /**
1369
+ * Get any object.
1370
+ *
1371
+ * @param id exactly object ID (with namespace)
1372
+ * @param callback return result
1373
+ */
1374
+ getForeignObject<T extends string>(id: T, callback: ioBroker.GetObjectCallback<T>): void;
1375
+ /**
1376
+ * Get any object.
1377
+ *
1378
+ * @param id exactly object ID (with namespace)
1379
+ * @param options optional user context
1380
+ * @param callback return result
1381
+ */
1382
+ getForeignObject<T extends string>(id: T, options: {
1383
+ user?: ioBroker.ObjectIDs.User;
1384
+ } | null | undefined, callback: ioBroker.GetObjectCallback<T>): void;
591
1385
  private _getForeignObject;
1386
+ /**
1387
+ * Delete an object of this instance.
1388
+ *
1389
+ * @param id exactly object ID (without namespace)
1390
+ * @param callback return result
1391
+ */
592
1392
  delObject(id: string, callback?: ioBroker.ErrorCallback): void;
1393
+ /**
1394
+ * Delete an object of this instance.
1395
+ *
1396
+ * @param id exactly object ID (without namespace)
1397
+ * @param options optional user context. E.g. recursive option could be true
1398
+ * @param callback return result
1399
+ */
593
1400
  delObject(id: string, options?: ioBroker.DelObjectOptions | null, callback?: ioBroker.ErrorCallback): void;
594
1401
  private _deleteObjects;
1402
+ /**
1403
+ * Delete any object.
1404
+ *
1405
+ * @param id exactly object ID (with namespace)
1406
+ * @param callback return result
1407
+ */
595
1408
  delForeignObject(id: string, callback?: ioBroker.ErrorCallback): void;
1409
+ /**
1410
+ * Delete any object.
1411
+ *
1412
+ * @param id exactly object ID (with namespace)
1413
+ * @param options optional user context or `{ recursive: true }` to delete all underlying objects
1414
+ * @param callback return result
1415
+ */
596
1416
  delForeignObject(id: string, options: ioBroker.DelObjectOptions, callback?: ioBroker.ErrorCallback): void;
597
1417
  private _delForeignObject;
1418
+ /**
1419
+ * Subscribe for the changes of objects in this instance.
1420
+ *
1421
+ * @param pattern pattern like 'channel.*' or '*' (all objects of this adapter) - without namespaces
1422
+ * @param callback optional returns result
1423
+ */
598
1424
  subscribeObjects(pattern: Pattern, callback?: ioBroker.ErrorCallback): void;
599
- subscribeObjects(pattern: Pattern, options: unknown, callback?: ioBroker.ErrorCallback): void;
1425
+ /**
1426
+ * Subscribe for the changes of objects in this instance.
1427
+ *
1428
+ * @param pattern pattern like 'channel.*' or '*' (all objects of this adapter) - without namespaces
1429
+ * @param options optional user context
1430
+ * @param callback optional returns result
1431
+ */
1432
+ subscribeObjects(pattern: Pattern, options?: {
1433
+ user?: ioBroker.ObjectIDs.User;
1434
+ } | null, callback?: ioBroker.ErrorCallback): void;
1435
+ /**
1436
+ * Unsubscribe on the changes of objects in this instance.
1437
+ *
1438
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces
1439
+ * @param callback optional returns result
1440
+ */
600
1441
  unsubscribeObjects(pattern: Pattern, callback?: ioBroker.ErrorCallback): void;
601
- unsubscribeObjects(pattern: Pattern, options: unknown, callback?: ioBroker.ErrorCallback): void;
1442
+ /**
1443
+ * Unsubscribe on the changes of objects in this instance.
1444
+ *
1445
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces
1446
+ * @param options optional user context
1447
+ * @param callback optional returns result
1448
+ */
1449
+ unsubscribeObjects(pattern: Pattern, options?: {
1450
+ user?: ioBroker.ObjectIDs.User;
1451
+ } | null, callback?: ioBroker.ErrorCallback): void;
1452
+ /**
1453
+ * Subscribe for the changes of objects in any instance.
1454
+ *
1455
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces. You can use array of patterns
1456
+ * @param callback optional returns result
1457
+ */
602
1458
  subscribeForeignObjects(pattern: string | string[], callback?: ioBroker.ErrorCallback): void;
603
- subscribeForeignObjects(pattern: string | string[], options: unknown, callback?: ioBroker.ErrorCallback): void;
1459
+ /**
1460
+ * Subscribe for the changes of objects in any instance.
1461
+ *
1462
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces. You can use array of patterns
1463
+ * @param options optional user context
1464
+ * @param callback optional returns result
1465
+ */
1466
+ subscribeForeignObjects(pattern: string | string[], options?: {
1467
+ user?: ioBroker.ObjectIDs.User;
1468
+ } | null, callback?: ioBroker.ErrorCallback): void;
1469
+ /**
1470
+ * Unsubscribe for the patterns on all objects.
1471
+ *
1472
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces
1473
+ * @param callback optional returns result
1474
+ */
604
1475
  unsubscribeForeignObjects(pattern: string | string[], callback?: ioBroker.ErrorCallback): void;
605
- unsubscribeForeignObjects(pattern: string | string[], options: unknown, callback?: ioBroker.ErrorCallback): void;
1476
+ /**
1477
+ * Unsubscribe for the patterns on all objects.
1478
+ *
1479
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces
1480
+ * @param options optional user context
1481
+ * @param callback optional returns result
1482
+ */
1483
+ unsubscribeForeignObjects(pattern: string | string[], options?: {
1484
+ user?: ioBroker.ObjectIDs.User;
1485
+ } | null, callback?: ioBroker.ErrorCallback): void;
1486
+ /**
1487
+ * Subscribe for the changes of files in specific instance.
1488
+ *
1489
+ * @param id adapter ID like 'vis-2.0' or 'vis-2.admin'
1490
+ * @param pattern pattern like 'channel.*' or '*' (all files) - without namespaces. You can use array of patterns
1491
+ * @param options optional user context
1492
+ */
606
1493
  subscribeForeignFiles(id: string, pattern: string | string[], options?: unknown): Promise<void>;
1494
+ /**
1495
+ * Unsubscribe for the changes of files on specific instance.
1496
+ *
1497
+ * @param id adapter ID like 'vis-2.0' or 'vis-2.admin'
1498
+ * @param pattern pattern like 'channel.*' or '*' (all objects) - without namespaces
1499
+ * @param options optional user context
1500
+ */
607
1501
  unsubscribeForeignFiles(id: string, pattern: string | string[], options?: unknown): Promise<void>;
1502
+ /**
1503
+ * Same as {@link AdapterClass.setObject}, but with check if the object exists.
1504
+ *
1505
+ * @param id object ID, that must be overwritten or created.
1506
+ * @param obj new object
1507
+ * @param callback return result
1508
+ */
608
1509
  setObjectNotExists(id: string, obj: ioBroker.SettableObject, callback?: ioBroker.SetObjectCallback): Promise<void | ioBroker.CallbackReturnTypeOf<ioBroker.SetObjectCallback>> | void;
609
- setObjectNotExists(id: string, obj: ioBroker.SettableObject, options: unknown, callback?: ioBroker.SetObjectCallback): Promise<void | ioBroker.CallbackReturnTypeOf<ioBroker.SetObjectCallback>> | void;
1510
+ /**
1511
+ * Same as {@link AdapterClass.setObject}, but with check if the object exists.
1512
+ *
1513
+ * @param id object ID, that must be overwritten or created.
1514
+ * @param obj new object
1515
+ * @param options optional user context
1516
+ * @param callback return result
1517
+ */
1518
+ setObjectNotExists(id: string, obj: ioBroker.SettableObject, options?: {
1519
+ user?: ioBroker.ObjectIDs.User;
1520
+ preserve?: {
1521
+ [key: string]: boolean;
1522
+ };
1523
+ } | null, callback?: ioBroker.SetObjectCallback): Promise<void | ioBroker.CallbackReturnTypeOf<ioBroker.SetObjectCallback>> | void;
610
1524
  private _setObjectNotExists;
1525
+ /**
1526
+ * Same as {@link AdapterClass.setForeignObject}, but with check if the object exists.
1527
+ *
1528
+ * @param id object ID, that must be overwritten or created.
1529
+ * @param obj new object
1530
+ * @param callback return result
1531
+ */
611
1532
  setForeignObjectNotExists<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, callback?: ioBroker.SetObjectCallback): void;
612
- setForeignObjectNotExists<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options: unknown, callback?: ioBroker.SetObjectCallback): void;
1533
+ /**
1534
+ * Same as {@link AdapterClass.setForeignObject}, but with check if the object exists.
1535
+ *
1536
+ * @param id object ID, that must be overwritten or created.
1537
+ * @param obj new object
1538
+ * @param options optional user context
1539
+ * @param callback return result
1540
+ */
1541
+ setForeignObjectNotExists<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, options?: {
1542
+ user?: ioBroker.ObjectIDs.User;
1543
+ preserve?: {
1544
+ [key: string]: boolean;
1545
+ };
1546
+ } | null, callback?: ioBroker.SetObjectCallback): void;
613
1547
  private _setForeignObjectNotExists;
614
1548
  private _DCS2ID;
615
1549
  /** @deprecated use `this.extendObject` instead */
@@ -619,7 +1553,9 @@ export declare class AdapterClass extends EventEmitter {
619
1553
  /** @deprecated use `this.extendObject` instead */
620
1554
  createDevice(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native: Record<string, any>, callback?: ioBroker.SetObjectCallback): void;
621
1555
  /** @deprecated use `this.extendObject` instead */
622
- createDevice(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native: Record<string, any>, options: unknown, callback?: ioBroker.SetObjectCallback): void;
1556
+ createDevice(deviceName: string, common: Partial<ioBroker.DeviceCommon>, native: Record<string, any>, options?: {
1557
+ user?: ioBroker.ObjectIDs.User;
1558
+ } | null, callback?: ioBroker.SetObjectCallback): void;
623
1559
  private _createDevice;
624
1560
  /** @deprecated use `this.extendObject` instead */
625
1561
  createChannel(parentDevice: string, channelName: string, callback?: ioBroker.SetObjectCallback): void;
@@ -628,7 +1564,9 @@ export declare class AdapterClass extends EventEmitter {
628
1564
  /** @deprecated use `this.extendObject` instead */
629
1565
  createChannel(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native: Record<string, any>, callback?: ioBroker.SetObjectCallback): void;
630
1566
  /** @deprecated use `this.extendObject` instead */
631
- createChannel(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native: Record<string, any>, options: unknown, callback?: ioBroker.SetObjectCallback): void;
1567
+ createChannel(parentDevice: string, channelName: string, roleOrCommon: string | Partial<ioBroker.ChannelCommon>, native: Record<string, any>, options?: {
1568
+ user?: ioBroker.ObjectIDs.User;
1569
+ } | null, callback?: ioBroker.SetObjectCallback): void;
632
1570
  /** @deprecated use `this.extendObject` instead */
633
1571
  createState(parentDevice: string, parentChannel: string, stateName: string, callback?: ioBroker.SetObjectCallback): void;
634
1572
  /** @deprecated use `this.extendObject` instead */
@@ -636,18 +1574,62 @@ export declare class AdapterClass extends EventEmitter {
636
1574
  /** @deprecated use `this.extendObject` instead */
637
1575
  createState(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native: Record<string, any>, callback?: ioBroker.SetObjectCallback): void;
638
1576
  /** @deprecated use `this.extendObject` instead */
639
- createState(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native: Record<string, any>, options: unknown, callback?: ioBroker.SetObjectCallback): void;
1577
+ createState(parentDevice: string, parentChannel: string, stateName: string, roleOrCommon: string | Partial<ioBroker.StateCommon>, native: Record<string, any>, options?: {
1578
+ user?: ioBroker.ObjectIDs.User;
1579
+ } | null, callback?: ioBroker.SetObjectCallback): void;
640
1580
  private _createState;
641
1581
  /** @deprecated use `this.delObject` instead */
642
1582
  deleteDevice(deviceName: string, callback?: ioBroker.ErrorCallback): void;
643
1583
  /** @deprecated use `this.delObject` instead */
644
- deleteDevice(deviceName: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
1584
+ deleteDevice(deviceName: string, options?: {
1585
+ user?: ioBroker.ObjectIDs.User;
1586
+ } | null, callback?: ioBroker.ErrorCallback): void;
645
1587
  private _deleteDevice;
1588
+ /**
1589
+ * Add a channel to an enum.
1590
+ *
1591
+ * @param enumName the enum category (e.g. rooms, functions)
1592
+ * @param addTo the enum id to add the channel to
1593
+ * @param parentDevice the parent device name
1594
+ * @param channelName the name of the channel
1595
+ * @param callback return result
1596
+ */
646
1597
  addChannelToEnum(enumName: string, addTo: string, parentDevice: string, channelName: string, callback?: ioBroker.ErrorCallback): void;
647
- addChannelToEnum(enumName: string, addTo: string, parentDevice: string, channelName: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
1598
+ /**
1599
+ * Add a channel to an enum.
1600
+ *
1601
+ * @param enumName the enum category (e.g. rooms, functions)
1602
+ * @param addTo the enum id to add the channel to
1603
+ * @param parentDevice the parent device name
1604
+ * @param channelName the name of the channel
1605
+ * @param options optional user context
1606
+ * @param callback return result
1607
+ */
1608
+ addChannelToEnum(enumName: string, addTo: string, parentDevice: string, channelName: string, options?: {
1609
+ user?: ioBroker.ObjectIDs.User;
1610
+ } | null, callback?: ioBroker.ErrorCallback): void;
648
1611
  private _addChannelToEnum;
1612
+ /**
1613
+ * Remove a channel from an enum.
1614
+ *
1615
+ * @param enumName the enum category (e.g. rooms, functions)
1616
+ * @param parentDevice the parent device name
1617
+ * @param channelName the name of the channel
1618
+ * @param callback return result
1619
+ */
649
1620
  deleteChannelFromEnum(enumName: string, parentDevice: string, channelName: string, callback?: ioBroker.ErrorCallback): void;
650
- deleteChannelFromEnum(enumName: string, parentDevice: string, channelName: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
1621
+ /**
1622
+ * Remove a channel from an enum.
1623
+ *
1624
+ * @param enumName the enum category (e.g. rooms, functions)
1625
+ * @param parentDevice the parent device name
1626
+ * @param channelName the name of the channel
1627
+ * @param options optional user context
1628
+ * @param callback return result
1629
+ */
1630
+ deleteChannelFromEnum(enumName: string, parentDevice: string, channelName: string, options?: {
1631
+ user?: ioBroker.ObjectIDs.User;
1632
+ } | null, callback?: ioBroker.ErrorCallback): void;
651
1633
  private _deleteChannelFromEnum;
652
1634
  /** @deprecated use `this.delObject` instead */
653
1635
  deleteChannel(channelName: string, callback?: ioBroker.ErrorCallback): void;
@@ -663,103 +1645,685 @@ export declare class AdapterClass extends EventEmitter {
663
1645
  /** @deprecated use `this.delObject` instead */
664
1646
  deleteState(parentDevice: string | null, parentChannel: string | null, stateName: string, options?: unknown, callback?: ioBroker.ErrorCallback): void;
665
1647
  private _deleteState;
1648
+ /**
1649
+ * Get all devices of this adapter.
1650
+ *
1651
+ * @param callback return result
1652
+ */
666
1653
  getDevices(callback: ioBroker.GetObjectsCallback3<ioBroker.DeviceObject>): void;
667
- getDevices(options: unknown, callback: ioBroker.GetObjectsCallback3<ioBroker.DeviceObject>): void;
1654
+ /**
1655
+ * Get all devices of this adapter.
1656
+ *
1657
+ * @param options optional user context
1658
+ * @param callback return result
1659
+ */
1660
+ getDevices(options: {
1661
+ user?: ioBroker.ObjectIDs.User;
1662
+ } | null, callback: ioBroker.GetObjectsCallback3<ioBroker.DeviceObject>): void;
668
1663
  private _getDevices;
1664
+ /**
1665
+ * Get all channels of this adapter or of the given device.
1666
+ *
1667
+ * @param callback return result
1668
+ */
669
1669
  getChannelsOf(callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
1670
+ /**
1671
+ * Get all channels of this adapter or of the given device.
1672
+ *
1673
+ * @param parentDevice the parent device name
1674
+ * @param callback return result
1675
+ */
670
1676
  getChannelsOf(parentDevice: string, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
671
- getChannelsOf(parentDevice: string, options: unknown, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
1677
+ /**
1678
+ * Get all channels of this adapter or of the given device.
1679
+ *
1680
+ * @param parentDevice the parent device name
1681
+ * @param options optional user context
1682
+ * @param callback return result
1683
+ */
1684
+ getChannelsOf(parentDevice: string, options: {
1685
+ user?: ioBroker.ObjectIDs.User;
1686
+ } | null, callback: ioBroker.GetObjectsCallback3<ioBroker.ChannelObject>): void;
672
1687
  private _getChannelsOf;
1688
+ /**
1689
+ * Get all states of this adapter or of the given device/channel.
1690
+ *
1691
+ * @param callback return result
1692
+ */
673
1693
  getStatesOf(callback: ioBroker.GetObjectsCallback3<ioBroker.StateObject>): void;
1694
+ /**
1695
+ * Get all states of this adapter or of the given device/channel.
1696
+ *
1697
+ * @param parentDevice the parent device name
1698
+ * @param callback return result
1699
+ */
674
1700
  getStatesOf(parentDevice: string, callback: ioBroker.GetObjectsCallback3<ioBroker.StateObject>): void;
1701
+ /**
1702
+ * Get all states of this adapter or of the given device/channel.
1703
+ *
1704
+ * @param parentDevice the parent device name
1705
+ * @param parentChannel the parent channel name
1706
+ * @param callback return result
1707
+ */
675
1708
  getStatesOf(parentDevice: string | null | undefined, parentChannel: string | null | undefined, callback: ioBroker.GetObjectsCallback3<ioBroker.StateObject>): void;
676
- getStatesOf(parentDevice: string | null | undefined, parentChannel: string | null | undefined, options: unknown, callback: ioBroker.GetObjectsCallback3<ioBroker.StateObject>): void;
1709
+ /**
1710
+ * Get all states of this adapter or of the given device/channel.
1711
+ *
1712
+ * @param parentDevice the parent device name
1713
+ * @param parentChannel the parent channel name
1714
+ * @param options optional user context
1715
+ * @param callback return result
1716
+ */
1717
+ getStatesOf(parentDevice: string | null | undefined, parentChannel: string | null | undefined, options: {
1718
+ user?: ioBroker.ObjectIDs.User;
1719
+ } | null, callback: ioBroker.GetObjectsCallback3<ioBroker.StateObject>): void;
677
1720
  private _getStatesOf;
1721
+ /**
1722
+ * Add a state to an enum.
1723
+ *
1724
+ * @param enumName the enum category (e.g. rooms, functions)
1725
+ * @param addTo the enum id to add the state to
1726
+ * @param parentDevice the parent device name
1727
+ * @param parentChannel the parent channel name
1728
+ * @param stateName the name of the state
1729
+ * @param callback return result
1730
+ */
678
1731
  addStateToEnum(enumName: string, addTo: string, parentDevice: string, parentChannel: string, stateName: string, callback?: ioBroker.ErrorCallback): void;
679
- addStateToEnum(enumName: string, addTo: string, parentDevice: string, parentChannel: string, stateName: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
1732
+ /**
1733
+ * Add a state to an enum.
1734
+ *
1735
+ * @param enumName the enum category (e.g. rooms, functions)
1736
+ * @param addTo the enum id to add the state to
1737
+ * @param parentDevice the parent device name
1738
+ * @param parentChannel the parent channel name
1739
+ * @param stateName the name of the state
1740
+ * @param options optional user context
1741
+ * @param callback return result
1742
+ */
1743
+ addStateToEnum(enumName: string, addTo: string, parentDevice: string, parentChannel: string, stateName: string, options?: {
1744
+ user?: ioBroker.ObjectIDs.User;
1745
+ } | null, callback?: ioBroker.ErrorCallback): void;
680
1746
  private _addStateToEnum;
1747
+ /**
1748
+ * Remove a state from an enum.
1749
+ *
1750
+ * @param enumName the enum category (e.g. rooms, functions)
1751
+ * @param parentDevice the parent device name
1752
+ * @param parentChannel the parent channel name
1753
+ * @param stateName the name of the state
1754
+ * @param callback return result
1755
+ */
681
1756
  deleteStateFromEnum(enumName: string, parentDevice: string, parentChannel: string, stateName: string, callback?: ioBroker.ErrorCallback): void;
682
- deleteStateFromEnum(enumName: string, parentDevice: string, parentChannel: string, stateName: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
1757
+ /**
1758
+ * Remove a state from an enum.
1759
+ *
1760
+ * @param enumName the enum category (e.g. rooms, functions)
1761
+ * @param parentDevice the parent device name
1762
+ * @param parentChannel the parent channel name
1763
+ * @param stateName the name of the state
1764
+ * @param options optional user context
1765
+ * @param callback return result
1766
+ */
1767
+ deleteStateFromEnum(enumName: string, parentDevice: string, parentChannel: string, stateName: string, options?: {
1768
+ user?: ioBroker.ObjectIDs.User;
1769
+ } | null, callback?: ioBroker.ErrorCallback): void;
683
1770
  private _deleteStateFromEnum;
1771
+ /**
1772
+ * Change file access rights
1773
+ *
1774
+ * @param adapter adapter name, or null for the current adapter
1775
+ * @param path path to file without adapter name
1776
+ * @param options data with mode
1777
+ * @param callback return result
1778
+ */
684
1779
  chmodFile(adapter: string | null, path: string, options: {
685
1780
  mode: number | string;
686
- } | Record<string, any>, callback: ioBroker.ChownFileCallback): void;
1781
+ user?: ioBroker.ObjectIDs.User;
1782
+ }, callback: ioBroker.ChownFileCallback): void;
1783
+ /**
1784
+ * Change file access rights
1785
+ *
1786
+ * @param adapter adapter name, or null for the current adapter
1787
+ * @param path path to file without adapter name
1788
+ * @param callback return result
1789
+ */
687
1790
  chmodFile(adapter: string | null, path: string, callback: ioBroker.ChownFileCallback): void;
688
- chownFile(_adapter: string, path: string, options: unknown, callback: (err?: Error | null, processedFiles?: any) => void): void;
689
- chownFile(_adapter: string, path: string, callback: (err?: Error | null, processedFiles?: any) => void): void;
1791
+ /**
1792
+ * Change a file owner
1793
+ *
1794
+ * @param _adapter adapter name, or null for the current adapter
1795
+ * @param path path to file without adapter name
1796
+ * @param options data with owner and ownerGroup
1797
+ * @param callback return result
1798
+ */
1799
+ chownFile(_adapter: string, path: string, options: {
1800
+ owner: ioBroker.ObjectIDs.User;
1801
+ user?: ioBroker.ObjectIDs.User;
1802
+ ownerGroup?: ioBroker.ObjectIDs.Group;
1803
+ group?: ioBroker.ObjectIDs.Group;
1804
+ }, callback: (err?: Error | null, processedFiles?: ioBroker.ChownFileResult[]) => void): void;
1805
+ /**
1806
+ * Change a file owner
1807
+ *
1808
+ * @param _adapter adapter name, or null for the current adapter
1809
+ * @param path path to file without adapter name
1810
+ * @param callback return result
1811
+ */
1812
+ chownFile(_adapter: string, path: string, callback: (err?: Error | null, processedFiles?: ioBroker.ChownFileResult[]) => void): void;
1813
+ /**
1814
+ * Read directory from DB.
1815
+ *
1816
+ * @param adapterName adapter name, or null for the current adapter
1817
+ * @param path path to the directory
1818
+ * @param callback return result
1819
+ */
690
1820
  readDir(adapterName: string | null, path: string, callback: ioBroker.ReadDirCallback): void;
691
- readDir(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ReadDirCallback): void;
1821
+ /**
1822
+ * Read directory from DB.
1823
+ *
1824
+ * @param adapterName adapter name, or null for the current adapter
1825
+ * @param path path to the directory
1826
+ * @param options optional user context
1827
+ * @param callback return result
1828
+ */
1829
+ readDir(adapterName: string | null, path: string, options: {
1830
+ user?: ioBroker.ObjectIDs.User;
1831
+ } | null, callback: ioBroker.ReadDirCallback): void;
1832
+ /**
1833
+ * Deletes a file in the DB.
1834
+ *
1835
+ * @param adapterName adapter name, or null for the current adapter
1836
+ * @param path path to the file
1837
+ * @param callback return result
1838
+ */
692
1839
  unlink(adapterName: string | null, path: string, callback: ioBroker.ErrnoCallback): void;
693
- unlink(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ErrnoCallback): void;
1840
+ /**
1841
+ * Deletes a file in the DB.
1842
+ *
1843
+ * @param adapterName adapter name, or null for the current adapter
1844
+ * @param path path to the file
1845
+ * @param options optional user context
1846
+ * @param callback return result
1847
+ */
1848
+ unlink(adapterName: string | null, path: string, options: {
1849
+ user?: ioBroker.ObjectIDs.User;
1850
+ } | null, callback: ioBroker.ErrnoCallback): void;
1851
+ /**
1852
+ * Renames a file in the DB.
1853
+ *
1854
+ * @param adapterName adapter name, or null for the current adapter
1855
+ * @param oldName current path to the file
1856
+ * @param newName new path to the file
1857
+ * @param callback return result
1858
+ */
694
1859
  rename(adapterName: string | null, oldName: string, newName: string, callback: ioBroker.ErrnoCallback): void;
695
- rename(adapterName: string | null, oldName: string, newName: string, options: unknown, callback: ioBroker.ErrnoCallback): void;
1860
+ /**
1861
+ * Renames a file in the DB.
1862
+ *
1863
+ * @param adapterName adapter name, or null for the current adapter
1864
+ * @param oldName current path to the file
1865
+ * @param newName new path to the file
1866
+ * @param options optional user context
1867
+ * @param callback return result
1868
+ */
1869
+ rename(adapterName: string | null, oldName: string, newName: string, options: {
1870
+ user?: ioBroker.ObjectIDs.User;
1871
+ } | null, callback: ioBroker.ErrnoCallback): void;
1872
+ /**
1873
+ * Creates a directory in the DB.
1874
+ *
1875
+ * @param adapterName adapter name, or null for the current adapter
1876
+ * @param path path to the directory
1877
+ * @param callback return result
1878
+ */
696
1879
  mkdir(adapterName: string | null, path: string, callback: ioBroker.ErrnoCallback): void;
697
- mkdir(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ErrnoCallback): void;
1880
+ /**
1881
+ * Creates a directory in the DB.
1882
+ *
1883
+ * @param adapterName adapter name, or null for the current adapter
1884
+ * @param path path to the directory
1885
+ * @param options optional user context
1886
+ * @param callback return result
1887
+ */
1888
+ mkdir(adapterName: string | null, path: string, options: {
1889
+ user?: ioBroker.ObjectIDs.User;
1890
+ owner?: ioBroker.ObjectIDs.User;
1891
+ ownerGroup?: ioBroker.ObjectIDs.Group;
1892
+ }, callback: ioBroker.ErrnoCallback): void;
1893
+ /**
1894
+ * Read file from DB.
1895
+ *
1896
+ * @param adapterName adapter name, or null for the current adapter
1897
+ * @param path path to file without adapter name
1898
+ * @param callback return result
1899
+ */
698
1900
  readFile(adapterName: string | null, path: string, callback: ioBroker.ReadFileCallback): void;
699
- readFile(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ReadFileCallback): void;
1901
+ /**
1902
+ * Read file from DB.
1903
+ *
1904
+ * @param adapterName adapter name, or null for the current adapter
1905
+ * @param path path to file without adapter name
1906
+ * @param options optional user context
1907
+ * @param callback return result
1908
+ */
1909
+ readFile(adapterName: string | null, path: string, options: {
1910
+ user?: ioBroker.ObjectIDs.User;
1911
+ } | null, callback: ioBroker.ReadFileCallback): void;
1912
+ /**
1913
+ * Write file to DB.
1914
+ *
1915
+ * @param adapterName adapter name, or null for the current adapter
1916
+ * @param path path to the file
1917
+ * @param data data to write
1918
+ * @param callback return result
1919
+ */
700
1920
  writeFile(adapterName: string | null, path: string, data: Buffer | string, callback: ioBroker.ErrnoCallback): void;
701
- writeFile(adapterName: string | null, path: string, data: Buffer | string, options: unknown, callback: ioBroker.ErrnoCallback): void;
1921
+ /**
1922
+ * Write file to DB.
1923
+ *
1924
+ * @param adapterName adapter name, or null for the current adapter
1925
+ * @param path path to the file
1926
+ * @param data data to write
1927
+ * @param options optional user context
1928
+ * @param callback return result
1929
+ */
1930
+ writeFile(adapterName: string | null, path: string, data: Buffer | string, options: {
1931
+ virtualFile?: boolean;
1932
+ user?: ioBroker.ObjectIDs.User;
1933
+ group?: ioBroker.ObjectIDs.Group;
1934
+ mode?: number;
1935
+ mimeType?: string;
1936
+ } | null, callback: ioBroker.ErrnoCallback): void;
1937
+ /**
1938
+ * Checks if file exists in DB.
1939
+ *
1940
+ * @param adapterName adapter name
1941
+ * @param path path to file without adapter name
1942
+ */
702
1943
  fileExists(adapterName: string | null, path: string): Promise<boolean>;
1944
+ /**
1945
+ * Checks if file exists in DB.
1946
+ *
1947
+ * @param adapterName adapter name
1948
+ * @param path path to file without adapter name
1949
+ * @param callback cb function if none provided, a promise is returned
1950
+ */
703
1951
  fileExists(adapterName: string | null, path: string, callback?: ioBroker.GenericCallback<boolean>): void;
704
- fileExists(adapterName: string | null, path: string, options: unknown, callback: ioBroker.GenericCallback<boolean>): void;
1952
+ /**
1953
+ * Checks if file exists in DB.
1954
+ *
1955
+ * @param adapterName adapter name
1956
+ * @param path path to file without adapter name
1957
+ * @param options optional user context
1958
+ * @param callback cb function if none provided, a promise is returned
1959
+ */
1960
+ fileExists(adapterName: string | null, path: string, options: {
1961
+ user?: ioBroker.ObjectIDs.User;
1962
+ } | null, callback: ioBroker.GenericCallback<boolean>): void;
1963
+ /**
1964
+ * Formats a numeric value using the given format string.
1965
+ *
1966
+ * @param value the value to format
1967
+ * @param format optional format string for the decimal and thousands separator
1968
+ */
705
1969
  formatValue(value: number | string, format?: string): string;
1970
+ /**
1971
+ * Formats a numeric value using the given format string.
1972
+ *
1973
+ * @param value the value to format
1974
+ * @param decimals number of decimals to keep
1975
+ * @param format optional format string for the decimal and thousands separator
1976
+ */
706
1977
  formatValue(value: number | string, decimals: number, format?: string): string;
1978
+ /**
1979
+ * Formats a date according to the given format string.
1980
+ *
1981
+ * @param dateObj the date to format
1982
+ * @param format optional format string
1983
+ */
707
1984
  formatDate(dateObj: string | Date | number, format?: string): string;
1985
+ /**
1986
+ * Formats a date or duration according to the given format string.
1987
+ *
1988
+ * @param dateObj the date to format
1989
+ * @param isDuration whether the value represents a duration
1990
+ * @param format optional format string
1991
+ */
708
1992
  formatDate(dateObj: string | Date | number, isDuration: boolean | string, format?: string): string;
709
1993
  private _formatDate;
1994
+ /**
1995
+ * Send a message to a specific instance or all instances of some specific adapter.
1996
+ *
1997
+ * @param instanceName name of the instance to send the message to
1998
+ * @param message message to send
1999
+ * @param callback optional return result
2000
+ */
710
2001
  sendTo(instanceName: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
2002
+ /**
2003
+ * Send a message to a specific instance or all instances of some specific adapter.
2004
+ *
2005
+ * @param instanceName name of the instance to send the message to
2006
+ * @param command command name
2007
+ * @param message message to send
2008
+ * @param callback optional return result
2009
+ * @param options optional options to control the send behaviour
2010
+ */
711
2011
  sendTo(instanceName: string, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo, options?: SendToOptions): void;
712
- private _sendTo;
2012
+ /**
2013
+ * Send a message to a specific host or all hosts.
2014
+ *
2015
+ * @param hostName name of the host to send the message to, or null for all hosts
2016
+ * @param message message to send
2017
+ * @param callback optional return result
2018
+ */
713
2019
  sendToHost(hostName: string | null, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
2020
+ /**
2021
+ * Send a message to a specific host or all hosts.
2022
+ *
2023
+ * @param hostName name of the host to send the message to, or null for all hosts
2024
+ * @param command command name
2025
+ * @param message message to send
2026
+ * @param callback optional return result
2027
+ */
714
2028
  sendToHost(hostName: string | null, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
715
- private _sendToHost;
2029
+ /**
2030
+ * Send a message to an active UI Client
2031
+ *
2032
+ * @param options clientId and data options
2033
+ */
716
2034
  sendToUI(options: SendToUserInterfaceClientOptions): Promise<void>;
2035
+ /**
2036
+ * Send notification with given scope and category to host of this adapter
2037
+ *
2038
+ * @param scope scope to be addressed
2039
+ * @param category to be addressed, if a null message will be checked by regex of given scope
2040
+ * @param message message to be stored/checked
2041
+ * @param options Additional options for the notification, currently `contextData` is supported
2042
+ */
717
2043
  registerNotification<Scope extends keyof ioBroker.NotificationScopes>(scope: Scope, category: ioBroker.NotificationScopes[Scope] | null, message: string, options?: NotificationOptions): Promise<void>;
2044
+ /**
2045
+ * Writes value into states DB.
2046
+ *
2047
+ * @param id object ID of the state.
2048
+ * @param state simple value or object with attributes.
2049
+ * @param callback return result
2050
+ */
718
2051
  setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
2052
+ /**
2053
+ * Writes value into states DB.
2054
+ *
2055
+ * @param id object ID of the state.
2056
+ * @param state simple value or object with attributes.
2057
+ * @param ack optional is command(false) or status(true)
2058
+ * @param callback return result
2059
+ */
719
2060
  setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
720
- setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: Partial<GetUserGroupsOptions> | null, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
721
- setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: Partial<GetUserGroupsOptions> | null, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
2061
+ /**
2062
+ * Writes value into states DB.
2063
+ *
2064
+ * @param id object ID of the state.
2065
+ * @param state simple value or object with attributes.
2066
+ * @param options optional user context
2067
+ * @param callback return result
2068
+ */
2069
+ setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
2070
+ user?: ioBroker.ObjectIDs.User;
2071
+ } | null, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
2072
+ /**
2073
+ * Writes value into states DB.
2074
+ *
2075
+ * @param id object ID of the state.
2076
+ * @param state simple value or object with attributes.
2077
+ * @param ack optional is command(false) or status(true)
2078
+ * @param options optional user context
2079
+ * @param callback return result
2080
+ */
2081
+ setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
2082
+ user?: ioBroker.ObjectIDs.User;
2083
+ } | null, callback?: T): T extends unknown ? ioBroker.SetStatePromise : void;
722
2084
  private _setState;
723
2085
  private _getUserGroups;
724
2086
  private _checkState;
725
2087
  private _checkStates;
726
2088
  private _getGroups;
727
2089
  private _setStateChangedHelper;
2090
+ /**
2091
+ * Writes value into states DB only if the value really changed.
2092
+ *
2093
+ * @param id object ID of the state.
2094
+ * @param state simple value or object with attributes.
2095
+ * @param callback return result
2096
+ */
728
2097
  setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, callback?: ioBroker.SetStateChangedCallback): void;
2098
+ /**
2099
+ * Writes value into states DB only if the value really changed.
2100
+ *
2101
+ * @param id object ID of the state.
2102
+ * @param state simple value or object with attributes.
2103
+ * @param ack optional is command(false) or status(true)
2104
+ * @param callback return result
2105
+ */
729
2106
  setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, callback?: ioBroker.SetStateChangedCallback): void;
730
- setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options: unknown, callback?: ioBroker.SetStateChangedCallback): void;
731
- setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown, callback?: ioBroker.SetStateChangedCallback): void;
2107
+ /**
2108
+ * Writes value into states DB only if the value really changed.
2109
+ *
2110
+ * @param id object ID of the state.
2111
+ * @param state simple value or object with attributes.
2112
+ * @param options optional user context
2113
+ * @param callback return result
2114
+ */
2115
+ setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
2116
+ user?: ioBroker.ObjectIDs.User;
2117
+ } | null, callback?: ioBroker.SetStateChangedCallback): void;
2118
+ /**
2119
+ * Writes value into states DB only if the value really changed.
2120
+ *
2121
+ * @param id object ID of the state.
2122
+ * @param state simple value or object with attributes.
2123
+ * @param ack optional is command(false) or status(true)
2124
+ * @param options optional user context
2125
+ * @param callback return result
2126
+ */
2127
+ setStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
2128
+ user?: ioBroker.ObjectIDs.User;
2129
+ } | null, callback?: ioBroker.SetStateChangedCallback): void;
732
2130
  private _setStateChanged;
2131
+ /**
2132
+ * Writes value into states DB for any instance.
2133
+ *
2134
+ * @param id object ID of the state.
2135
+ * @param state simple value or object with attributes.
2136
+ * @param callback return result
2137
+ */
733
2138
  setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, callback?: ioBroker.SetStateCallback): void;
2139
+ /**
2140
+ * Writes value into states DB for any instance.
2141
+ *
2142
+ * @param id object ID of the state.
2143
+ * @param state simple value or object with attributes.
2144
+ * @param ack optional is command(false) or status(true)
2145
+ * @param callback return result
2146
+ */
734
2147
  setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, callback?: ioBroker.SetStateCallback): void;
735
- setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options: unknown, callback?: ioBroker.SetStateCallback): void;
736
- setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown, callback?: ioBroker.SetStateCallback): void;
2148
+ /**
2149
+ * Writes value into states DB for any instance.
2150
+ *
2151
+ * @param id object ID of the state.
2152
+ * @param state simple value or object with attributes.
2153
+ * @param options optional user context
2154
+ * @param callback return result
2155
+ */
2156
+ setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
2157
+ user?: ioBroker.ObjectIDs.User;
2158
+ } | null, callback?: ioBroker.SetStateCallback): void;
2159
+ /**
2160
+ * Writes value into states DB for any instance.
2161
+ *
2162
+ * @param id object ID of the state.
2163
+ * @param state simple value or object with attributes.
2164
+ * @param ack optional is command(false) or status(true)
2165
+ * @param options optional user context
2166
+ * @param callback return result
2167
+ */
2168
+ setForeignState(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
2169
+ user?: ioBroker.ObjectIDs.User;
2170
+ } | null, callback?: ioBroker.SetStateCallback): void;
2171
+ /**
2172
+ * Writes value into states DB for any instance only if the value really changed.
2173
+ *
2174
+ * @param id object ID of the state.
2175
+ * @param state simple value or object with attributes.
2176
+ * @param callback return result
2177
+ */
737
2178
  setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, callback?: ioBroker.SetStateChangedCallback): void;
2179
+ /**
2180
+ * Writes value into states DB for any instance only if the value really changed.
2181
+ *
2182
+ * @param id object ID of the state.
2183
+ * @param state simple value or object with attributes.
2184
+ * @param ack optional is command(false) or status(true)
2185
+ * @param callback return result
2186
+ */
738
2187
  setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, callback?: ioBroker.SetStateChangedCallback): void;
739
- setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options: unknown, callback?: ioBroker.SetStateChangedCallback): void;
740
- setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown, callback?: ioBroker.SetStateChangedCallback): void;
2188
+ /**
2189
+ * Writes value into states DB for any instance only if the value really changed.
2190
+ *
2191
+ * @param id object ID of the state.
2192
+ * @param state simple value or object with attributes.
2193
+ * @param options optional user context
2194
+ * @param callback return result
2195
+ */
2196
+ setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: {
2197
+ user?: ioBroker.ObjectIDs.User;
2198
+ } | null, callback?: ioBroker.SetStateChangedCallback): void;
2199
+ /**
2200
+ * Writes value into states DB for any instance only if the value really changed.
2201
+ *
2202
+ * @param id object ID of the state.
2203
+ * @param state simple value or object with attributes.
2204
+ * @param ack optional is command(false) or status(true)
2205
+ * @param options optional user context
2206
+ * @param callback return result
2207
+ */
2208
+ setForeignStateChanged(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options?: {
2209
+ user?: ioBroker.ObjectIDs.User;
2210
+ } | null, callback?: ioBroker.SetStateChangedCallback): void;
2211
+ /**
2212
+ * Read value from states DB.
2213
+ *
2214
+ * @param id object ID of the state.
2215
+ * @param callback return result
2216
+ */
741
2217
  getState(id: string, callback: ioBroker.GetStateCallback): void;
742
- getState(id: string, options: unknown, callback: ioBroker.GetStateCallback): void;
2218
+ /**
2219
+ * Read value from states DB.
2220
+ *
2221
+ * @param id object ID of the state.
2222
+ * @param options optional user context
2223
+ * @param callback return result
2224
+ */
2225
+ getState(id: string, options: {
2226
+ user?: ioBroker.ObjectIDs.User;
2227
+ } | null | undefined, callback: ioBroker.GetStateCallback): void;
2228
+ /**
2229
+ * Read value from states DB for any instance and system state.
2230
+ *
2231
+ * @param id object ID of the state.
2232
+ * @param callback return result
2233
+ */
743
2234
  getForeignState(id: string, callback: ioBroker.GetStateCallback): ioBroker.GetStatePromise;
744
- getForeignState(id: string, options: unknown, callback: ioBroker.GetStateCallback): ioBroker.GetStatePromise;
2235
+ /**
2236
+ * Read value from states DB for any instance and system state.
2237
+ *
2238
+ * @param id object ID of the state.
2239
+ * @param options optional user context
2240
+ * @param callback return result
2241
+ */
2242
+ getForeignState(id: string, options: {
2243
+ user?: ioBroker.ObjectIDs.User;
2244
+ } | null | undefined, callback: ioBroker.GetStateCallback): ioBroker.GetStatePromise;
745
2245
  private _getForeignState;
746
2246
  private _getDefaultHistory;
2247
+ /**
2248
+ * Read historian data for states of any instance or system state.
2249
+ *
2250
+ * @param id object ID of the state.
2251
+ * @param options the query options for the history
2252
+ * @param callback return result
2253
+ */
747
2254
  getHistory(id: string, options: ioBroker.GetHistoryOptions, callback: ioBroker.GetHistoryCallback): void;
2255
+ /**
2256
+ * Read historian data for states of any instance or system state.
2257
+ *
2258
+ * @param id object ID of the state.
2259
+ * @param callback return result
2260
+ */
748
2261
  getHistory(id: string, callback: ioBroker.GetHistoryCallback): void;
749
2262
  private _getHistory;
2263
+ /**
2264
+ * Convert ID into object with device's, channel's and state's name.
2265
+ *
2266
+ * @param id short or long string of ID like "stateID" or "adapterName.0.stateID".
2267
+ * @returns parsed ID as an object
2268
+ */
750
2269
  idToDCS(id: string): {
751
2270
  device: string;
752
2271
  channel: string;
753
2272
  state: string;
754
2273
  } | null;
2274
+ /**
2275
+ * Deletes a state of this instance. The object is NOT deleted.
2276
+ *
2277
+ * @param id exactly object ID (without namespace)
2278
+ * @param callback return result
2279
+ */
755
2280
  delState(id: string, callback?: ioBroker.ErrorCallback): void;
756
- delState(id: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
2281
+ /**
2282
+ * Deletes a state of this instance. The object is NOT deleted.
2283
+ *
2284
+ * @param id exactly object ID (without namespace)
2285
+ * @param options optional user context
2286
+ * @param callback return result
2287
+ */
2288
+ delState(id: string, options?: {
2289
+ user?: ioBroker.ObjectIDs.User;
2290
+ } | null, callback?: ioBroker.ErrorCallback): void;
757
2291
  private _delState;
2292
+ /**
2293
+ * Deletes a state of any adapter. The object is NOT deleted.
2294
+ *
2295
+ * @param id long string for ID like "adapterName.0.stateID".
2296
+ * @param callback return result
2297
+ */
758
2298
  delForeignState(id: string, callback?: ioBroker.ErrorCallback): void;
759
- delForeignState(id: string, options: unknown, callback?: ioBroker.ErrorCallback): void;
2299
+ /**
2300
+ * Deletes a state of any adapter. The object is NOT deleted.
2301
+ *
2302
+ * @param id long string for ID like "adapterName.0.stateID".
2303
+ * @param options optional argument to describe the user context
2304
+ * @param callback return result
2305
+ */
2306
+ delForeignState(id: string, options?: {
2307
+ user?: ioBroker.ObjectIDs.User;
2308
+ } | null, callback?: ioBroker.ErrorCallback): void;
760
2309
  private _delForeignState;
2310
+ /**
2311
+ * Read all states of this adapter, that pass the pattern
2312
+ *
2313
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2314
+ * @param callback return result
2315
+ */
761
2316
  getStates(pattern: Pattern, callback: ioBroker.GetStatesCallback): void;
762
- getStates(pattern: Pattern, options: unknown, callback: ioBroker.GetStatesCallback): void;
2317
+ /**
2318
+ * Read all states of this adapter, that pass the pattern
2319
+ *
2320
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2321
+ * @param options optional argument to describe the user context
2322
+ * @param callback return result
2323
+ */
2324
+ getStates(pattern: Pattern, options: {
2325
+ user?: ioBroker.ObjectIDs.User;
2326
+ } | null | undefined, callback: ioBroker.GetStatesCallback): void;
763
2327
  private _processStatesSecondary;
764
2328
  /**
765
2329
  * Ensures, that object information is read, and the alias id is mapped to the source id if an alias is contained in the getStates call
@@ -769,37 +2333,114 @@ export declare class AdapterClass extends EventEmitter {
769
2333
  * @param targetObjs the target objects (e.g. alias objects or the actual objects)
770
2334
  */
771
2335
  private _processStates;
2336
+ /**
2337
+ * Read all states of all adapters (and system states), that pass the pattern
2338
+ *
2339
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2340
+ * @param callback return result
2341
+ */
772
2342
  getForeignStates(pattern: Pattern, callback: ioBroker.GetStatesCallback): void;
773
- getForeignStates(pattern: Pattern, options: unknown, callback: ioBroker.GetStatesCallback): void;
774
- private _getForeignStates;
775
2343
  /**
776
- * Add subscription for given alias, if it is not a state it will be ignored
2344
+ * Read all states of all adapters (and system states), that pass the pattern
777
2345
  *
778
- * @param aliasObj the alias object
779
- * @param pattern pattern to subscribe for
2346
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2347
+ * @param options optional user context
2348
+ * @param callback return result
780
2349
  */
781
- private _addAliasSubscribe;
2350
+ getForeignStates(pattern: Pattern, options: {
2351
+ user?: ioBroker.ObjectIDs.User;
2352
+ } | null | undefined, callback: ioBroker.GetStatesCallback): void;
2353
+ private _getForeignStates;
782
2354
  /**
783
- * Remove an alias subscribe
2355
+ * Subscribe for changes on all states of all adapters (and system states), that pass the pattern
784
2356
  *
785
- * @param sourceId id of the source object
786
- * @param aliasObjOrIdx the alias target or the index of the targets array
2357
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2358
+ * @param callback optional callback
787
2359
  */
788
- private _removeAliasSubscribe;
789
2360
  subscribeForeignStates(pattern: Pattern, callback?: ioBroker.ErrorCallback): void;
790
- subscribeForeignStates(pattern: Pattern, options: unknown, callback?: ioBroker.ErrorCallback): void;
791
- private _subscribeForeignStates;
2361
+ /**
2362
+ * Subscribe for changes on all states of all adapters (and system states), that pass the pattern
2363
+ *
2364
+ * @param pattern string in form 'adapter.0.*' or like this. It can be an array of IDs too.
2365
+ * @param options optional argument to describe the user context
2366
+ * @param callback optional callback
2367
+ */
2368
+ subscribeForeignStates(pattern: Pattern, options?: {
2369
+ user?: ioBroker.ObjectIDs.User;
2370
+ } | null, callback?: ioBroker.ErrorCallback): void;
2371
+ /**
2372
+ * Unsubscribe for changes for given pattern
2373
+ *
2374
+ * @param pattern string in form 'adapter.0.*'. Must be the same as subscribe.
2375
+ * @param callback optional callback
2376
+ */
792
2377
  unsubscribeForeignStates(pattern: string | string[], callback?: ioBroker.ErrorCallback): void;
793
- unsubscribeForeignStates(pattern: string | string[], options: unknown, callback?: ioBroker.ErrorCallback): void;
794
- private _unsubscribeForeignStates;
2378
+ /**
2379
+ * Unsubscribe for changes for given pattern
2380
+ *
2381
+ * @param pattern string in form 'adapter.0.*'. Must be the same as subscribe.
2382
+ * @param options optional argument to describe the user context
2383
+ * @param callback optional callback
2384
+ */
2385
+ unsubscribeForeignStates(pattern: string | string[], options: {
2386
+ user?: ioBroker.ObjectIDs.User;
2387
+ } | null, callback?: ioBroker.ErrorCallback): void;
2388
+ /**
2389
+ * Subscribe for changes on all states of this instance, that pass the pattern
2390
+ *
2391
+ * @param pattern string in form 'adapter.0.*' or like this. Only string allowed
2392
+ * @param callback optional callback
2393
+ */
795
2394
  subscribeStates(pattern: Pattern, callback?: ioBroker.ErrorCallback): void;
796
- subscribeStates(pattern: Pattern, options: unknown, callback?: ioBroker.ErrorCallback): void;
2395
+ /**
2396
+ * Subscribe for changes on all states of this instance, that pass the pattern
2397
+ *
2398
+ * @param pattern string in form 'adapter.0.*' or like this. Only string allowed
2399
+ * @param options optional argument to describe the user context
2400
+ * @param callback optional callback
2401
+ */
2402
+ subscribeStates(pattern: Pattern, options?: {
2403
+ user?: ioBroker.ObjectIDs.User;
2404
+ } | null, callback?: ioBroker.ErrorCallback): void;
2405
+ /**
2406
+ * Unsubscribe for changes for given pattern for own states.
2407
+ *
2408
+ * @param pattern string in form 'adapter.0.*'. Must be the same as subscribe.
2409
+ * @param callback optional callback
2410
+ */
797
2411
  unsubscribeStates(pattern: Pattern, callback?: ioBroker.ErrorCallback): void;
798
- unsubscribeStates(pattern: Pattern, options: unknown, callback?: ioBroker.ErrorCallback): void;
2412
+ /**
2413
+ * Unsubscribe for changes for given pattern for own states.
2414
+ *
2415
+ * @param pattern string in form 'adapter.0.*'. Must be the same as subscribe.
2416
+ * @param options optional argument to describe the user context
2417
+ * @param callback optional callback
2418
+ */
2419
+ unsubscribeStates(pattern: Pattern, options?: {
2420
+ user?: ioBroker.ObjectIDs.User;
2421
+ } | null, callback?: ioBroker.ErrorCallback): void;
2422
+ /**
2423
+ * Return plugin instance
2424
+ *
2425
+ * @param name name of the plugin to return
2426
+ * @returns plugin instance or null if not existent or not isActive
2427
+ */
799
2428
  getPluginInstance(name: string): ioBroker.Plugin | null;
2429
+ /**
2430
+ * Return plugin configuration
2431
+ *
2432
+ * @param name name of the plugin to return
2433
+ * @returns plugin configuration or null if not existent or not isActive
2434
+ */
800
2435
  getPluginConfig(name: string): Record<string, any> | null;
801
- private _autoSubscribeOn;
802
- getSuitableLicenses(all?: boolean, adapterName?: string): Promise<any[]>;
2436
+ /**
2437
+ * This method returns the list of license that can be used by this adapter
2438
+ *
2439
+ * @param all if return the licenses, that used by other instances (true) or only for this instance (false)
2440
+ * @param adapterName Return licenses for specific adapter
2441
+ * @returns list of suitable licenses
2442
+ */
2443
+ getSuitableLicenses(all?: boolean, adapterName?: string): Promise<SuitableLicense[]>;
803
2444
  /**
804
2445
  * Add given id to log redirect list
805
2446
  *