iobroker.acinfinity 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,13 +3,14 @@
3
3
  * Verantwortlich für das Erstellen von Gerätestrukturen in ioBroker
4
4
  */
5
5
 
6
- "use strict";
6
+ 'use strict';
7
7
 
8
- const { OUTSIDE_CLIMATE_OPTIONS } = require("../constants");
8
+ const { OUTSIDE_CLIMATE_OPTIONS } = require('../constants');
9
9
 
10
10
  class DeviceCreator {
11
11
  /**
12
12
  * Erstellt einen neuen DeviceCreator
13
+ *
13
14
  * @param {object} stateManager - Referenz zum StateManager
14
15
  */
15
16
  constructor(stateManager) {
@@ -20,195 +21,200 @@ class DeviceCreator {
20
21
 
21
22
  /**
22
23
  * Erstellt ein Geräteobjekt in ioBroker
24
+ *
23
25
  * @param {string} deviceId - Geräte-ID
24
26
  * @param {string} deviceName - Gerätename
25
27
  * @returns {Promise<void>}
26
28
  */
27
29
  async createDeviceObject(deviceId, deviceName) {
28
30
  await this.stateCreator.createDevice(`devices.${deviceId}`, deviceName, {
29
- id: deviceId
31
+ id: deviceId,
30
32
  });
31
33
  }
32
34
 
33
35
  /**
34
36
  * Erstellt Infokanal für ein Gerät
37
+ *
35
38
  * @param {string} deviceId - Geräte-ID
36
39
  * @returns {Promise<void>}
37
40
  */
38
41
  async createInfoChannel(deviceId) {
39
42
  // Erstelle Info-Kanal
40
- await this.stateCreator.createChannel(`devices.${deviceId}.info`, "Geräteinformationen");
41
-
43
+ await this.stateCreator.createChannel(`devices.${deviceId}.info`, 'Geräteinformationen');
44
+
42
45
  // Erstelle Info-States
43
46
  await this.stateCreator.createMultipleStates([
44
47
  {
45
48
  id: `devices.${deviceId}.info.name`,
46
- name: "Name",
47
- type: "string",
48
- role: "text"
49
+ name: 'Name',
50
+ type: 'string',
51
+ role: 'text',
49
52
  },
50
53
  {
51
54
  id: `devices.${deviceId}.info.online`,
52
- name: "Online",
53
- type: "boolean",
54
- role: "indicator.connected"
55
+ name: 'Online',
56
+ type: 'boolean',
57
+ role: 'indicator.connected',
55
58
  },
56
59
  {
57
60
  id: `devices.${deviceId}.info.mac`,
58
- name: "MAC-Adresse",
59
- type: "string",
60
- role: "text"
61
+ name: 'MAC-Adresse',
62
+ type: 'string',
63
+ role: 'text',
61
64
  },
62
65
  {
63
66
  id: `devices.${deviceId}.info.firmware`,
64
- name: "Firmware-Version",
65
- type: "string",
66
- role: "text"
67
+ name: 'Firmware-Version',
68
+ type: 'string',
69
+ role: 'text',
67
70
  },
68
71
  {
69
72
  id: `devices.${deviceId}.info.hardware`,
70
- name: "Hardware-Version",
71
- type: "string",
72
- role: "text"
73
+ name: 'Hardware-Version',
74
+ type: 'string',
75
+ role: 'text',
73
76
  },
74
77
  {
75
78
  id: `devices.${deviceId}.info.deviceType`,
76
- name: "Gerätetyp",
77
- type: "number",
78
- role: "value"
79
- }
79
+ name: 'Gerätetyp',
80
+ type: 'number',
81
+ role: 'value',
82
+ },
80
83
  ]);
81
84
  }
82
85
 
83
86
  /**
84
87
  * Erstellt Sensorkanal für ein Gerät
88
+ *
85
89
  * @param {string} deviceId - Geräte-ID
86
90
  * @returns {Promise<void>}
87
91
  */
88
92
  async createSensorChannel(deviceId) {
89
93
  // Erstelle Sensors-Kanal
90
- await this.stateCreator.createChannel(`devices.${deviceId}.sensors`, "Sensoren");
91
-
94
+ await this.stateCreator.createChannel(`devices.${deviceId}.sensors`, 'Sensoren');
95
+
92
96
  // Erstelle Sensor-States
93
97
  await this.stateCreator.createMultipleStates([
94
98
  {
95
99
  id: `devices.${deviceId}.sensors.temperature`,
96
- name: "Temperatur",
97
- type: "number",
98
- role: "value.temperature",
99
- unit: "°C"
100
+ name: 'Temperatur',
101
+ type: 'number',
102
+ role: 'value.temperature',
103
+ unit: '°C',
100
104
  },
101
105
  {
102
106
  id: `devices.${deviceId}.sensors.humidity`,
103
- name: "Luftfeuchtigkeit",
104
- type: "number",
105
- role: "value.humidity",
106
- unit: "%"
107
+ name: 'Luftfeuchtigkeit',
108
+ type: 'number',
109
+ role: 'value.humidity',
110
+ unit: '%',
107
111
  },
108
112
  {
109
113
  id: `devices.${deviceId}.sensors.vpd`,
110
- name: "Sättigungsdefizit (VPD)",
111
- type: "number",
112
- role: "value",
113
- unit: "kPa"
114
+ name: 'Sättigungsdefizit (VPD)',
115
+ type: 'number',
116
+ role: 'value',
117
+ unit: 'kPa',
114
118
  },
115
119
  {
116
120
  id: `devices.${deviceId}.sensors.co2`,
117
- name: "CO₂",
118
- type: "number",
119
- role: "value.co2",
120
- unit: "ppm"
121
+ name: 'CO₂',
122
+ type: 'number',
123
+ role: 'value.co2',
124
+ unit: 'ppm',
121
125
  },
122
126
  {
123
127
  id: `devices.${deviceId}.sensors.soilMoisture`,
124
- name: "Bodenfeuchtigkeit",
125
- type: "number",
126
- role: "value.humidity",
127
- unit: "%"
128
+ name: 'Bodenfeuchtigkeit',
129
+ type: 'number',
130
+ role: 'value.humidity',
131
+ unit: '%',
128
132
  },
129
133
  {
130
134
  id: `devices.${deviceId}.sensors.waterLevel`,
131
- name: "Wasserstand",
132
- type: "number",
133
- role: "value",
134
- unit: "%"
135
+ name: 'Wasserstand',
136
+ type: 'number',
137
+ role: 'value',
138
+ unit: '%',
135
139
  },
136
140
  {
137
141
  id: `devices.${deviceId}.sensors.pluggedIn`,
138
- name: "Angeschlossen",
139
- type: "boolean",
140
- role: "indicator"
141
- }
142
+ name: 'Angeschlossen',
143
+ type: 'boolean',
144
+ role: 'indicator',
145
+ },
142
146
  ]);
143
-
147
+
144
148
  // Erstelle Einstellungen-Kanal
145
149
  await this.createSettingsChannel(deviceId);
146
150
  }
147
-
151
+
148
152
  /**
149
153
  * Erstellt Einstellungskanal für ein Gerät
154
+ *
150
155
  * @param {string} deviceId - Geräte-ID
151
156
  * @returns {Promise<void>}
152
157
  */
153
158
  async createSettingsChannel(deviceId) {
154
159
  // Erstelle Settings-Kanal
155
- await this.stateCreator.createChannel(`devices.${deviceId}.settings`, "Einstellungen");
156
-
160
+ await this.stateCreator.createChannel(`devices.${deviceId}.settings`, 'Einstellungen');
161
+
157
162
  // Erstelle Einstellungs-States
158
163
  await this.stateCreator.createMultipleStates([
159
164
  {
160
165
  id: `devices.${deviceId}.settings.temperatureUnit`,
161
- name: "Temperatureinheit",
162
- type: "string",
163
- role: "text",
166
+ name: 'Temperatureinheit',
167
+ type: 'string',
168
+ role: 'text',
164
169
  write: false,
165
- states: ["C", "F"]
170
+ states: ['C', 'F'],
166
171
  },
167
172
  {
168
173
  id: `devices.${deviceId}.settings.temperatureCalibration`,
169
- name: "Temperaturkalibrierung",
170
- type: "number",
171
- role: "level",
172
- unit: "°",
173
- write: true
174
+ name: 'Temperaturkalibrierung',
175
+ type: 'number',
176
+ role: 'level',
177
+ unit: '°',
178
+ write: true,
174
179
  },
175
180
  {
176
181
  id: `devices.${deviceId}.settings.humidityCalibration`,
177
- name: "Feuchtigkeitskalibrierung",
178
- type: "number",
179
- role: "level",
180
- unit: "%",
181
- write: true
182
+ name: 'Feuchtigkeitskalibrierung',
183
+ type: 'number',
184
+ role: 'level',
185
+ unit: '%',
186
+ write: true,
182
187
  },
183
188
  {
184
189
  id: `devices.${deviceId}.settings.vpdLeafTemperatureOffset`,
185
- name: "VPD Blatttemperatur-Offset",
186
- type: "number",
187
- role: "level",
188
- unit: "°",
189
- write: true
190
+ name: 'VPD Blatttemperatur-Offset',
191
+ type: 'number',
192
+ role: 'level',
193
+ unit: '°',
194
+ write: true,
190
195
  },
191
196
  {
192
197
  id: `devices.${deviceId}.settings.outsideTemperature`,
193
- name: "Außentemperatur",
194
- type: "string",
195
- role: "text",
198
+ name: 'Außentemperatur',
199
+ type: 'string',
200
+ role: 'text',
196
201
  write: true,
197
- states: OUTSIDE_CLIMATE_OPTIONS
202
+ states: OUTSIDE_CLIMATE_OPTIONS,
198
203
  },
199
204
  {
200
205
  id: `devices.${deviceId}.settings.outsideHumidity`,
201
- name: "Außenfeuchtigkeit",
202
- type: "string",
203
- role: "text",
206
+ name: 'Außenfeuchtigkeit',
207
+ type: 'string',
208
+ role: 'text',
204
209
  write: true,
205
- states: OUTSIDE_CLIMATE_OPTIONS
206
- }
210
+ states: OUTSIDE_CLIMATE_OPTIONS,
211
+ },
207
212
  ]);
208
213
  }
209
-
214
+
210
215
  /**
211
216
  * Erstellt eine vollständige Gerätestruktur mit allen notwendigen Unterkanälen
217
+ *
212
218
  * @param {string} deviceId - Geräte-ID
213
219
  * @param {string} deviceName - Gerätename
214
220
  * @returns {Promise<void>}
@@ -216,14 +222,14 @@ class DeviceCreator {
216
222
  async createCompleteDeviceStructure(deviceId, deviceName) {
217
223
  // Erstelle das Hauptgeräteobjekt
218
224
  await this.createDeviceObject(deviceId, deviceName);
219
-
225
+
220
226
  // Erstelle alle Unterkanäle
221
227
  await this.createInfoChannel(deviceId);
222
228
  await this.createSensorChannel(deviceId);
223
-
229
+
224
230
  // Erstelle Ports-Ordner
225
- await this.stateCreator.createFolder(`devices.${deviceId}.ports`, "Ports");
231
+ await this.stateCreator.createFolder(`devices.${deviceId}.ports`, 'Ports');
226
232
  }
227
233
  }
228
234
 
229
- module.exports = DeviceCreator;
235
+ module.exports = DeviceCreator;