iobroker.e3oncan 0.6.9 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,14 +40,14 @@ A scan for datapoints of each device is also available and should be done during
40
40
  All services provided by this adapter are based on device list of your specific Viessmann E3 setup. Therefore you have to follow following steps for first setup:
41
41
 
42
42
  **Configuration**
43
- * When installation od adapter has finished a confuration dialog will show up to configure up to two CAN bus adapters (tab "CAN ADAPTER")
43
+ * When installation of adapter has finished a confuration dialog will show up to configure up to two CAN bus adapters (tab "CAN ADAPTER")
44
44
  * Edit name of adapter and check the "Connect to adapter" checkbox at least the external adapter
45
- * When you're done, press "SAVE" button to apply the changes. This step is **mandatory**. The instance will restart, connect to the CAN adapter and do a scan for devices available on bus. **Please be patient** - this may take up to 20 seconds. You may watch the activities in a 2nd browser tab by looking on the logging info of the adapter.
46
- * When scan was successful new tabs will get visible in adapter confuration: "LIST OF UDS DEVICES", "LIST OF DATAPOINTS" and "ASSIGNMENTS TO EXTERNAL CAN ADAPTER".
47
- * Go to the "LIST OF UDS DEVICES" and check the list of devices. You may change the naming on 2nd column. Those names will be used to store all collected data in ioBoker's object tree. Again press "SAVE" button when you did your changes. Again this step is **mandatory**.
48
- * Instance will restart again and after a few seconds you are ready to a scan for available datapoints. Go to tab "LIST OF DATAPOINTS", press button "Start scan ..." and confirm with "OK" to start the scan. Again, **please be patient** - this may take **up to 5 minutes**. You may watch the progress in a 2nd browser tab by looking on the logging info of the adapter.
45
+ * When you're done, press "SAVE" button to apply the changes. This step is **mandatory**. The instance will restart and connect to the CAN adapter.
46
+ * Go to tab "LIST OF UDS DEVICES" and do a scan for devices available on bus by pressing the scan button. **This will take a few seconds.** You may watch the activities in a 2nd browser tab by looking on the logging info of the adapter.
47
+ * You may change the naming of the devices at 2nd column. Those names will be used to store all collected data in ioBoker's object tree. Again press "SAVE" button when you did your changes.
48
+ * Instance will restart again and after a few seconds you are ready to do a scan for available datapoints. Go to tab "LIST OF DATAPOINTS", press button "Start scan ..." and confirm with "OK". **Please be patient** - this may take **up to 5 minutes**. You may watch the progress in a 2nd browser tab by looking on the logging info of the adapter.
49
49
  This step is not mandatory but strongly recomended. If you would like to write to datapoints you need to do a datapoint scan first.
50
- * When datapoint scan was completed successfully, the datapoints are available in object tree for each device. You may view the datapoints in configuration by selecting a device and pressing button "Update list of datapoints". Press filter symbol and type search pattern to filter for name and/or codec. This is for your information only. Please deactivate filtering before selecting another device to avoid error messages.
50
+ * When datapoint scan was completed successfully, the datapoints are available in the object tree for each device. You may view the datapoints in configuration by selecting a device and pressing button "Update list of datapoints". Press filter symbol and type search pattern to filter for name and/or codec. This is for your information only. Please deactivate filtering before selecting another device to avoid error messages.
51
51
  * Last step is to configure schedules for collecting data on tab "ASSIGNMENTS TO EXTERNAL CAN ADAPTER".
52
52
  * For **energy meter E380** (if available in your setup) you just can activate or not. Please notice the value "Min. update time (s)". Updates to single datapoints are done no faster than the given value (default is 5 seconds). By choosing zero every received data will be stored. Since E380 is sending data very fast (more than 20 values per second), it's recommended not to use zero here. This would put a high load on the ioBroker system.
53
53
  * If you have connected E3 devices via CAN bus, e.g. Vitocal and VX3, you can collect data exchanged between those devices in realtime by listening. Press "+" to add a line, check "active" chackbox, select a device and edit "Min. update time (s)". It's feasable to use 0s here, however, I recommend to keep to the 5s.
@@ -84,12 +84,11 @@ You may use datapoints informations on tab "LIST OF DATAPOINTS" for reference (o
84
84
  * At present, the communication protocol is known only for Vitocal (listener on CAN id 0x693) and Vitocharge VX3 (listener on CAN id 0x451).
85
85
 
86
86
  ## What is different to open3e project?
87
- * Obviously, the main differece is the direct integration to ioBroker. Configuration can be done via dialogs, data get's directly listed in object tree.
88
- * **WriteByDid is supported for all data types** but restricted to datapoints on device specific white list, see info section of device. You need to do a datapoint scan to enable writing. Writing of data is triggered by storing the datapoint with ack=false - yes, it's that simple! The datapoint will be read again from device two seconds after writing. If datapoint not get's acknowledged, please take a look to the logs.
89
- * A scan for datapoints per device (as depict tool of open3e is doing) is available now. After a successful scan, device specific datapoints are listed in object tree.
90
- * In addation to open3e real time collecting of data via listening is supported.
87
+ * Obviously, the main differece is the direct integration to ioBroker. Configuration can be done via dialogs, data get's directly listed in object trees.
88
+ * **WriteByDid is supported for all data types** but restricted to datapoints on device specific white list, see info section of devices. You need to do a datapoint scan to enable writing. Writing of data is triggered by storing the datapoint with ack=false - yes, it's that simple! The datapoint will be read again from device two seconds after writing. If datapoint not get's acknowledged, please take a look to the logs.
89
+ * In addition to open3e real time collecting of data via listening is supported.
91
90
 
92
- ## May open3 be used in parallel?
91
+ ## May open3e be used in parallel?
93
92
  Yes, that is possible under certain conditions:
94
93
  * If you only use data collecting here, you can use open3e with no limitiations.
95
94
  * If you use UDSonCAN here, it's important not to do this for the same devices as open3e does. If you would do so, you will have sporadic communications errors.
@@ -99,6 +98,12 @@ Yes, that is possible under certain conditions:
99
98
  Placeholder for the next version (at the beginning of the line):
100
99
  ### **WORK IN PROGRESS**
101
100
  -->
101
+ ### 0.6.11 (2024-01-17)
102
+ * (MyHomeMyData) Improved layout of configuration dialog for device scan
103
+
104
+ ### 0.6.10 (2024-01-15)
105
+ * (MyHomeMyData) Removed code for Rawmode because it's never activated
106
+
102
107
  ### 0.6.9 (2024-01-13)
103
108
  * (MyHomeMyData) Bugfix: Only Linux is supported
104
109
 
@@ -56,5 +56,6 @@
56
56
  "Separate by comma! All given datapoints will be requested with specified schedule and ECU address.": "Durch Komma trennen! Alle angegebenen Datenpunkte werden mit der angegebenen Wiederholungszeit von der ECU-Adresse angefordert.",
57
57
  "Assignments to Internal CAN Adapter": "Zuordnungen zum internen CAN-Adapter",
58
58
  "Collecting Data on Internal CAN Adapter": "Sammeln von Daten auf dem internen CAN-Adapter",
59
- "Update list of datapoints": "Liste der Datenpunkte aktualisieren"
59
+ "Update list of datapoints": "Liste der Datenpunkte aktualisieren",
60
+ "Start scan to update list of devices": "Scan starten, um die Liste der UDS-Geräte zu aktualisieren"
60
61
  }
@@ -56,5 +56,6 @@
56
56
  "Separate by comma! All given datapoints will be requested with specified schedule and ECU address.":"Separate by comma! All given datapoints will be requested with specified schedule and ECU address.",
57
57
  "Assignments to Internal CAN Adapter":"Assignments to Internal CAN Adapter",
58
58
  "Collecting Data on Internal CAN Adapter":"Collecting Data on Internal CAN Adapter",
59
- "Update list of datapoints":"Update list of datapoints"
59
+ "Update list of datapoints":"Update list of datapoints",
60
+ "Start scan to update list of devices":"Start scan to update list of devices"
60
61
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Recopilación de datos en el adaptador CAN interno",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Escuche los datos sobre las direcciones que figuran en esta tabla. No se puede escribir en el bus CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Dispositivos para la recogida de datos. No se puede escribir en el bus CAN. Presione '+' para agregar el dispositivo.",
61
- "Update list of datapoints": "Actualizar lista de puntos de datos"
61
+ "Update list of datapoints": "Actualizar lista de puntos de datos",
62
+ "Start scan to update list of devices": "Iniciar escaneo para actualizar la lista de dispositivos"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Collecte de données sur l'adaptateur CAN interne",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Écoutez les données sur les adresses indiquées dans ce tableau. Pas d'écriture sur le bus CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Appareils de collecte de données. Pas d'écriture sur le bus CAN. Appuyez sur « + » pour ajouter un appareil.",
61
- "Update list of datapoints": "Mettre à jour la liste des points de données"
61
+ "Update list of datapoints": "Mettre à jour la liste des points de données",
62
+ "Start scan to update list of devices": "Démarrer l'analyse pour mettre à jour la liste des appareils"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Raccolta dati sull'adattatore CAN interno",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Ascoltare i dati sugli indirizzi forniti in questa tabella. Nessuna scrittura sul bus CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Dispositivi per la raccolta dei dati. Nessuna scrittura sul bus CAN. Premi \"+\" per aggiungere il dispositivo.",
61
- "Update list of datapoints": "Aggiorna l'elenco dei punti dati"
61
+ "Update list of datapoints": "Aggiorna l'elenco dei punti dati",
62
+ "Start scan to update list of devices": "Avvia la scansione per aggiornare l'elenco dei dispositivi"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Gegevens verzamelen over de interne CAN-adapter",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Luister naar gegevens over adressen in deze tabel. Geen schrijven naar CAN-bus.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Apparaten voor het verzamelen van gegevens. Geen schrijven naar CAN-bus. Druk op '+' om apparaat toe te voegen.",
61
- "Update list of datapoints": "Lijst met datapunten bijwerken"
61
+ "Update list of datapoints": "Lijst met datapunten bijwerken",
62
+ "Start scan to update list of devices": "Start de scan om de lijst met apparaten bij te werken"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Zbieranie danych na wewnętrznym adapterze CAN",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Posłuchaj danych o adresach podanych w tej tabeli. Brak zapisu do magistrali CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Urządzenia do gromadzenia danych. Brak zapisu do magistrali CAN. Naciśnij „+”, aby dodać urządzenie.",
61
- "Update list of datapoints": "Zaktualizuj listę punktów danych"
61
+ "Update list of datapoints": "Zaktualizuj listę punktów danych",
62
+ "Start scan to update list of devices": "Rozpocznij skanowanie, aby zaktualizować listę urządzeń"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Coletando dados no adaptador CAN interno",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Ouça os dados sobre os endereços fornecidos nesta tabela. Não há gravação no barramento CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Dispositivos para coleta de dados. Não há gravação no barramento CAN. Pressione '+' para adicionar dispositivo.",
61
- "Update list of datapoints": "Atualizar lista de pontos de dados"
61
+ "Update list of datapoints": "Atualizar lista de pontos de dados",
62
+ "Start scan to update list of devices": "Inicie a verificação para atualizar a lista de dispositivos"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Сбор данных о внутреннем CAN-адаптере",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Прослушайте данные по адресам, указанным в этой таблице. Нет записи в CAN-шину.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Устройства для сбора данных. Нет записи в CAN-шину. Нажмите «+», чтобы добавить устройство.",
61
- "Update list of datapoints": "Обновить список точек данных"
61
+ "Update list of datapoints": "Обновить список точек данных",
62
+ "Start scan to update list of devices": "Запустите сканирование, чтобы обновить список устройств."
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "Збір даних про внутрішній адаптер CAN",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "Прослухайте дані за адресами, наведені в цій таблиці. Немає запису на шину CAN.",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "Пристрої для збору даних. Немає запису на шину CAN. Натисніть «+», щоб додати пристрій.",
61
- "Update list of datapoints": "Оновити список точок даних"
61
+ "Update list of datapoints": "Оновити список точок даних",
62
+ "Start scan to update list of devices": "Почніть сканування, щоб оновити список пристроїв"
62
63
  }
@@ -58,5 +58,6 @@
58
58
  "Collecting Data on Internal CAN Adapter": "收集内部 CAN 适配器的数据",
59
59
  "Listen for data on addresses given in this table. No writing to CAN bus.": "侦听此表中给出的地址上的数据。不写入 CAN 总线。",
60
60
  "Devices for collecting data. No writing to CAN bus. Press '+' to add device.": "用于收集数据的设备。不写入 CAN 总线。按“+”添加设备。",
61
- "Update list of datapoints": "更新数据点列表"
61
+ "Update list of datapoints": "更新数据点列表",
62
+ "Start scan to update list of devices": "开始扫描以更新设备列表"
62
63
  }
@@ -99,15 +99,6 @@
99
99
  "hidden": "if ((data.tableUdsDevices) && (data.tableUdsDevices.length > 0)) { return true; } else {return false; }",
100
100
  "newLine": true
101
101
  },
102
- "introTableScanIsActiveTxt": {
103
- "type": "staticText",
104
- "text": "UDS device scan is ongoing. This may take up to 20 seconds.",
105
- "newLine": true,
106
- "hidden": "if ((data.tableUdsDevices) && (data.tableUdsDevices.length > 0)) { return true; } else {return false; }",
107
- "style": {
108
- "color": "red"
109
- }
110
- },
111
102
  "introTableNoEmptyDevNameTxt": {
112
103
  "type": "staticText",
113
104
  "text": "'Device state name' must not be blank!",
@@ -126,11 +117,23 @@
126
117
  "color": "red"
127
118
  }
128
119
  },
120
+ "tableUdsDevicesButton": {
121
+ "type": "sendTo",
122
+ "label": "Start scan to update list of devices",
123
+ "variant": "outlined",
124
+ "showProcess": true,
125
+ "command": "getUdsDevices",
126
+ "jsonData": "{}",
127
+ "useNative": true,
128
+ "hidden": "!_alive",
129
+ "newLine": true,
130
+ "sm": 12,
131
+ "md": 12,
132
+ "lg": 12
133
+ },
129
134
 
130
135
  "tableUdsDevices": {
131
136
  "type": "table",
132
- "defaultSendTo": "getUdsDevices",
133
- "jsonData": "${JSON.stringify(data.tableUdsDevices)}",
134
137
  "uniqueColumns": ["devStateName"],
135
138
  "newLine": true,
136
139
  "sm": 12,
@@ -206,9 +209,6 @@
206
209
  "label": "Start scan for datapoints of all devices",
207
210
  "variant": "outlined",
208
211
  "showProcess": true,
209
- "style": {
210
- "align": "right"
211
- },
212
212
  "jsonData": "{}",
213
213
  "command": "startDidScan",
214
214
  "confirm": {
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "e3oncan",
4
- "version": "0.6.9",
4
+ "version": "0.6.11",
5
5
  "news": {
6
+ "0.6.11": {
7
+ "en": "Improved layout of configuration dialog for device scan",
8
+ "de": "Verbessertes Layout des Konfigurationsdialogs für den Gerätescan",
9
+ "ru": "Улучшен диалог настройки для сканирования устройства",
10
+ "pt": "Melhor layout da caixa de diálogo de configuração para verificação do dispositivo",
11
+ "nl": "Verbeterde lay-out van configuratiedialoog voor apparaatscans",
12
+ "fr": "Mise en page améliorée de la boîte de dialogue de configuration pour l'analyse des périphériques",
13
+ "it": "Miglioramento del layout della finestra di dialogo di configurazione per la scansione del dispositivo",
14
+ "es": "Diseño mejorado del diálogo de configuración para el análisis del dispositivo",
15
+ "pl": "Ulepszony układ okna konfiguracji skanowania urządzenia",
16
+ "uk": "Покращений макет діалогу конфігурації для сканування пристроїв",
17
+ "zh-cn": "设备扫描配置对话框的改进版式"
18
+ },
19
+ "0.6.10": {
20
+ "en": "Removed code for Rawmode because it's never activated",
21
+ "de": "Entfernter Code für Rawmode, weil es nie aktiviert ist",
22
+ "ru": "Удаленный код для Rawmode, потому что он никогда не активирован",
23
+ "pt": "Código removido para Rawmode porque nunca foi ativado",
24
+ "nl": "Verwijderde code voor Rawmode omdat het nooit is geactiveerd",
25
+ "fr": "Code supprimé pour Rawmode car il n'est jamais activé",
26
+ "it": "Codice rimosso per Rawmode perché non è mai attivato",
27
+ "es": "Código eliminado para Rawmode porque nunca se activa",
28
+ "pl": "Usunięto kod dla Rawmode ponieważ nigdy nie jest aktywowany",
29
+ "uk": "Видалити код для Rawmode, тому що він ніколи не активований",
30
+ "zh-cn": "删除了Rawmode的代码,因为它从未被激活"
31
+ },
6
32
  "0.6.9": {
7
33
  "en": "Bugfix: Only Linux is supported",
8
34
  "de": "Bugfix: Nur Linux wird unterstützt",
package/lib/canUds.js CHANGED
@@ -43,7 +43,6 @@ class uds {
43
43
  this.config.worker = 'uds';
44
44
  this.storage = new storage.storage(this.config);
45
45
  this.states = ['standby','waitForFFrbd','waitForCFrbd','waitForFFSFwbd','waitForFFMFwbd'];
46
- this.frameFC = [0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00];
47
46
  this.readByDidProt = {
48
47
  'idTx' : this.config.canID,
49
48
  'idRx' : Number(this.config.canID) + 0x10,
@@ -576,7 +575,7 @@ class uds {
576
575
  ctx.log.silly('UDS worker on '+this.config.stateBase+': FF received. candata: '+this.storage.arr2Hex(candata));
577
576
  this.data.databytes = candata.slice(5);
578
577
  this.data.D0 = 0x21;
579
- this.sendFrame(ctx, this.frameFC); // Send request for Consecutive Frames
578
+ this.sendFrame(ctx, this.readByDidProt.FC); // Send request for Consecutive Frames
580
579
  await this.setComState(2); // 'waitForCFrbd'
581
580
  break;
582
581
  } else {
package/lib/codecs.js CHANGED
@@ -1,17 +1,3 @@
1
- class codecOpMode {
2
- constructor(raw=true) {
3
- this.raw = raw;
4
- }
5
-
6
- setOpMode(raw) {
7
- this.raw = raw;
8
- }
9
- getOpMode() {
10
- return this.raw;
11
- }
12
- }
13
-
14
- const rawmode = new codecOpMode(true);
15
1
 
16
2
  const enums = require('./enums');
17
3
 
@@ -124,20 +110,13 @@ class O3EInt {
124
110
  this.signed = _args.signed;
125
111
  }
126
112
  encode(data) {
127
- if (rawmode.getOpMode()) {
128
- return RawEncode(data, this.string_len);
129
- } else {
130
- if (this.offset != 0) {
131
- throw new Error('O3EInt.encode(): offset!=0 not implemented yet');
132
- }
133
- return val2byteArr(data, this.byte_width, this.scale, this.signed);
113
+ if (this.offset != 0) {
114
+ throw new Error('O3EInt.encode(): offset!=0 not implemented yet');
134
115
  }
116
+ return val2byteArr(data, this.byte_width, this.scale, this.signed);
135
117
  }
136
118
 
137
119
  decode(data) {
138
- if (rawmode.getOpMode()) {
139
- return RawDecode(data);
140
- }
141
120
  return int2val(data.slice(this.offset,this.offset+this.byte_width), 0, this.signed) / this.scale;
142
121
  }
143
122
 
@@ -174,20 +153,13 @@ class O3EByteVal {
174
153
  this.offset = _args.offset;
175
154
  }
176
155
  encode(data) {
177
- if (rawmode.getOpMode()) {
178
- return RawEncode(data, this.string_len);
179
- } else {
180
- if (this.offset != 0) {
181
- throw new Error('O3EByteVal.encode(): offset!=0 not implemented yet');
182
- }
183
- return val2byteArr(data, this.string_len, 1, false);
156
+ if (this.offset != 0) {
157
+ throw new Error('O3EByteVal.encode(): offset!=0 not implemented yet');
184
158
  }
159
+ return val2byteArr(data, this.string_len, 1, false);
185
160
  }
186
161
 
187
162
  decode(string_bin) {
188
- if (rawmode.getOpMode()) {
189
- return RawDecode(string_bin);
190
- }
191
163
  let val = 0;
192
164
  for (let i = 0; i < this.string_len; i++) {
193
165
  val += string_bin[i + this.offset] << (i * 8);
@@ -207,17 +179,10 @@ class O3EBool {
207
179
  this.offset = _args.offset;
208
180
  }
209
181
  encode(data) {
210
- if (rawmode.getOpMode()) {
211
- return RawEncode(data, this.string_len);
212
- }
213
182
  return (data == 'off' ? 0 : 1);
214
- //throw new Error('O3EBool.encode(): not implemented yet');
215
183
  }
216
184
 
217
185
  decode(string_bin) {
218
- if (rawmode.getOpMode()) {
219
- return RawDecode(string_bin);
220
- }
221
186
  const val = string_bin[this.offset];
222
187
  return (val == 0 ? 'off' : 'on' );
223
188
  }
@@ -234,9 +199,6 @@ class O3EUtf8 {
234
199
  this.offset = _args.offset;
235
200
  }
236
201
  encode(data) {
237
- if (rawmode.getOpMode()) {
238
- return RawEncode(data, this.string_len);
239
- }
240
202
  const encoder = new TextEncoder();
241
203
  const result = Object.values(encoder.encode(data));
242
204
  if (result.length > this.string_len) throw new Error('O3EUtf8.encode() result too long: '+this.id+' - '+String(result.length)+' > '+String(this.string_len));
@@ -244,9 +206,6 @@ class O3EUtf8 {
244
206
 
245
207
  }
246
208
  decode(string_bin) {
247
- if (rawmode.getOpMode()) {
248
- return RawDecode(string_bin);
249
- }
250
209
  let mystr = '';
251
210
  for (let i=this.offset; i<this.offset+this.string_len;i++) { mystr += String.fromCharCode(string_bin[i]); }
252
211
  // eslint-disable-next-line no-control-regex
@@ -264,9 +223,6 @@ class O3ESoftVers {
264
223
  this.id = idStr;
265
224
  }
266
225
  encode(data) {
267
- if (rawmode.getOpMode()) {
268
- return RawEncode(data, this.string_len);
269
- }
270
226
  let result = [];
271
227
  const arr = data.split('.');
272
228
  for (const v of Object.values(arr)) result = result.concat(val2byteArr(v,2,1,false));
@@ -274,9 +230,6 @@ class O3ESoftVers {
274
230
  return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
275
231
  }
276
232
  decode(string_bin) {
277
- if (rawmode.getOpMode()) {
278
- return RawDecode(string_bin);
279
- }
280
233
  const lstv = [];
281
234
  for (let i = 0; i < this.string_len; i += 2) {
282
235
  lstv.push(string_bin[i] + (string_bin[i+1] << 8));
@@ -294,16 +247,9 @@ class O3EMacAddr {
294
247
  this.id = idStr;
295
248
  }
296
249
  encode(data) {
297
- if (rawmode.getOpMode()) {
298
- return RawEncode(data, this.string_len);
299
- }
300
250
  return(data.split('-').map(function(str) {return parseInt('0x'+str);}));
301
-
302
251
  }
303
252
  decode(string_bin) {
304
- if (rawmode.getOpMode()) {
305
- return RawDecode(string_bin);
306
- }
307
253
  const lstv = [];
308
254
  for (let i = 0; i < this.string_len; i++) {
309
255
  lstv.push(toHex(string_bin[i],2).toUpperCase());
@@ -321,16 +267,9 @@ class O3EIp4Addr {
321
267
  this.id = idStr;
322
268
  }
323
269
  encode(data) {
324
- if (rawmode.getOpMode()) {
325
- return RawEncode(data, this.string_len);
326
- }
327
270
  return(data.split('.').map(function(str) {return parseInt(str);}));
328
-
329
271
  }
330
272
  decode(string_bin) {
331
- if (rawmode.getOpMode()) {
332
- return RawDecode(string_bin);
333
- }
334
273
  const lstv = [];
335
274
  for (let i = 0; i < this.string_len; i++) {
336
275
  lstv.push(string_bin[i].toString().padStart(3,'0'));
@@ -348,18 +287,12 @@ class O3ESdate {
348
287
  this.id = idStr;
349
288
  }
350
289
  encode(data) {
351
- if (rawmode.getOpMode()) {
352
- return RawEncode(data, this.string_len);
353
- }
354
290
  const dt = new Date(data);
355
291
  if (!dt.valueOf()) throw new Error('could not convert date value');
356
292
  return [dt.getDate(),dt.getMonth()+1,dt.getFullYear()%100];
357
293
 
358
294
  }
359
295
  decode(string_bin) {
360
- if (rawmode.getOpMode()) {
361
- return RawDecode(string_bin);
362
- }
363
296
  const dt = new Date(
364
297
  string_bin[2]+2000, // year
365
298
  string_bin[1]-1, // month
@@ -378,9 +311,6 @@ class O3EStime {
378
311
  this.id = idStr;
379
312
  }
380
313
  encode(data) {
381
- if (rawmode.getOpMode()) {
382
- return RawEncode(data, this.string_len);
383
- }
384
314
  if (this.string_len == 1) data += ':00'; // Date() needs at least hour:minute
385
315
  const now = new Date();
386
316
  const dt = new Date(now.toDateString()+' '+data);
@@ -390,9 +320,6 @@ class O3EStime {
390
320
 
391
321
  }
392
322
  decode(string_bin) {
393
- if (rawmode.getOpMode()) {
394
- return RawDecode(string_bin);
395
- }
396
323
  const now = new Date();
397
324
  const dt = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
398
325
  string_bin[0], // hour
@@ -413,9 +340,6 @@ class O3EDateTime {
413
340
  this.timeformat = _args.timeformat;
414
341
  }
415
342
  encode(data) {
416
- if (rawmode.getOpMode()) {
417
- return RawEncode(data, this.string_len);
418
- }
419
343
  if (this.timeformat == 'VM') {
420
344
  const dt = new Date(data.Timestamp);
421
345
  if (!dt.valueOf()) throw new Error('could not convert datetime value');
@@ -428,9 +352,6 @@ class O3EDateTime {
428
352
 
429
353
  }
430
354
  decode(string_bin) {
431
- if (rawmode.getOpMode()) {
432
- return RawDecode(string_bin);
433
- }
434
355
  let dt = new Date();
435
356
  if (this.timeformat == 'VM') {
436
357
  dt = new Date(
@@ -460,18 +381,12 @@ class O3EUtc {
460
381
  this.id = idStr;
461
382
  }
462
383
  encode(data) {
463
- if (rawmode.getOpMode()) {
464
- return RawEncode(data, this.string_len);
465
- }
466
384
  const dt = new Date(data);
467
385
  if (!dt) throw new Error('could not convert Utc date value');
468
386
  return val2byteArr(dt.getTime(),this.string_len,0.001,false);
469
387
 
470
388
  }
471
389
  decode(string_bin) {
472
- if (rawmode.getOpMode()) {
473
- return RawDecode(string_bin);
474
- }
475
390
  const dt = new Date(uint32toVal(string_bin.slice(0,4),0)*1000);
476
391
  return dt.toUTCString();
477
392
  }
@@ -487,16 +402,9 @@ class O3EEnum {
487
402
  this.listStr = _args.listStr;
488
403
  }
489
404
  encode(data) {
490
- if (rawmode.getOpMode()) {
491
- return RawEncode(data, this.string_len);
492
- }
493
405
  return val2byteArr(data.ID, this.string_len, 1, false);
494
-
495
406
  }
496
407
  decode(string_bin) {
497
- if (rawmode.getOpMode()) {
498
- return RawDecode(string_bin);
499
- }
500
408
  const val = int2val(string_bin);
501
409
  let txt = '';
502
410
  if ( (this.listStr in enums.enums) && (String(val) in enums.enums[this.listStr]) ) {
@@ -519,9 +427,6 @@ class O3EList {
519
427
  this.subTypes = _args.subTypes;
520
428
  }
521
429
  encode(data) {
522
- if (rawmode.getOpMode()) {
523
- return RawEncode(data, this.string_len);
524
- }
525
430
  let result = [];
526
431
  for (const cdi of Object.values(this.subTypes)) {
527
432
  const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
@@ -539,9 +444,6 @@ class O3EList {
539
444
  return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
540
445
  }
541
446
  decode(string_bin) {
542
- if (rawmode.getOpMode()) {
543
- return RawDecode(string_bin);
544
- }
545
447
  const result = {};
546
448
  let index = 0;
547
449
  let count = 0;
@@ -583,16 +485,10 @@ class O3EArray {
583
485
  this.subTypes = _args.subTypes;
584
486
  this.len = _args.arrayLength;
585
487
  }
586
- encode(data) {
587
- if (rawmode.getOpMode()) {
588
- return RawEncode(data, this.string_len);
589
- }
488
+ encode(_data) {
590
489
  throw new Error('not implemented yet');
591
490
  }
592
491
  decode(string_bin) {
593
- if (rawmode.getOpMode()) {
594
- return RawDecode(string_bin);
595
- }
596
492
  const result = {};
597
493
  let index = 0;
598
494
  const count = this.len;
@@ -618,10 +514,6 @@ class O3EComplexType {
618
514
  this.subTypes = _args.subTypes;
619
515
  }
620
516
  encode(data) {
621
- if (rawmode.getOpMode()) {
622
- return RawEncode(data, this.string_len);
623
- }
624
-
625
517
  let result = [];
626
518
  for (const cdi of Object.values(this.subTypes)) {
627
519
  const subT = new O3Ecodecs[cdi.codec](cdi.len, cdi.id, cdi.args);
@@ -631,9 +523,6 @@ class O3EComplexType {
631
523
  return result.concat(Array.from(Array(this.string_len-result.length), () => 0));
632
524
  }
633
525
  decode(string_bin) {
634
- if (rawmode.getOpMode()) {
635
- return RawDecode(string_bin);
636
- }
637
526
  const result = {};
638
527
  let index = 0;
639
528
  for (const cdi of Object.values(this.subTypes)) {
@@ -655,18 +544,11 @@ class O3EcosPhi {
655
544
  this.offset = _args.offset;
656
545
  this.scale = _args.scale;
657
546
  }
658
- encode(data) {
659
- if (rawmode.getOpMode()) {
660
- return RawEncode(data, this.string_len);
661
- } else {
662
- throw new Error('not implemented yet');
663
- }
547
+ encode(_data) {
548
+ throw new Error('not implemented yet');
664
549
  }
665
550
 
666
551
  decode(string_bin) {
667
- if (rawmode.getOpMode()) {
668
- return RawDecode(string_bin);
669
- }
670
552
  let val = string_bin[1+this.offset];
671
553
  if (string_bin[this.offset] == 0x04) {
672
554
  val = -1.0*val;
@@ -704,6 +586,5 @@ const O3Ecodecs = {
704
586
  module.exports = {
705
587
  O3Ecodecs,
706
588
  arr2Hex,
707
- toByteArray,
708
- rawmode
589
+ toByteArray
709
590
  };
package/main.js CHANGED
@@ -12,7 +12,6 @@ const utils = require('@iobroker/adapter-core');
12
12
  // const fs = require("fs");
13
13
 
14
14
  const can = require('socketcan');
15
- const codecs = require('./lib/codecs');
16
15
  const storage = require('./lib/storage');
17
16
  const collect = require('./lib/canCollect');
18
17
  const uds = require('./lib/canUds');
@@ -47,7 +46,6 @@ class E3oncan extends utils.Adapter {
47
46
  this.udsDidForScan = 256; // Busidentification is in this id
48
47
  this.udsScanWorker = new udsScan.udsScan();
49
48
  this.udsScanDevices = []; // UDS devices found during scan
50
- this.doUdsDevScan = false;
51
49
  this.udsDevAddrs = [];
52
50
  this.udsDevStateNames = [];
53
51
  this.udsDidsMaxNmbr = 3000; // Max. number of dids per device for scan
@@ -81,12 +79,6 @@ class E3oncan extends utils.Adapter {
81
79
  this.udsDevStateNames.push(dev.devStateName);
82
80
  }
83
81
 
84
- codecs.rawmode.setOpMode(false);
85
-
86
- // Check for required scan for UDS devices
87
- this.doUdsDevScan = (this.config.tableUdsDevices.length == 0);
88
- if (this.doUdsDevScan) await this.log.info('UDS device scan is required.');
89
-
90
82
  // Setup external CAN bus if required
91
83
  // ==================================
92
84
 
@@ -329,25 +321,18 @@ class E3oncan extends utils.Adapter {
329
321
  if (obj.command === 'getUdsDevices') {
330
322
  if (obj.callback) {
331
323
  if (!this.udsDevScanIsRunning) {
332
- if (this.doUdsDevScan) {
333
- let success = false;
334
- this.udsDevScanIsRunning = true;
335
- await this.log.silly(`Received data - ${JSON.stringify(obj)}`);
336
- //this.udsScanDevices = obj.message.udsDevices;
337
- success = await this.udsScanWorker.scanUdsDevices(this);
338
- await this.sendTo(obj.from, obj.command, this.udsDevices, obj.callback);
339
- if (success) this.doUdsDevScan = false;
340
- this.udsDevScanIsRunning = false;
341
- } else {
342
- // Scan not required. Do nothing
343
- this.sendTo(obj.from, obj.command, obj.message, obj.callback);
344
- }
324
+ this.udsDevScanIsRunning = true;
325
+ await this.log.silly(`Received data - ${JSON.stringify(obj)}`);
326
+ await this.udsScanWorker.scanUdsDevices(this);
327
+ await this.log.silly(`Data to send - ${JSON.stringify({native: {tableUdsDevices: this.udsDevices}})}`);
328
+ await this.sendTo(obj.from, obj.command, {native: {tableUdsDevices: this.udsDevices}}, obj.callback);
329
+ this.udsDevScanIsRunning = false;
345
330
  } else {
346
331
  await this.log.debug('Request "getUdsDevice" during running UDS scan!');
347
- this.sendTo(obj.from, obj.command, obj.message, obj.callback);
332
+ this.sendTo(obj.from, obj.command, {native: {tableUdsDevices: this.udsDevices}}, obj.callback);
348
333
  }
349
334
  } else {
350
- this.sendTo(obj.from, obj.command, [], obj.callback);
335
+ this.sendTo(obj.from, obj.command, {native: {tableUdsDevices: []}}, obj.callback);
351
336
  }
352
337
  }
353
338
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.e3oncan",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "Collect data on CAN bus for Viessmann E3 devices, e.g. Vitocal, Vitocharge, Energy Meter E380",
5
5
  "author": {
6
6
  "name": "Juergen",