@iobroker/json-config 7.2.6 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1402 -0
- package/build/JsonConfig.js +2 -2
- package/build/JsonConfig.js.map +1 -1
- package/build/JsonConfigComponent/ChipInput.js +3 -4
- package/build/JsonConfigComponent/ChipInput.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js +2 -2
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.js +2 -2
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.js +2 -2
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.js +2 -2
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js +2 -2
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.js +2 -2
- package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js +2 -2
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js +2 -2
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckbox.js +2 -2
- package/build/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.js +2 -2
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigColor.js +2 -2
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js +2 -2
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCustom.js +2 -2
- package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDatePicker.js +2 -2
- package/build/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigDeviceManager.js +2 -2
- package/build/JsonConfigComponent/ConfigDeviceManager.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.js +2 -2
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.js +3 -3
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js +2 -2
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.js +2 -2
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.js +2 -2
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js +2 -2
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.js +2 -2
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.js +2 -2
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.js +2 -2
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.js +2 -2
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.js +2 -2
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.js +2 -2
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js +2 -2
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +4 -4
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.js +6 -14
- package/build/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPattern.js +2 -2
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.js +2 -2
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCode.js +2 -2
- package/build/JsonConfigComponent/ConfigQrCode.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js +2 -2
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js +2 -2
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +2 -2
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js +2 -2
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSlider.js +2 -2
- package/build/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js +2 -2
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.js +2 -3
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticHeader.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js +2 -2
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.d.ts +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +2 -2
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.js +2 -2
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.js +2 -2
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js +2 -2
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTopic.js +2 -2
- package/build/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js +2 -2
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.js +2 -2
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/Icons.js +1 -1
- package/build/JsonConfigComponent/Icons.js.map +1 -1
- package/build/JsonConfigComponent/index.js +0 -1
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/Editor.js +1 -1
- package/build/JsonConfigComponent/wrapper/Components/Editor.js.map +1 -1
- package/build/Utils.d.ts +1 -1
- package/build/Utils.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js.map +1 -1
- package/build/types.d.ts +3 -3
- package/package.json +5 -13
package/README.md
ADDED
|
@@ -0,0 +1,1402 @@
|
|
|
1
|
+
# ioBroker JSON Configuration: A Guide for Beginners
|
|
2
|
+
|
|
3
|
+
This guide explains how to define configuration options for your ioBroker adapter using JSON. This approach offers a more user-friendly and flexible way to manage adapter settings within the ioBroker Admin interface.
|
|
4
|
+
|
|
5
|
+
## What you'll need
|
|
6
|
+
|
|
7
|
+
- ioBroker Admin version 6 (or newer)
|
|
8
|
+
- Basic understanding of JSON syntax
|
|
9
|
+
|
|
10
|
+
## Benefits of JSON Configuration
|
|
11
|
+
|
|
12
|
+
- Improved user experience for configuring adapters
|
|
13
|
+
- Easier integration of complex configuration options
|
|
14
|
+
- Clear separation between adapter code and configuration
|
|
15
|
+
|
|
16
|
+
## Getting Started
|
|
17
|
+
|
|
18
|
+
1. **Define the Configuration File:**
|
|
19
|
+
|
|
20
|
+
- Create a file named `jsonConfig.json` or `jsonConfig.json5` in your adapter's admin directory.
|
|
21
|
+
- JSON5 is a superset of JSON that allows for comments, making the configuration file more readable.
|
|
22
|
+
|
|
23
|
+
2. **Enable JSON Configuration:**
|
|
24
|
+
|
|
25
|
+
- In your adapter's `io-package.json` file, add the following line under the `common` section:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
"common": {
|
|
29
|
+
"adminUI": {
|
|
30
|
+
"config": "json"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. **Structure of the Configuration File:**
|
|
36
|
+
|
|
37
|
+
The configuration file defines a hierarchical structure of tabs, panels, and control elements. \
|
|
38
|
+
Each element has specific attributes that determine its behavior and appearance in the Admin interface.
|
|
39
|
+
|
|
40
|
+
jsonConfig automatically ensures that the collected data is recorded as configuration data for the adapter and stored internally so that it can be retrieved and further processed in the adapter.
|
|
41
|
+
|
|
42
|
+
The following example would create the following configuration object:
|
|
43
|
+
|
|
44
|
+
```json5
|
|
45
|
+
{
|
|
46
|
+
options1: {
|
|
47
|
+
myPort: 1234,
|
|
48
|
+
options: {
|
|
49
|
+
myType: 1,
|
|
50
|
+
},
|
|
51
|
+
myBool: false,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
_If the attribute name starts with "\_" it will not be saved in the object._
|
|
57
|
+
|
|
58
|
+
## Example of a jsonConfig with multiple tabs
|
|
59
|
+
|
|
60
|
+
```json5
|
|
61
|
+
{
|
|
62
|
+
"type": "tabs",
|
|
63
|
+
"items": {
|
|
64
|
+
"options1": {
|
|
65
|
+
"type": "panel",
|
|
66
|
+
"label": "Tab1",
|
|
67
|
+
"icon": "base64 svg", // optional
|
|
68
|
+
"items": {
|
|
69
|
+
myPort: {
|
|
70
|
+
"type": "number",
|
|
71
|
+
"min": 1,
|
|
72
|
+
"max": 65565,
|
|
73
|
+
"label": "Number",
|
|
74
|
+
"sm": 6, // 1 - 12
|
|
75
|
+
"validator": "!!data.name", // else error
|
|
76
|
+
"hidden": "data.myType === 1", // hidden if myType is 1
|
|
77
|
+
"disabled": "data.myType === 2" // disabled if myType is 2
|
|
78
|
+
},
|
|
79
|
+
"options.myType": { // name could support more than one level
|
|
80
|
+
"newLine": true, // must start from new row
|
|
81
|
+
"type": "select",
|
|
82
|
+
"label": "Type",
|
|
83
|
+
"sm": 6, // 1 - 12
|
|
84
|
+
"options": [
|
|
85
|
+
{"label": "option 1", "value": 1},
|
|
86
|
+
{"label": "option 2", "value": 2}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"myBool": {
|
|
90
|
+
"type": "checkbox",
|
|
91
|
+
"label": "My checkbox",
|
|
92
|
+
},
|
|
93
|
+
"_notSaved":"abc"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"tab2": {
|
|
97
|
+
"label": "Tab2",
|
|
98
|
+
"type": "panel",
|
|
99
|
+
"disabled": "data.myType === 1",
|
|
100
|
+
"hidden": "data.myType === 2",
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Further examples can be found in many other adapters on GitHub in the respective admin directory.
|
|
107
|
+
|
|
108
|
+
## Support for developing tools
|
|
109
|
+
|
|
110
|
+
### VS Code
|
|
111
|
+
|
|
112
|
+
To enable the validation of the jsonConfig in VS code, the following section must be added to the file ".vscode/settings.json".
|
|
113
|
+
|
|
114
|
+
```json5
|
|
115
|
+
"json.schemas": [
|
|
116
|
+
{
|
|
117
|
+
"fileMatch": ["admin/jsonConfig.json", "admin/jsonCustom.json", "admin/jsonTab.json"],
|
|
118
|
+
"url": "https://raw.githubusercontent.com/ioBroker/adapter-react-v5/main/schemas/jsonConfig.json"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Common Control Elements
|
|
124
|
+
|
|
125
|
+
A jsonConfig consists of several elements that are structured hierarchically. \
|
|
126
|
+
Each of the elements can be of one of the following types.\
|
|
127
|
+
Some elements can contain additional child elements.
|
|
128
|
+
|
|
129
|
+
You can see almost all components in action if you test this adapter: [jsonconfig-demo](https://github.com/mcm4iob/ioBroker.jsonconfig-demo).\
|
|
130
|
+
You can install it via GitHub icon in admin by entering `iobroker.jsonconfig-demo` on the npm tab.
|
|
131
|
+
|
|
132
|
+
- [**`accordion`:**](#accordion) Accordion element for collapsible content (Admin 6.6.0 or newer)
|
|
133
|
+
- [**`alive`:**](#alive) Displays if an instance is running (read-only)
|
|
134
|
+
- [**`autocomplete`:**](#autocomplete) Input field with autocomplete suggestions
|
|
135
|
+
- [**`autocompleteSendTo`:**](#autocompletesendto) Autocomplete control with instance values for sending data
|
|
136
|
+
- [**`certificate`:**](#certificate) Manages certificates for secure connections
|
|
137
|
+
- [**`certificateCollection`:**](#certificatecollection) Selects a collection for Let's Encrypt certificates
|
|
138
|
+
- [**`certificates`:**](#certificates) Universal type for managing different certificate types (from Admin 6.4.0)
|
|
139
|
+
- [**`checkbox`:**](#checkbox) Checkbox for boolean values
|
|
140
|
+
- [**`checkLicense`:**](#checklicense) Very special component to check the license online
|
|
141
|
+
- [**`chips`:**](#chips) User can enter words that are added to an array
|
|
142
|
+
- [**`color`:**](#color) Color picker
|
|
143
|
+
- [**`cron`:**](#cron) Configures cron expressions for scheduling tasks
|
|
144
|
+
- [**`custom`:**](#custom) Integrates custom components for specific functionalities (Admin 6 only)
|
|
145
|
+
- [**`datePicker`:**](#datepicker) Allows users to select a date
|
|
146
|
+
- [**`deviceManager`:**](#devicemanager) show device manager
|
|
147
|
+
- [**`divider`:**](#divider) Creates a horizontal line separator
|
|
148
|
+
- [**`file`:**](#file) Input field with file selection and optional upload/download capabilities (Admin 6 only)
|
|
149
|
+
- [**`fileSelector`:**](#fileselector) Allows users to select files from the system (only Admin6)
|
|
150
|
+
- [**`func`:**](#func) Selects a function from the enum.func list (Admin 6 only)
|
|
151
|
+
- [**`header`:**](#header) Creates a heading with different sizes (h1-h5)
|
|
152
|
+
- [**`image`:**](#image) Uploads or displays an image
|
|
153
|
+
- [**`imageSendTo`:**](#imagesendto) Displays an image received from the backend and sends data based on a command
|
|
154
|
+
- [**`instance`:**](#instance) Selects an adapter instance
|
|
155
|
+
- [**`interface`:**](#interface) Selects the interface from of the host, where the instance runs
|
|
156
|
+
- [**`ip`:**](#ip) Input field for IP addresses with advanced options
|
|
157
|
+
- [**`jsonEditor`:**](#jsoneditor) JSON editor for complex configuration data
|
|
158
|
+
- [**`language`:**](#language) Selects the user interface language
|
|
159
|
+
- [**`license`:**](#license) shows the license information if not already accepted.
|
|
160
|
+
- [**`number`:**](#number) Numeric input field with min/max values and step size
|
|
161
|
+
- [**`objectId`:**](#objectid) Selects an object ID with name, color, and icon
|
|
162
|
+
- [**`panel`:**](#panel) Tab with items
|
|
163
|
+
- [**`password`:**](#password) Password input field
|
|
164
|
+
- [**`pattern`:**](#pattern) Read-only field showing a pattern (e.g., URL)
|
|
165
|
+
- [**`port`:**](#port) Special input for ports
|
|
166
|
+
- [**`qrCode`:**](#qrcode) Displays data as a QR code (Admin 7.0.18 or newer)
|
|
167
|
+
- [**`room`:**](#room) Selects a room from the `enum.room` list (Admin 6 only)
|
|
168
|
+
- [**`select`:**](#select) Dropdown menu with predefined options
|
|
169
|
+
- [**`selectSendTo`:**](#selectsendto) Dropdown menu with instance values for sending data
|
|
170
|
+
- [**`sendTo`:**](#sendto) Button that sends a request to an instance
|
|
171
|
+
- [**`setState`:**](#setstate) Button that sets an instance's state
|
|
172
|
+
- [**`slider`:**](#slider) Slider for selecting a value within a range (Admin 6 only)
|
|
173
|
+
- [**`state`:**](#state) (admin >= 7.1.0) Show control or information from the state
|
|
174
|
+
- [**`staticImage`:**](#staticimage) Displays a static image
|
|
175
|
+
- [**`staticLink`:**](#staticlink) Creates a static link
|
|
176
|
+
- [**`staticText`:**](#statictext) Displays static text (e.g., description)
|
|
177
|
+
- [**`coordinates`:**](#coordinates) Determines current location and used `system.config` coordinates if not possible in form "latitude,longitude"
|
|
178
|
+
- [**`table`:**](#table) Table with rows that can be added, deleted, or reordered
|
|
179
|
+
- [**`tabs`:**](#tabs) Tabs with items
|
|
180
|
+
- [**`text`:**](#text) Single-line text input field
|
|
181
|
+
- [**`textSendTo`:**](#textsendto) Shows readonly control with the given from the instance values.
|
|
182
|
+
- [**`timePicker`:**](#timepicker) Allows users to select a time
|
|
183
|
+
- [**`user`:**](#user) Selects a user from the `system.user` list
|
|
184
|
+
- [**`uuid`:**](#uuid) Show iobroker UUID
|
|
185
|
+
|
|
186
|
+
By leveraging JSON configuration, you can create a user-friendly and \
|
|
187
|
+
adaptable configuration experience for your ioBroker adapter.
|
|
188
|
+
|
|
189
|
+
## Example projects
|
|
190
|
+
|
|
191
|
+
| Type | Link |
|
|
192
|
+
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
193
|
+
| Multiple Tabs: | [`ioBroker.admin`](https://github.com/ioBroker/ioBroker.admin/blob/master/admin/jsonConfig.json5) |
|
|
194
|
+
| Only one Panel: | [`ioBroker.dwd`](https://github.com/ioBroker/ioBroker.dwd/blob/master/admin/jsonConfig.json) |
|
|
195
|
+
| Custom component: | [`telegram`](https://github.com/iobroker-community-adapters/ioBroker.telegram/tree/master/src-admin) or in [`pushbullet`](https://github.com/Jens1809/ioBroker.pushbullet/tree/master/src-admin) |
|
|
196
|
+
| Validation: | |
|
|
197
|
+
|
|
198
|
+
## Separation of the large Configurations
|
|
199
|
+
|
|
200
|
+
## Includes
|
|
201
|
+
|
|
202
|
+
Requires admin 6.17.1 or newer.
|
|
203
|
+
|
|
204
|
+
To write complex JSON files, you can include other JSON files.
|
|
205
|
+
The included file must be in the same directory as the main file.
|
|
206
|
+
|
|
207
|
+
```json5
|
|
208
|
+
{
|
|
209
|
+
tabs: {
|
|
210
|
+
tab1: {
|
|
211
|
+
type: "panel", // data will be combined with the content of "tab1.json". If the same attribute is defined in both files, the value from the included file will be used.
|
|
212
|
+
"#include": "tab1.json",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## i18n - Internationalization
|
|
219
|
+
|
|
220
|
+
There are several options to provide the translations. Only the first one is compatible with our Community Translation Tool Weblate, so it should be favored over the others!
|
|
221
|
+
|
|
222
|
+
To enable the translation feature, you need to provide and enable the i18n property at the top level of the JSON configuration object.
|
|
223
|
+
|
|
224
|
+
```json5
|
|
225
|
+
{
|
|
226
|
+
i18n: true,
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Translation in separated files: compatible with weblate
|
|
231
|
+
|
|
232
|
+
By default, the files must be located in the following directories:
|
|
233
|
+
|
|
234
|
+
```text
|
|
235
|
+
admin/i18n/de/translations.json
|
|
236
|
+
admin/i18n/en/translations.json
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
or
|
|
240
|
+
|
|
241
|
+
```text
|
|
242
|
+
admin/i18n/de.json
|
|
243
|
+
admin/i18n/en.json
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Additionally, user can provide the path to `i18n` files, `i18n`: `customI18n` and provide files in admin:
|
|
247
|
+
|
|
248
|
+
```json5
|
|
249
|
+
i18n: "customI18n",
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
admin/customI18n/de/translations.json
|
|
254
|
+
admin/customI18n/en/translations.json
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
or
|
|
258
|
+
|
|
259
|
+
```text
|
|
260
|
+
admin/customI18n/de.json
|
|
261
|
+
admin/customI18n/en.json
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The structure of a file corresponds to the following structure
|
|
265
|
+
|
|
266
|
+
**en.json:**
|
|
267
|
+
|
|
268
|
+
```json5
|
|
269
|
+
{
|
|
270
|
+
i18nText1: "Open",
|
|
271
|
+
i18nText2: "Close",
|
|
272
|
+
"This is a Text": "This is a Text",
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**de.json:**
|
|
277
|
+
|
|
278
|
+
```json5
|
|
279
|
+
{
|
|
280
|
+
i18nText1: "Öffnen",
|
|
281
|
+
i18nText2: "Schließen",
|
|
282
|
+
"This is a Text": "Dies ist ein Text",
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
When searching for a translation, the information in the specific field is used to find the property with the text in the files. If the property is not found, the information from the field remains. It is recommended to enter the text in English.
|
|
287
|
+
|
|
288
|
+
### Provide translation directly in the fields
|
|
289
|
+
|
|
290
|
+
Translations can be specified in all fields that can contain text. Examples of fields are label, title, tooltip, text, etc.
|
|
291
|
+
|
|
292
|
+
```json5
|
|
293
|
+
"type": "text",
|
|
294
|
+
"label: {
|
|
295
|
+
"en": "house",
|
|
296
|
+
"de": "Haus"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Provide translation directly in the i18n
|
|
302
|
+
|
|
303
|
+
The translations can also be provided directly as an object in the `i18n` attribute at the top level of the `jsonConfig` object.
|
|
304
|
+
|
|
305
|
+
When searching for a translation, the information in the specific field is used to find the property with the text in the i18n object.
|
|
306
|
+
If the property is not found, the information from the field remains.
|
|
307
|
+
It is recommended to enter the text in English.
|
|
308
|
+
|
|
309
|
+
## Element types
|
|
310
|
+
|
|
311
|
+
Each element can have [common attributes](#common-attributes-of-controls) and the special attributes belonging to the respective type as follows
|
|
312
|
+
|
|
313
|
+
### `tabs`
|
|
314
|
+
|
|
315
|
+
Tabs with items
|
|
316
|
+
|
|
317
|
+
| Property | Description |
|
|
318
|
+
|-----------------|------------------------------------------------------------------------------------------------|
|
|
319
|
+
| `items` | Object with panels `{"tab1": {}, "tab2": {}...}` |
|
|
320
|
+
| `iconPosition` | `bottom`, `end`, `start` or `top`. Only for panels that has `icon` attribute. Default: `start` |
|
|
321
|
+
| `tabsStyle` | CSS Styles in React format (`marginLeft` and not `margin-left`) for the Mui-Tabs component |
|
|
322
|
+
|
|
323
|
+
### `panel`
|
|
324
|
+
|
|
325
|
+
Tab with items
|
|
326
|
+
|
|
327
|
+
| Property | Description |
|
|
328
|
+
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------|
|
|
329
|
+
| `icon` | tab can have icon (base64 like `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) |
|
|
330
|
+
| `label` | Label of tab |
|
|
331
|
+
| `items` | Object `{"attr1": {}, "attr2": {}}...` |
|
|
332
|
+
| `collapsable` | only possible as not part of tabs[jsonConfig.json](..%2F..%2F..%2F..%2F..%2FioBroker.ring%2Fadmin%2FjsonConfig.json) |
|
|
333
|
+
| `color` | color of collapsable header `primary` or `secondary` or nothing |
|
|
334
|
+
| `innerStyle` | CSS Styles for inner div in React format (`marginLeft` and not `margin-left`) for the Panel component. Not used for collapsable panels. |
|
|
335
|
+
|
|
336
|
+
### `text`
|
|
337
|
+
|
|
338
|
+
Text component
|
|
339
|
+
|
|
340
|
+
| Property | Description |
|
|
341
|
+
|-----------------|--------------------------------------------------------------------------------------------------------|
|
|
342
|
+
| `maxLength` | max length of the text in field |
|
|
343
|
+
| `readOnly` | read-only field |
|
|
344
|
+
| `trim` | default is true. Set this attribute to `false` if trim is not desired. |
|
|
345
|
+
| `minRows` | default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. |
|
|
346
|
+
| `maxRows` | max rows of textarea. Used only if `minRows` > 1. |
|
|
347
|
+
| `noClearButton` | if true, the clear button will not be shown (admin >= 6.17.13) |
|
|
348
|
+
| `validateJson` | if true, the text will be validated as JSON |
|
|
349
|
+
| `allowEmpty` | if true, the JSON will be validated only if the value is not empty |
|
|
350
|
+
| `time` | the value is time in ms or a string. Used only with readOnly flag |
|
|
351
|
+
|
|
352
|
+
### `number`
|
|
353
|
+
|
|
354
|
+
| Property | Description |
|
|
355
|
+
|----------|---------------|
|
|
356
|
+
| `min` | minimal value |
|
|
357
|
+
| `max` | maximal value |
|
|
358
|
+
| `step` | step |
|
|
359
|
+
|
|
360
|
+
### `color`
|
|
361
|
+
|
|
362
|
+
color picker
|
|
363
|
+
|
|
364
|
+
| Property | Description |
|
|
365
|
+
|-----------------|----------------------------------------------------------------|
|
|
366
|
+
| `noClearButton` | if true, the clear button will not be shown (admin >= 6.17.13) |
|
|
367
|
+
|
|
368
|
+
### `checkbox`
|
|
369
|
+
|
|
370
|
+
show checkbox
|
|
371
|
+
|
|
372
|
+
### `slider`
|
|
373
|
+
|
|
374
|
+
show slider (only Admin6)
|
|
375
|
+
|
|
376
|
+
| Property | Description |
|
|
377
|
+
| -------- | ----------------------------- |
|
|
378
|
+
| `min` | (default 0) |
|
|
379
|
+
| `max` | (default 100) |
|
|
380
|
+
| `step` | (default `(max - min) / 100`) |
|
|
381
|
+
| `unit` | Unit of slider |
|
|
382
|
+
|
|
383
|
+
### `qrCode`
|
|
384
|
+
|
|
385
|
+
show data in a QR Code (admin >= 7.0.18)
|
|
386
|
+
|
|
387
|
+
| Property | Description |
|
|
388
|
+
| --------- | ------------------------------------- |
|
|
389
|
+
| `data` | the data to be encoded in the QR Code |
|
|
390
|
+
| `size` | size of the QR code |
|
|
391
|
+
| `fgColor` | Foreground color |
|
|
392
|
+
| `bgColor` | Background color |
|
|
393
|
+
| `level` | QR code level (`L` `M` `Q` `H`) |
|
|
394
|
+
|
|
395
|
+
### `ip`
|
|
396
|
+
|
|
397
|
+
bind address
|
|
398
|
+
|
|
399
|
+
| Property | Description |
|
|
400
|
+
|--------------------|-----------------------------------|
|
|
401
|
+
| `listenOnAllPorts` | add 0.0.0.0 to option |
|
|
402
|
+
| `onlyIp4` | show only IP4 addresses |
|
|
403
|
+
| `onlyIp6` | show only IP6 addresses |
|
|
404
|
+
| `noInternal` | do not show internal IP addresses |
|
|
405
|
+
|
|
406
|
+
### `user`
|
|
407
|
+
|
|
408
|
+
lect user from system.user. (With color and icon)
|
|
409
|
+
|
|
410
|
+
| Property | Description |
|
|
411
|
+
|----------|-----------------|
|
|
412
|
+
| `short` | no system.user. |
|
|
413
|
+
|
|
414
|
+
### `room`
|
|
415
|
+
|
|
416
|
+
Select room from `enum.room` (With color and icon) - (only Admin6)
|
|
417
|
+
|
|
418
|
+
| Property | Description |
|
|
419
|
+
|-------------------|--------------------------|
|
|
420
|
+
| `short` | no `enum.rooms.` |
|
|
421
|
+
| `allowDeactivate` | allow letting room empty |
|
|
422
|
+
|
|
423
|
+
### `func`
|
|
424
|
+
|
|
425
|
+
Select function from `enum.func` (With color and icon) - (only Admin6)
|
|
426
|
+
|
|
427
|
+
| Property | Description |
|
|
428
|
+
|-------------------|-----------------------------------|
|
|
429
|
+
| `short` | no `enum.func.` |
|
|
430
|
+
| `allowDeactivate` | allow letting functionality empty |
|
|
431
|
+
|
|
432
|
+
### `select`
|
|
433
|
+
|
|
434
|
+
| Property | Description |
|
|
435
|
+
|-----------|-------------------------------------------------------------------------|
|
|
436
|
+
| `options` | object with labels, optional translations, optional grouping and values |
|
|
437
|
+
|
|
438
|
+
#### Example for `select options`
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
[
|
|
442
|
+
{"label": {"en": "option 1"}, "value": 1}, ...
|
|
443
|
+
]
|
|
444
|
+
```
|
|
445
|
+
or
|
|
446
|
+
```json
|
|
447
|
+
[
|
|
448
|
+
{
|
|
449
|
+
"items": [
|
|
450
|
+
{"label": "Val1", "value": 1},
|
|
451
|
+
{"label": "Val2", "value": 2}
|
|
452
|
+
],
|
|
453
|
+
"name": "group1"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"items": [
|
|
457
|
+
{"label": "Val3", "value": 3},
|
|
458
|
+
{"label": "Val4", "value": 4}
|
|
459
|
+
],
|
|
460
|
+
"name": "group2"
|
|
461
|
+
},
|
|
462
|
+
{"label": "Val5", "value": 5}
|
|
463
|
+
]
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### `autocomplete`
|
|
467
|
+
|
|
468
|
+
| Property | Description |
|
|
469
|
+
|------------|---------------------------------------------------------------------------------------------------------------|
|
|
470
|
+
| `options` | `["value1", "value2", ...]` or `[{"value": "value", "label": "Value1"}, "value2", ...]` (keys must be unique) |
|
|
471
|
+
| `freeSolo` | Set `freeSolo` to `true`, so the textbox can contain any arbitrary value. |
|
|
472
|
+
|
|
473
|
+
### `image`
|
|
474
|
+
|
|
475
|
+
saves image as a file of the `adapter.X` object or as base64 in attribute
|
|
476
|
+
|
|
477
|
+
| Property | Description |
|
|
478
|
+
|--------------|----------------------------------------------------------------------------------------------------------------------------------------|
|
|
479
|
+
| `filename` | name of file is structure name. In the below example `login-bg.png` is file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` |
|
|
480
|
+
| `accept` | html accept attribute, like `{ 'image/**': [], 'application/pdf': ['.pdf'] }`, default `{ 'image/*': [] }` |
|
|
481
|
+
| `maxSize` | maximal size of file to upload |
|
|
482
|
+
| `base64` | if true the image will be saved as data-url in attribute, elsewise as binary in file storage |
|
|
483
|
+
| `crop` | if true, allow user to crop the image |
|
|
484
|
+
| `!maxWidth` | |
|
|
485
|
+
| `!maxHeight` | |
|
|
486
|
+
| `!square` | width must be equal to height, or crop must allow only square as shape |
|
|
487
|
+
|
|
488
|
+
#### Example for `image`
|
|
489
|
+
|
|
490
|
+
```json
|
|
491
|
+
"login-bg.png": {
|
|
492
|
+
"type": "image",
|
|
493
|
+
"accept": "image/png",
|
|
494
|
+
"label": {
|
|
495
|
+
"en": "Upload image"
|
|
496
|
+
},
|
|
497
|
+
"crop": true
|
|
498
|
+
},
|
|
499
|
+
"picture": {
|
|
500
|
+
"type": "image",
|
|
501
|
+
"base64": true,
|
|
502
|
+
"accept": "image/*",
|
|
503
|
+
"label": {
|
|
504
|
+
"en": "Upload image"
|
|
505
|
+
},
|
|
506
|
+
"crop": true
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### `objectId`
|
|
512
|
+
|
|
513
|
+
object ID: show it with name, color and icon
|
|
514
|
+
|
|
515
|
+
| Property | Description |
|
|
516
|
+
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
517
|
+
| `types` | Desired type: `channel`, `device`, ... (has only `state` by default). It is plural, because `type` is already occupied. |
|
|
518
|
+
| `root` | [optional] Show only this root object and its children |
|
|
519
|
+
| `customFilter` | [optional] Cannot be used together with `type` settings. It is an object and not a JSON string. |
|
|
520
|
+
| `filterFunc` | [optional] Cannot be used together with `type` settings. It is a function that will be called for every object and must return true or false. Example: `obj.common.type === 'number'` |
|
|
521
|
+
|
|
522
|
+
#### Examples for `customFilter`
|
|
523
|
+
|
|
524
|
+
##### show only objects with some custom settings
|
|
525
|
+
|
|
526
|
+
`{common: {custom: true}}`
|
|
527
|
+
|
|
528
|
+
##### show only objects with sql.0 custom settings (only of the specific instance)
|
|
529
|
+
|
|
530
|
+
`{common: {custom: 'sql.0'}}`
|
|
531
|
+
|
|
532
|
+
##### show only objects of adapters `influxdb` or `sql` or `history`
|
|
533
|
+
|
|
534
|
+
`{common: {custom: '_dataSources'}}`
|
|
535
|
+
|
|
536
|
+
##### show only objects of custom settings for specific adapter (all instances)
|
|
537
|
+
|
|
538
|
+
`{common: {custom: 'adapterName.'}}`
|
|
539
|
+
|
|
540
|
+
##### show only channels
|
|
541
|
+
|
|
542
|
+
`{type: 'channel'}`
|
|
543
|
+
|
|
544
|
+
##### show only channels and devices
|
|
545
|
+
|
|
546
|
+
`{type: ['channel', 'device']}`
|
|
547
|
+
|
|
548
|
+
##### show only states of type 'number'
|
|
549
|
+
|
|
550
|
+
`{common: {type: 'number'}`
|
|
551
|
+
|
|
552
|
+
##### show only states of type 'number' and 'string'
|
|
553
|
+
|
|
554
|
+
`{common: {type: ['number', 'string']}`
|
|
555
|
+
|
|
556
|
+
##### show only states with roles starting from switch
|
|
557
|
+
|
|
558
|
+
`{common: {role: 'switch'}`
|
|
559
|
+
|
|
560
|
+
##### show only states with roles starting from `switch` and `button`
|
|
561
|
+
|
|
562
|
+
`{common: {role: ['switch', 'button']}`
|
|
563
|
+
|
|
564
|
+
### `password`
|
|
565
|
+
|
|
566
|
+
This field-type just has an effect on the UI.
|
|
567
|
+
Passwords and other sensitive data should be stored encrypted!
|
|
568
|
+
To do this, the key must be provided in the io-package.json under [nativeEncrypted](https://github.com/ioBroker/ioBroker.js-controller#automatically-encryptdecrypt-configuration-fields).
|
|
569
|
+
Additionally, you can protect this property from being served to other adapters but `admin` and `cloud` by adding it to `protectedNative` in `io-package.json` file.
|
|
570
|
+
|
|
571
|
+
| Property | Description |
|
|
572
|
+
|-------------|---------------------------------------------------------------------------------------------------------|
|
|
573
|
+
| `repeat` | repeat password must be compared with password |
|
|
574
|
+
| `visible` | true if allow viewing the password by toggling the view button (only for a new password while entering) |
|
|
575
|
+
| `readOnly` | the read-only flag. Visible is automatically true if readOnly is true |
|
|
576
|
+
| `maxLength` | max length of the text in field |
|
|
577
|
+
|
|
578
|
+
### `instance`
|
|
579
|
+
|
|
580
|
+
| Property | Description |
|
|
581
|
+
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
582
|
+
| `adapter` | name of adapter. With special name `_dataSources` you can get all adapters with flag `common.getHistory`. |
|
|
583
|
+
| `adapters` | optional list of adapters, that should be shown. If not defined, all adapters will be shown. Only active if `adapter` attribute is not defined. |
|
|
584
|
+
| `allowDeactivate` | if true. Additional option "deactivate" is shown |
|
|
585
|
+
| `onlyEnabled` | if true. Only enabled instances will be shown |
|
|
586
|
+
| `long` | value will look like `system.adapter.ADAPTER.0` and not `ADAPTER.0` |
|
|
587
|
+
| `short` | value will look like `0` and not `ADAPTER.0` |
|
|
588
|
+
| `all` | Add to the options "all" option with value `*` |
|
|
589
|
+
|
|
590
|
+
### `chips`
|
|
591
|
+
|
|
592
|
+
User can enter the word, and it will be added (see cloud => services => White list). Output is an array if no `delimiter` defined.
|
|
593
|
+
|
|
594
|
+
| Property | Description |
|
|
595
|
+
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
596
|
+
| `delimiter` | if it is defined, so the option will be stored as string with delimiter instead of an array. E.g., by `delimiter=;` you will get `a;b;c` instead of `['a', 'b', 'c']` |
|
|
597
|
+
|
|
598
|
+
### `alive`
|
|
599
|
+
|
|
600
|
+
just indication if the instance is alive, and it could be used in "hidden" and "disabled" (will not be saved in config)
|
|
601
|
+
|
|
602
|
+
Just text: Instance is running, Instance is not running
|
|
603
|
+
|
|
604
|
+
| Property | Description |
|
|
605
|
+
|----------------|-------------------------------------------------------------------------------------------------------------------------------------|
|
|
606
|
+
| `instance` | check if the instance is alive. If not defined, it will be used current instance. You can use `${data.number}` pattern in the text. |
|
|
607
|
+
| `textAlive` | default text is `Instance %s is alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files |
|
|
608
|
+
| `textNotAlive` | default text is `Instance %s is not alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files |
|
|
609
|
+
|
|
610
|
+
### `pattern`
|
|
611
|
+
|
|
612
|
+
read-only field with pattern like 'https://${data.ip}:${data.port}' (will not be saved in config)
|
|
613
|
+
Text input with the read-only flag, that shows a pattern.
|
|
614
|
+
|
|
615
|
+
| Property | Description |
|
|
616
|
+
|-------------------|-----------------------|
|
|
617
|
+
| `copyToClipboard` | if true - show button |
|
|
618
|
+
| `pattern` | my pattern |
|
|
619
|
+
|
|
620
|
+
### `sendTo`
|
|
621
|
+
|
|
622
|
+
button that sends request to instance (<https://github.com/iobroker-community-adapters/ioBroker.email/blob/master/admin/index_m.html#L128>)
|
|
623
|
+
|
|
624
|
+
| Property | Description |
|
|
625
|
+
|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
626
|
+
| `command` | (Default `send`) |
|
|
627
|
+
| `jsonData` | string - `"{\"subject1\": \"${data.subject}\", \"options1\": {\"host\": \"${data.host}\"}}"`. You can use special variables `data._origin` and `data._originIp` to send to instance the caller URL, like `http://127.0.0.1:8081/admin`. |
|
|
628
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. |
|
|
629
|
+
| `result` | `{result1: {en: 'A'}, result2: {en: 'B'}}` |
|
|
630
|
+
| `error` | `{error1: {en: 'E'}, error2: {en: 'E2'}}` |
|
|
631
|
+
| `variant` | `contained`, `outlined` or nothing |
|
|
632
|
+
| `openUrl` | if true - open URL in new tab, if response contains attribute `openUrl`, like `{"openUrl": "http://1.2.3.4:80/aaa", "window": "_blank", "saveConfig": true}`. If `saveConfig` is true, the user will be requested to save the configuration. |
|
|
633
|
+
| `reloadBrowser` | if true - reload the current browser window, if response contains attribute `reloadBrowser`, like `{"reloadBrowser": true}`. |
|
|
634
|
+
| `window` | if `openUrl` is true, this is a name of the new window. Could be overwritten if response consist `window` attribute. `this.props.socket.sendTo(adapterName.instance, command \|\| 'send', data, result => {});` |
|
|
635
|
+
| `icon` | if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`. You can use `base64` icons (like `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`). (Request via issue if you need more icons) |
|
|
636
|
+
| `useNative` | if adapter returns a result with `native` attribute it will be used for configuration. If `saveConfig` is true, the user will be requested to save the configuration. |
|
|
637
|
+
| `showProcess` | Show spinner while request is in progress |
|
|
638
|
+
| `timeout` | timeout for request in ms. Default: none. |
|
|
639
|
+
| `onLoaded` | execute the button logic once initially |
|
|
640
|
+
|
|
641
|
+
### `setState`
|
|
642
|
+
|
|
643
|
+
button that sets instance's state
|
|
644
|
+
|
|
645
|
+
| Property | Description |
|
|
646
|
+
|-----------|-----------------------------------------------------------------------------------------------------------------------------------|
|
|
647
|
+
| `id` | `system.adapter.myAdapter.%INSTANCE%.test`, you can use the placeholder `%INSTANCE%` to replace it with the current instance name |
|
|
648
|
+
| `ack` | false (default false) |
|
|
649
|
+
| `val` | `${data.myText}\_test` or number. Type will be detected automatically from the state type and converting done too |
|
|
650
|
+
| `okText` | Alert which will be shown by pressing the button |
|
|
651
|
+
| `variant` | `contained`, `outlined`, '' |
|
|
652
|
+
|
|
653
|
+
### `staticText`
|
|
654
|
+
|
|
655
|
+
static text like description
|
|
656
|
+
|
|
657
|
+
| Property | Description |
|
|
658
|
+
|----------|---------------------|
|
|
659
|
+
| `label` | multi-language text |
|
|
660
|
+
| `text` | same as label |
|
|
661
|
+
|
|
662
|
+
### `staticLink`
|
|
663
|
+
|
|
664
|
+
| Property | Description |
|
|
665
|
+
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
666
|
+
| `label` | multi-language text |
|
|
667
|
+
| `href` | link. Link could be dynamic like `#tab-objects/customs/${data.parentId}` |
|
|
668
|
+
| `target` | `_blank` or `_self` or window name |
|
|
669
|
+
| `close` | if true, the GUI will be closed (used not for JsonConfig in admin, but for dynamic GUI) |
|
|
670
|
+
| `button` | show a link as button |
|
|
671
|
+
| `variant` | type of button (`outlined`, `contained`, `text`) |
|
|
672
|
+
| `color` | color of button (e.g. `primary`) |
|
|
673
|
+
| `icon` | if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`, `book`, `help`, `upload`. You can use `base64` icons (it starts with `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) . (Request via issue if you need more icons) |
|
|
674
|
+
|
|
675
|
+
### `staticImage`
|
|
676
|
+
|
|
677
|
+
| Property | Description |
|
|
678
|
+
|----------|----------------------------------------|
|
|
679
|
+
| `href` | optional HTTP link |
|
|
680
|
+
| `src` | name of picture (from admin directory) |
|
|
681
|
+
|
|
682
|
+
### `table`
|
|
683
|
+
|
|
684
|
+
table with items that could be deleted, added, moved up, moved down
|
|
685
|
+
|
|
686
|
+
| Property | Description |
|
|
687
|
+
|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
688
|
+
| `items` | `[{"type": see above, "width": px or %, "title": {"en": "header"}, "attr": "name", "filter": false, "sort": true, "default": ""}]` |
|
|
689
|
+
| `noDelete` | boolean if delete or add disabled, If `noDelete` is false, add, delete and move up/down should work |
|
|
690
|
+
| `objKeyName` | (legacy setting, don't use!) - name of the key in `{"192.168.1.1": {delay: 1000, enabled: true}, "192.168.1.2": {delay: 2000, enabled: false}}` |
|
|
691
|
+
| `objValueName` | (legacy setting, don't use!) - name of the value in `{"192.168.1.1": "value1", "192.168.1.2": "value2"}` |
|
|
692
|
+
| `allowAddByFilter` | if add allowed even if filter is set |
|
|
693
|
+
| `showSecondAddAt` | Number of lines from which the second add button at the bottom of the table will be shown. Default 5 |
|
|
694
|
+
| `showFirstAddOnTop` | Show first plus button on top of the first column and not on the left. |
|
|
695
|
+
| `clone` | [optional] - if clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. |
|
|
696
|
+
| `export` | [optional] - if export button should be shown. Export as csv file. |
|
|
697
|
+
| `import` | [optional] - if import button should be shown. Import from csv file. |
|
|
698
|
+
| `uniqueColumns` | [optional] - specify an array of columns, which need to have unique entries |
|
|
699
|
+
| `encryptedAttributes` | [optional] - specify an array of columns, which should be encrypted |
|
|
700
|
+
| `compact` | [optional] - if true, the table will be shown in a compact mode |
|
|
701
|
+
|
|
702
|
+
### `accordion`
|
|
703
|
+
|
|
704
|
+
accordion with items that could be deleted, added, moved up, moved down (Admin 6.6.0 and newer)
|
|
705
|
+
|
|
706
|
+
| Property | Description |
|
|
707
|
+
|-------------|-------------------------------------------------------------------------------------------------------------------------------------|
|
|
708
|
+
| `items` | `[{"type": see above, "attr": "name", "default": ""}]` items can be placed like on a `panel` (xs, sm, md, lg and newLine) |
|
|
709
|
+
| `titleAttr` | key of the item's list which should be used as name |
|
|
710
|
+
| `noDelete` | boolean if delete or add disabled, If `noDelete` is false, add, delete and move up/down should work |
|
|
711
|
+
| `clone` | [optional] - if clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. |
|
|
712
|
+
|
|
713
|
+
### `jsonEditor`
|
|
714
|
+
|
|
715
|
+
| Property | Description |
|
|
716
|
+
|----------------|--------------------------------------------------------------------|
|
|
717
|
+
| `validateJson` | if false, the text will be not validated as JSON |
|
|
718
|
+
| `allowEmpty` | if true, the JSON will be validated only if the value is not empty |
|
|
719
|
+
|
|
720
|
+
### `language`
|
|
721
|
+
|
|
722
|
+
select language
|
|
723
|
+
|
|
724
|
+
| Property | Description |
|
|
725
|
+
|----------|----------------------------------------------------------------------------------------------------------------------|
|
|
726
|
+
| `system` | allow the usage of the system language from `system.config` as default (will have an empty string value if selected) |
|
|
727
|
+
|
|
728
|
+
### `certificate`
|
|
729
|
+
|
|
730
|
+
| Property | Description |
|
|
731
|
+
|------------|----------------------------------------------------------------------------------------|
|
|
732
|
+
| `certType` | on of: `public`, `private`, `chained`. But from 6.4.0 you can use `certificates` type. |
|
|
733
|
+
|
|
734
|
+
### `certificates`
|
|
735
|
+
|
|
736
|
+
it is a universal type that manages `certPublic`, `certPrivate`, `certChained` and `leCollection` attributes for you.
|
|
737
|
+
Example:
|
|
738
|
+
|
|
739
|
+
```json
|
|
740
|
+
{
|
|
741
|
+
"_certs": {
|
|
742
|
+
"type": "certificates",
|
|
743
|
+
"newLine": true,
|
|
744
|
+
"hidden": "!data.secure",
|
|
745
|
+
"sm": 12
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### `certificateCollection`
|
|
751
|
+
|
|
752
|
+
select certificate collection or just use all collections or don't use let's encrypt at all.
|
|
753
|
+
|
|
754
|
+
| Property | Description |
|
|
755
|
+
|--------------------|------------------------------------|
|
|
756
|
+
| `leCollectionName` | name of the certificate collection |
|
|
757
|
+
|
|
758
|
+
### `custom`
|
|
759
|
+
|
|
760
|
+
only Admin6
|
|
761
|
+
|
|
762
|
+
| Property | Description |
|
|
763
|
+
|----------|--------------------------------------------------------------------------------------------------------------------------------|
|
|
764
|
+
| `name` | Component name that will be provided via props, like `ComponentInstancesEditor` |
|
|
765
|
+
| `url` | Location of the component |
|
|
766
|
+
| `i18n` | true if `i18n/xx.json` files are located in the same directory as component, or translation object `{"text1": {"en": Text1"}}` |
|
|
767
|
+
|
|
768
|
+
#### Example for url
|
|
769
|
+
|
|
770
|
+
- `custom/customComponents.js`: in this case the files will be loaded from `/adapter/ADAPTER_NAME/custom/customComponents.js`
|
|
771
|
+
- `https://URL/myComponent`: direct from URL
|
|
772
|
+
- `./adapter/ADAPTER_NAME/custom/customComponent.js`: in this case the files will be loaded from `/adapter/ADAPTER_NAME/custom/customComponents.js`
|
|
773
|
+
|
|
774
|
+
### `datePicker`
|
|
775
|
+
|
|
776
|
+
allow the user to select a date input the UI format comes from the configured
|
|
777
|
+
|
|
778
|
+
### `timePicker`
|
|
779
|
+
|
|
780
|
+
allow the user to select a date input the returned string is a parseable date string or of format `HH:mm:ss`
|
|
781
|
+
|
|
782
|
+
| Property | Description |
|
|
783
|
+
|----------------|------------------------------------------------------------------------------------------------------|
|
|
784
|
+
| `format` | format passed to the date picker defaults to `HH:mm:ss` |
|
|
785
|
+
| `views` | Configure which views should be shown to the users. Defaults to `['hours', 'minutes', 'seconds']` |
|
|
786
|
+
| `timeSteps` | Represent the available time steps for each view. Defaults to `{ hours: 1, minutes: 5, seconds: 5 }` |
|
|
787
|
+
| `returnFormat` | `fullDate` or `HH:mm:ss`. Defaults to full date for backward compatibility reasons. |
|
|
788
|
+
|
|
789
|
+
### `divider`
|
|
790
|
+
|
|
791
|
+
horizontal line
|
|
792
|
+
|
|
793
|
+
| Property | Description |
|
|
794
|
+
|----------|--------------------------------------------------|
|
|
795
|
+
| `height` | optional height |
|
|
796
|
+
| `color` | optional divider color or `primary`, `secondary` |
|
|
797
|
+
|
|
798
|
+
### `header`
|
|
799
|
+
|
|
800
|
+
| Property | Description |
|
|
801
|
+
|----------|--------------|
|
|
802
|
+
| `text` | |
|
|
803
|
+
| `size` | 1-5 => h1-h5 |
|
|
804
|
+
|
|
805
|
+
### `cron`
|
|
806
|
+
|
|
807
|
+
| Property | Description |
|
|
808
|
+
|-----------|-----------------------------------------------|
|
|
809
|
+
| `complex` | show CRON with "minutes", "seconds" and so on |
|
|
810
|
+
| `simple` | show simple CRON settings |
|
|
811
|
+
|
|
812
|
+
### `fileSelector`
|
|
813
|
+
|
|
814
|
+
only Admin6
|
|
815
|
+
|
|
816
|
+
| Property | Description |
|
|
817
|
+
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
818
|
+
| `pattern` | File extension pattern. Allowed `**/*.ext` to show all files from subfolders too, `*.ext` to show from root folder or `folderName/*.ext` to show all files in sub-folder `folderName`. Default `**/*.*`. |
|
|
819
|
+
| `fileTypes` | [optional] type of files: `audio`, `image`, `text` |
|
|
820
|
+
| `objectID` | Object ID of type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` |
|
|
821
|
+
| `upload` | path, where the uploaded files will be stored. Like `folderName`. If not defined, no upload field will be shown. To upload in the root, set this field to `/`. |
|
|
822
|
+
| `refresh` | Show refresh button near the select. |
|
|
823
|
+
| `maxSize` | max file size (default 2MB) |
|
|
824
|
+
| `withFolder` | show folder name even if all files in same folder |
|
|
825
|
+
| `delete` | Allow deletion of files |
|
|
826
|
+
| `noNone` | Do not show `none` option |
|
|
827
|
+
| `noSize` | Do not show size of files |
|
|
828
|
+
|
|
829
|
+
### `file`
|
|
830
|
+
|
|
831
|
+
only Admin6.
|
|
832
|
+
Input field with file selector
|
|
833
|
+
|
|
834
|
+
| Property | Description |
|
|
835
|
+
|---------------------|------------------------------------------------------------------------------------------|
|
|
836
|
+
| `disableEdit` | if user can manually enter the file name and not only through select dialog |
|
|
837
|
+
| `limitPath` | limit selection to one specific object of type `meta` and following path (not mandatory) |
|
|
838
|
+
| `filterFiles` | like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` |
|
|
839
|
+
| `allowUpload` | allowed upload of files |
|
|
840
|
+
| `allowDownload` | allowed download of files (default true) |
|
|
841
|
+
| `allowCreateFolder` | allowed creation of folders |
|
|
842
|
+
| `allowView` | allowed tile view (default true) |
|
|
843
|
+
| `showToolbar` | show toolbar (default true) |
|
|
844
|
+
| `selectOnlyFolders` | user can select only folders (e.g. for upload path) |
|
|
845
|
+
| `trim` | trim the file name |
|
|
846
|
+
|
|
847
|
+
### `imageSendTo`
|
|
848
|
+
|
|
849
|
+
shows image that was received from backend as base64 string
|
|
850
|
+
|
|
851
|
+
| Property | Description |
|
|
852
|
+
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
853
|
+
| `width` | width of QR code in px |
|
|
854
|
+
| `height` | height of QR code in px |
|
|
855
|
+
| `command` | sendTo command |
|
|
856
|
+
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
|
|
857
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
|
|
858
|
+
|
|
859
|
+
#### Example of code in back-end for `imageSendTo`
|
|
860
|
+
|
|
861
|
+
```js
|
|
862
|
+
adapter.on("message", (obj) => {
|
|
863
|
+
if (obj.command === "send") {
|
|
864
|
+
const QRCode = require("qrcode");
|
|
865
|
+
QRCode.toDataURL(
|
|
866
|
+
"3ca4234a-fd81-fdb8-5584-08c732f70e4d",
|
|
867
|
+
(err, url) =>
|
|
868
|
+
obj.callback && adapter.sendTo(obj.from, obj.command, url, obj.callback)
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
### `selectSendTo`
|
|
875
|
+
|
|
876
|
+
Shows the drop-down menu with the given from the instance values.
|
|
877
|
+
|
|
878
|
+
| Property | Description |
|
|
879
|
+
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
880
|
+
| `command` | sendTo command |
|
|
881
|
+
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to the backend |
|
|
882
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to the backend if jsonData is not defined. |
|
|
883
|
+
| `manual` | allow manual editing. Without drop-down menu (if instance is offline). Default `true`. |
|
|
884
|
+
| `multiple` | Multiple choice select |
|
|
885
|
+
| `showAllValues` | show item even if no label was found for it (by multiple), default=`true` |
|
|
886
|
+
| `noTranslation` | do not translate label of selects. To use this option, your adapter must implement message handler.The result of command must be an array in form `[{"value": 1, "label": "one"}, ...]` |
|
|
887
|
+
| `alsoDependsOn` | by change of which attributes, the command must be resent |
|
|
888
|
+
|
|
889
|
+
#### Example of code in back-end for `selectSendTo`
|
|
890
|
+
|
|
891
|
+
```js
|
|
892
|
+
adapter.on("message", (obj) => {
|
|
893
|
+
if (obj) {
|
|
894
|
+
switch (obj.command) {
|
|
895
|
+
case "command":
|
|
896
|
+
if (obj.callback) {
|
|
897
|
+
try {
|
|
898
|
+
const { SerialPort } = require("serialport");
|
|
899
|
+
if (SerialPort) {
|
|
900
|
+
// read all found serial ports
|
|
901
|
+
SerialPort.list()
|
|
902
|
+
.then((ports) => {
|
|
903
|
+
adapter.log.info(`List of port: ${JSON.stringify(ports)}`);
|
|
904
|
+
adapter.sendTo(
|
|
905
|
+
obj.from,
|
|
906
|
+
obj.command,
|
|
907
|
+
ports.map((item) => ({
|
|
908
|
+
label: item.path,
|
|
909
|
+
value: item.path,
|
|
910
|
+
})),
|
|
911
|
+
obj.callback
|
|
912
|
+
);
|
|
913
|
+
})
|
|
914
|
+
.catch((e) => {
|
|
915
|
+
adapter.sendTo(obj.from, obj.command, [], obj.callback);
|
|
916
|
+
adapter.log.error(e);
|
|
917
|
+
});
|
|
918
|
+
} else {
|
|
919
|
+
adapter.log.warn("Module serialport is not available");
|
|
920
|
+
adapter.sendTo(
|
|
921
|
+
obj.from,
|
|
922
|
+
obj.command,
|
|
923
|
+
[{ label: "Not available", value: "" }],
|
|
924
|
+
obj.callback
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
} catch (e) {
|
|
928
|
+
adapter.sendTo(
|
|
929
|
+
obj.from,
|
|
930
|
+
obj.command,
|
|
931
|
+
[{ label: "Not available", value: "" }],
|
|
932
|
+
obj.callback
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
break;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
### `autocompleteSendTo`
|
|
944
|
+
|
|
945
|
+
Shows autocomplete control with the given from the instance values.
|
|
946
|
+
|
|
947
|
+
| Property | Description |
|
|
948
|
+
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
949
|
+
| `command` | sendTo command |
|
|
950
|
+
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to the backend |
|
|
951
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to the backend if jsonData is not defined. |
|
|
952
|
+
| `freeSolo` | Set `freeSolo` to `true`, so the textbox can contain any arbitrary value. |
|
|
953
|
+
| `alsoDependsOn` | by change of which attributes, the command must be resent |
|
|
954
|
+
| `maxLength` | max length of the text in field |
|
|
955
|
+
|
|
956
|
+
To use this option, your adapter must implement message handler:
|
|
957
|
+
|
|
958
|
+
The result of command must be an array in form `["value1", {"value": "value2", "label": "Value2"}, ...]` (keys must be unique)
|
|
959
|
+
See `selectSendTo` for handler example
|
|
960
|
+
|
|
961
|
+
### `textSendTo`
|
|
962
|
+
|
|
963
|
+
Shows readonly control with the given from the instance values.
|
|
964
|
+
|
|
965
|
+
| Property | Description |
|
|
966
|
+
|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
967
|
+
| `container` | div, text, html |
|
|
968
|
+
| `copyToClipboard` | if true - show button |
|
|
969
|
+
| `alsoDependsOn` | by change of which attributes, the command must be resent |
|
|
970
|
+
| `command` | sendTo command |
|
|
971
|
+
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to the backend |
|
|
972
|
+
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to the backend if jsonData is not defined. |
|
|
973
|
+
|
|
974
|
+
To use this option, your adapter must implement a message handler:
|
|
975
|
+
The result of command must be a string or object with the following parameters:
|
|
976
|
+
|
|
977
|
+
```json5
|
|
978
|
+
{
|
|
979
|
+
text: "text to show", // mandatory
|
|
980
|
+
style: { color: "red" }, // optional
|
|
981
|
+
icon: "search", // optional. It could be base64 or link to image in the same folder as jsonConfig.json file
|
|
982
|
+
// possible predefined names: edit, rename, delete, refresh, add, search, unpair, pair, identify, play, stop, pause, forward, backward, next, previous, lamp, backlight, dimmer, socket, settings, group, user, qrcode, connection, no-connection, visible
|
|
983
|
+
iconStyle: { width: 30 }, // optional
|
|
984
|
+
}
|
|
985
|
+
```
|
|
986
|
+
|
|
987
|
+
#### Example for `textSendTo`
|
|
988
|
+
|
|
989
|
+
```js
|
|
990
|
+
adapter.on("message", (obj) => {
|
|
991
|
+
if (obj) {
|
|
992
|
+
switch (obj.command) {
|
|
993
|
+
case "command":
|
|
994
|
+
obj.callback &&
|
|
995
|
+
adapter.sendTo(
|
|
996
|
+
obj.from,
|
|
997
|
+
obj.command,
|
|
998
|
+
"Received " + JSON.stringify(obj.message),
|
|
999
|
+
obj.callback
|
|
1000
|
+
);
|
|
1001
|
+
// or with style
|
|
1002
|
+
obj.callback &&
|
|
1003
|
+
adapter.sendTo(
|
|
1004
|
+
obj.from,
|
|
1005
|
+
obj.command,
|
|
1006
|
+
{
|
|
1007
|
+
text: "Received " + JSON.stringify(obj.message),
|
|
1008
|
+
style: { color: "red" },
|
|
1009
|
+
icon: "search",
|
|
1010
|
+
iconStyle: { width: 30 },
|
|
1011
|
+
},
|
|
1012
|
+
obj.callback
|
|
1013
|
+
);
|
|
1014
|
+
// or as html
|
|
1015
|
+
obj.callback &&
|
|
1016
|
+
adapter.sendTo(
|
|
1017
|
+
obj.from,
|
|
1018
|
+
obj.command,
|
|
1019
|
+
`<div style="color: green">${JSON.stringify(obj.message)}</div>`,
|
|
1020
|
+
obj.callback
|
|
1021
|
+
);
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
### `coordinates`
|
|
1029
|
+
|
|
1030
|
+
Determines current location and used `system.config` coordinates if not possible in form "latitude,longitude"
|
|
1031
|
+
|
|
1032
|
+
| Property | Description |
|
|
1033
|
+
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1034
|
+
| `divider` | divider between latitude and longitude. Default "," (Used if longitudeName and latitudeName are not defined) |
|
|
1035
|
+
| `autoInit` | init field with current coordinates if empty |
|
|
1036
|
+
| `longitudeName` | if defined, the longitude will be stored in this attribute, divider will be ignored |
|
|
1037
|
+
| `latitudeName` | if defined, the latitude will be stored in this attribute, divider will be ignored |
|
|
1038
|
+
| `useSystemName` | if defined, the checkbox with "Use system settings" will be shown and latitude, longitude will be read from `system.config`, a boolean will be saved to the given name |
|
|
1039
|
+
|
|
1040
|
+
### `interface`
|
|
1041
|
+
|
|
1042
|
+
Selects the interface of the host, where the instance runs
|
|
1043
|
+
|
|
1044
|
+
| Property | Description |
|
|
1045
|
+
|------------------|----------------------------------------------------------------|
|
|
1046
|
+
| `ignoreLoopback` | do not show loopback interface (127.0.0.1) |
|
|
1047
|
+
| `ignoreInternal` | do not show internal interfaces (normally it is 127.0.0.1 too) |
|
|
1048
|
+
|
|
1049
|
+
### `license`
|
|
1050
|
+
|
|
1051
|
+
shows the license information if not already accepted. One of attributes `texts` or `licenseUrl` must be defined. When the license is accepted, the defined configuration attribute will be set to `true`.
|
|
1052
|
+
|
|
1053
|
+
| Property | Description |
|
|
1054
|
+
|--------------|------------------------------------------------------------------------------------------------------------|
|
|
1055
|
+
| `texts` | array of paragraphs with texts, which will be shown each as a separate paragraph |
|
|
1056
|
+
| `licenseUrl` | URL to the license file (e.g. <https://raw.githubusercontent.com/ioBroker/ioBroker.docs/master/LICENSE>) |
|
|
1057
|
+
| `title` | Title of the license dialog |
|
|
1058
|
+
| `agreeText` | Text of the agreed button |
|
|
1059
|
+
| `checkBox` | If defined, the checkbox with the given name will be shown. If checked, the agreed button will be enabled. |
|
|
1060
|
+
|
|
1061
|
+
### `checkLicense`
|
|
1062
|
+
|
|
1063
|
+
Very special component to check the license online. It's required exactly `license` and `useLicenseManager` properties in native.
|
|
1064
|
+
|
|
1065
|
+
| Property | Description |
|
|
1066
|
+
|-----------|---------------|
|
|
1067
|
+
| `uuid` | Check UUID |
|
|
1068
|
+
| `version` | Check version |
|
|
1069
|
+
|
|
1070
|
+
### `uuid`
|
|
1071
|
+
|
|
1072
|
+
Show iobroker UUID
|
|
1073
|
+
|
|
1074
|
+
### `port`
|
|
1075
|
+
|
|
1076
|
+
Special input for ports. It checks automatically if port is used by other instances and shows a warning
|
|
1077
|
+
|
|
1078
|
+
| Property | Description |
|
|
1079
|
+
|----------|-------------------------------------------------------------------------------------------------------------------------------|
|
|
1080
|
+
| `min` | minimal allowed port number. It could be 0. And if the value is then zero, the check if the port is occupied will not happen. |
|
|
1081
|
+
|
|
1082
|
+
### `state`
|
|
1083
|
+
|
|
1084
|
+
(admin >= 7.1.0) Show control or information from the state
|
|
1085
|
+
|
|
1086
|
+
| Property | Description |
|
|
1087
|
+
|------------------|-------------------------------------------------------------------------------------------------------------------------------|
|
|
1088
|
+
| `oid` | Which object ID should be taken for the controlling. The ID is without "adapter.X." prefix |
|
|
1089
|
+
| `system` | If true, the state will be taken from system.adapter.XX.I. and not from XX.I |
|
|
1090
|
+
| `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
|
|
1091
|
+
| `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
|
|
1092
|
+
| `unit` | Add unit to the value |
|
|
1093
|
+
| `trueText` | this text will be shown if the value is true |
|
|
1094
|
+
| `trueTextStyle` | Style of the text if the value is true |
|
|
1095
|
+
| `falseText` | this text will be shown if the value is false or if the control is a "button" |
|
|
1096
|
+
| `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
|
|
1097
|
+
| `trueImage` | This image will be shown if the value is true |
|
|
1098
|
+
| `falseImage` | This image will be shown if the value is false or if the control is a "button" |
|
|
1099
|
+
| `min` | Minimum value for control type slider or number |
|
|
1100
|
+
| `max` | Maximum value for control type slider or number |
|
|
1101
|
+
| `step` | Step value for control type slider or number |
|
|
1102
|
+
| `controlDelay` | delay in ms for slider or number |
|
|
1103
|
+
| `variant` | Variant of button: `contained`, `outlined`, `text` |
|
|
1104
|
+
| `readOnly` | Defines if the control is read-only |
|
|
1105
|
+
|
|
1106
|
+
### `deviceManager`
|
|
1107
|
+
|
|
1108
|
+
show device manager. For that, the adapter must support device manager protocol. See iobroker/dm-utils.
|
|
1109
|
+
|
|
1110
|
+
Here is an example of how to show device manager in a tab:
|
|
1111
|
+
|
|
1112
|
+
```json
|
|
1113
|
+
"_deviceManager": {
|
|
1114
|
+
"type": "panel",
|
|
1115
|
+
"label": "Device manager",
|
|
1116
|
+
"items": {
|
|
1117
|
+
"_dm": {
|
|
1118
|
+
"type": "deviceManager",
|
|
1119
|
+
"sm": 12,
|
|
1120
|
+
"style": {
|
|
1121
|
+
"width": "100%",
|
|
1122
|
+
"height": "100%",
|
|
1123
|
+
"overflow": "hidden"
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
"style": {
|
|
1128
|
+
"width": "100%",
|
|
1129
|
+
"height": "100%",
|
|
1130
|
+
"overflow": "hidden"
|
|
1131
|
+
},
|
|
1132
|
+
"innerStyle": {
|
|
1133
|
+
"width": "100%",
|
|
1134
|
+
"height": "100%",
|
|
1135
|
+
"overflow": "hidden"
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
## Common attributes of controls
|
|
1141
|
+
|
|
1142
|
+
### Layout options `xl`,`lg`,`md`,`sm`,`xs`
|
|
1143
|
+
|
|
1144
|
+
These options are used to define the width of elements on different screen sizes, ensuring a responsive and adaptable layout across various devices.
|
|
1145
|
+
|
|
1146
|
+
Valid numbers are 1 to 12.
|
|
1147
|
+
|
|
1148
|
+
If you specify a number, for example 6, then the width of the element will be 6/12 (50%) of the screen width or for example 3, then the width of the element will be 3/12 (25%) of the screen width.
|
|
1149
|
+
Assign numbers to the different layout options specify the width of the element for the different screen sizes.
|
|
1150
|
+
|
|
1151
|
+
| option | description |
|
|
1152
|
+
|--------|------------------------------------------|
|
|
1153
|
+
| `xl` | extra large screens (1536px >= width) |
|
|
1154
|
+
| `lg` | large screens (1200px <= width < 1536px) |
|
|
1155
|
+
| `md` | middle screens (900px <= width < 1200px) |
|
|
1156
|
+
| `sm` | small screen (600px <= width < 900px) |
|
|
1157
|
+
| `xs` | tiny screens (width < 600px) |
|
|
1158
|
+
|
|
1159
|
+
The following options are the recommended presets that fit most cases
|
|
1160
|
+
|
|
1161
|
+
```json
|
|
1162
|
+
"xs": 12,
|
|
1163
|
+
"sm": 12,
|
|
1164
|
+
"md": 6,
|
|
1165
|
+
"lg": 4,
|
|
1166
|
+
"xl": 4,
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
#### Recommended checking the layout
|
|
1170
|
+
|
|
1171
|
+
The respective layout should be checked for each adapter to see whether the layout can be displayed and used in all resolutions.
|
|
1172
|
+
|
|
1173
|
+
This can be tested, for example, using the Web Developer Tools, which are built into every Chromium-based browser.
|
|
1174
|
+
|
|
1175
|
+
Step 1: Open the Web Developer Tools with F12
|
|
1176
|
+
|
|
1177
|
+
Step 2: Open the device Toolbar (1)
|
|
1178
|
+
|
|
1179
|
+
Step 3: Select different devices (2)
|
|
1180
|
+
|
|
1181
|
+

|
|
1182
|
+
|
|
1183
|
+
In the Settings of the Web developer tools, you can create your own devices with the exact widths if you want.
|
|
1184
|
+
|
|
1185
|
+
### Further options
|
|
1186
|
+
|
|
1187
|
+
| option | description |
|
|
1188
|
+
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
1189
|
+
| `type` | If element has no attribute `type`, assume it has default type 'panel'. Type of an element. For currently available options see [Common Control Elements:](#common-control-elements) |
|
|
1190
|
+
| `newLine` | should be shown from new line |
|
|
1191
|
+
| `label` | String or object like {en: 'Name', ru: 'Имя'} |
|
|
1192
|
+
| `hidden` | JS function that could use `native.attribute` for calculation |
|
|
1193
|
+
| `hideOnlyControl` | if hidden the place will be shown, but no control |
|
|
1194
|
+
| `disabled` | JS function that could use `native.attribute` for calculation |
|
|
1195
|
+
| `help` | help text (multi-language) |
|
|
1196
|
+
| `helpLink` | href to help (could be used only together with `help`) |
|
|
1197
|
+
| `style` | CSS style in ReactJS notation: `radiusBorder` and not `radius-border`. |
|
|
1198
|
+
| `darkStyle` | CSS style for dark mode |
|
|
1199
|
+
| `validator` | JS function: true no error, false - error |
|
|
1200
|
+
| `validatorErrorText` | Text to show if validator fails |
|
|
1201
|
+
| `validatorNoSaveOnError` | disable save button if error |
|
|
1202
|
+
| `tooltip` | optional tooltip |
|
|
1203
|
+
| `default` | default value |
|
|
1204
|
+
| `defaultFunc` | JS function to calculate default value |
|
|
1205
|
+
| `placeholder` | placeholder (for text control) |
|
|
1206
|
+
| `noTranslation` | do not translate selects or other options (not for help, label or placeholder) |
|
|
1207
|
+
| `onChange` | Structure in form `{"alsoDependsOn": ["attr1", "attr2"], "calculateFunc": "data.attr1 + data.attr2", "ignoreOwnChanges": true}` |
|
|
1208
|
+
| `doNotSave` | Do not save this attribute as used only for internal calculations |
|
|
1209
|
+
| `noMultiEdit` | if this flag set to true, this field will not be shown if user selected more than one object for edit. |
|
|
1210
|
+
|
|
1211
|
+
### Options with detailed configuration
|
|
1212
|
+
|
|
1213
|
+
#### `defaultSendTo`
|
|
1214
|
+
|
|
1215
|
+
command to request initial value from running instance, example: `"myInstance": {"type": "text", "defaultSendTo": "fill"}`
|
|
1216
|
+
|
|
1217
|
+
- `data` - static data
|
|
1218
|
+
- `jsonData` - static data
|
|
1219
|
+
- if no `data` and `jsonData` defined, the following info will be sent `{"attr": "<attribute name>", "value": "<current value>"}`
|
|
1220
|
+
- `button` - button label to re-trigger request from instance
|
|
1221
|
+
- `buttonTooltip` - Button tooltip (default: `Request data by instance`)
|
|
1222
|
+
- `buttonTooltipNoTranslation` - Do not translate button tooltip
|
|
1223
|
+
- `allowSaveWithError` - Allow saving of configuration even if the instance is offline
|
|
1224
|
+
|
|
1225
|
+
#### `confirm`
|
|
1226
|
+
|
|
1227
|
+
- `condition` - JS function: true show confirm dialog
|
|
1228
|
+
- `text` - text of confirmation dialog
|
|
1229
|
+
- `title` - title of confirmation dialog
|
|
1230
|
+
- `ok` - Text for OK button
|
|
1231
|
+
- `cancel` - Text for Cancel button
|
|
1232
|
+
- `type` - One of: `info`, `warning`, `error`, `none`
|
|
1233
|
+
- `alsoDependsOn` - array with attributes, to check the condition by these attributes too
|
|
1234
|
+
|
|
1235
|
+
## Autocomplete
|
|
1236
|
+
|
|
1237
|
+
`Number`, `text`, `checkbox`, `select` support autocomplete to allow selection of options if used as custom settings.
|
|
1238
|
+
In this case, the value will be provided as an array of all possible values.
|
|
1239
|
+
|
|
1240
|
+
Example:
|
|
1241
|
+
|
|
1242
|
+
```json5
|
|
1243
|
+
// ...
|
|
1244
|
+
"timeout": {
|
|
1245
|
+
"type": "number",
|
|
1246
|
+
"label": "Timeout"
|
|
1247
|
+
}
|
|
1248
|
+
// ...
|
|
1249
|
+
|
|
1250
|
+
data: {
|
|
1251
|
+
timeout: [1000, 2000, 3000]
|
|
1252
|
+
}
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
In this case input must be text, where shown `__different__`, with the autocomplete option of three possible values.
|
|
1256
|
+
Users can select from dropdown 1000, 2000 or 3000 or input their own new value, e.g., 500.
|
|
1257
|
+
|
|
1258
|
+
Boolean must support indeterminate if value is [false, true]
|
|
1259
|
+
|
|
1260
|
+
For non changed `__different__` the value different must be returned:
|
|
1261
|
+
|
|
1262
|
+
Input:
|
|
1263
|
+
```json
|
|
1264
|
+
data: {
|
|
1265
|
+
timeout: [1000, 2000, 3000]
|
|
1266
|
+
}
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
Output if timeout was not changed:
|
|
1270
|
+
```json
|
|
1271
|
+
newData: {
|
|
1272
|
+
timeout: "__different__"
|
|
1273
|
+
}
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
Value `__different__` is reserved and no one text input may accept it from user.
|
|
1277
|
+
|
|
1278
|
+
Component must look like
|
|
1279
|
+
|
|
1280
|
+
```jsx
|
|
1281
|
+
<SchemaEditor
|
|
1282
|
+
style={customStyle}
|
|
1283
|
+
className={classes.myClass}
|
|
1284
|
+
schema={schema}
|
|
1285
|
+
customInstancesEditor={CustomInstancesEditor}
|
|
1286
|
+
data={common.native}
|
|
1287
|
+
onError={(error, attribute) => error can be true/false or text. Attribute is optional}
|
|
1288
|
+
onChanged={(newData, isChanged) => console.log('Changed ' + isChanged)}
|
|
1289
|
+
/>
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
If no schema is provided, the schema must be created automatically from data.
|
|
1293
|
+
|
|
1294
|
+
- `boolean` => checkbox
|
|
1295
|
+
- `text` => text input
|
|
1296
|
+
- `number` => number
|
|
1297
|
+
- name `bind` => ip
|
|
1298
|
+
- name `port` => number, min=1, max=0xFFFF
|
|
1299
|
+
- name `timeout` => number, help="ms"
|
|
1300
|
+
|
|
1301
|
+
## Todo
|
|
1302
|
+
|
|
1303
|
+
The following chapters are taken from the original SCHEMA.MD.
|
|
1304
|
+
I didn't understand the content in detail and had to be improved by bluefox.
|
|
1305
|
+
|
|
1306
|
+
## JS Functions
|
|
1307
|
+
|
|
1308
|
+
### Configuration dialog
|
|
1309
|
+
|
|
1310
|
+
JS function is:
|
|
1311
|
+
|
|
1312
|
+
```js
|
|
1313
|
+
const myValidator = "_alive === true && data.options.myType == 2";
|
|
1314
|
+
|
|
1315
|
+
const func = new Function(
|
|
1316
|
+
'data', // actual obj.native or obj.common.custom['adapter.X'] object
|
|
1317
|
+
// If table, so data is current line in the table
|
|
1318
|
+
'originalData', // data before changes
|
|
1319
|
+
'_system', // system config => 'system.config'=>common
|
|
1320
|
+
'_alive', // If instance is alive
|
|
1321
|
+
'_common', // common part of instance = 'system.config.ADAPTER.X' => common
|
|
1322
|
+
'_socket', // socket connection
|
|
1323
|
+
'_instance', // instance number
|
|
1324
|
+
'arrayIndex', // filled only by table and represents the row index
|
|
1325
|
+
'globalData', // filled only by table and represents the obj.native or obj.common.custom['adapter.X'] object
|
|
1326
|
+
'_changed', // indicator if some data was changed and must be saved
|
|
1327
|
+
myValidator.includes('return') ? myValidator : 'return ' + myValidator); // e.g. "_alive === true"
|
|
1328
|
+
|
|
1329
|
+
const isValid = func(data, systemConfig.common, instanceAlive, adapter.common, this.props.socket);
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
If the `alive` status changes, so all fields must be updated, validated, disabled, hidden anew.
|
|
1333
|
+
|
|
1334
|
+
The following variables are available in JS function in adapter settings:
|
|
1335
|
+
|
|
1336
|
+
- `data` - native settings for this instance or current line in the table (to access all settings use globalData)
|
|
1337
|
+
- `_system` - system configuration
|
|
1338
|
+
- `_alive` - is instance being alive
|
|
1339
|
+
- `_common` - common settings for this instance
|
|
1340
|
+
- `_socket` - socket
|
|
1341
|
+
- `_instance` - instance number
|
|
1342
|
+
- `arrayIndex` - used only in table and represent current line in an array
|
|
1343
|
+
- `globalData` - used only in table for all settings and not only one table line
|
|
1344
|
+
|
|
1345
|
+
### Custom settings dialog
|
|
1346
|
+
|
|
1347
|
+
JS function is:
|
|
1348
|
+
|
|
1349
|
+
```js
|
|
1350
|
+
const myValidator =
|
|
1351
|
+
"customObj.common.type === 'boolean' && data.options.myType == 2";
|
|
1352
|
+
|
|
1353
|
+
const func = new Function(
|
|
1354
|
+
"data",
|
|
1355
|
+
"originalData",
|
|
1356
|
+
"_system",
|
|
1357
|
+
"instanceObj",
|
|
1358
|
+
"customObj",
|
|
1359
|
+
"_socket",
|
|
1360
|
+
arrayIndex,
|
|
1361
|
+
myValidator.includes("return") ? myValidator : "return " + myValidator
|
|
1362
|
+
); // e.g. "_alive === true"
|
|
1363
|
+
|
|
1364
|
+
const isValid = func(
|
|
1365
|
+
data || this.props.data,
|
|
1366
|
+
this.props.originalData,
|
|
1367
|
+
this.props.systemConfig,
|
|
1368
|
+
instanceObj,
|
|
1369
|
+
customObj,
|
|
1370
|
+
this.props.socket
|
|
1371
|
+
);
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
The following variables are available in JS function in custom settings:
|
|
1375
|
+
|
|
1376
|
+
- `data` - current custom settings or current line in the table (to access all settings use globalData)
|
|
1377
|
+
- `originalData` - Unchanged data
|
|
1378
|
+
- `_system` - system configuration
|
|
1379
|
+
- `instanceObj` - adapter instance object
|
|
1380
|
+
- `customObj` - current object itself
|
|
1381
|
+
- `_socket` - socket
|
|
1382
|
+
- `arrayIndex` - used only in table and represent current line in an array
|
|
1383
|
+
- `globalData` - used only in table for all settings and not only one table line
|
|
1384
|
+
|
|
1385
|
+
## Custom component
|
|
1386
|
+
|
|
1387
|
+
```jsx
|
|
1388
|
+
<CustomInstancesEditor
|
|
1389
|
+
common={common.data}
|
|
1390
|
+
alive={isInstanceAlive}
|
|
1391
|
+
data={data}
|
|
1392
|
+
socket={this.props.socket}
|
|
1393
|
+
themeName={this.props.themeName}
|
|
1394
|
+
themeType={this.props.themeType}
|
|
1395
|
+
theme={this.props.theme}
|
|
1396
|
+
name="accessAllowedConfigs"
|
|
1397
|
+
onChange={(newData, isChanged) => {}}
|
|
1398
|
+
onError={error => error can be true/false or text}
|
|
1399
|
+
/>
|
|
1400
|
+
```
|
|
1401
|
+
|
|
1402
|
+
You can find examples in [`telegram`](https://github.com/iobroker-community-adapters/ioBroker.telegram/tree/master/src-admin) or in [`pushbullet`](https://github.com/Jens1809/ioBroker.pushbullet/tree/master/src-admin) adapter.
|