iobroker.zendure-solarflow 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -83,6 +83,12 @@ This adapter authenticates on the official MQTT servers using the Cloud Authoriz
83
83
  Placeholder for the next version (at the beginning of the line):
84
84
  ### **WORK IN PROGRESS**
85
85
  -->
86
+
87
+ ## Changelog
88
+ ### 5.3.2 (2026-09-28)
89
+
90
+ - Fix to ignore MQTT messages from unknown devices
91
+
86
92
  ### 5.3.1 (2026-09-21)
87
93
 
88
94
  - Fixed an issue to ignore empty properties
@@ -109,11 +115,6 @@ This adapter authenticates on the official MQTT servers using the Cloud Authoriz
109
115
  - Fix batCur Reading
110
116
  - Add control state for inverseMaxPower and gridOffMode (Control AC outlet on 'Plus' Devices)
111
117
 
112
- ### 5.0.4 (2026-08-19)
113
-
114
- - Fix flickering Save button in Settings.
115
- - Add function to detect zenSDK devices with mDNS and fill missing IP-address if found.
116
-
117
118
  For older changes see [CHANGELOG_OLD.md](CHANGELOG_OLD.md).
118
119
 
119
120
  ## License
@@ -50,11 +50,13 @@ const initAdapter = (_adapter) => {
50
50
  adapter.log.debug("[initAdapter] Init adapter in mqttSharedService!");
51
51
  return true;
52
52
  };
53
+ const isKnownDevice = (deviceKey) => !!(adapter == null ? void 0 : adapter.zenIobDeviceList.some((x) => x.deviceKey == deviceKey));
53
54
  const onMessage = async (productKey, deviceKey, obj) => {
54
55
  if (adapter) {
55
56
  const _device = adapter == null ? void 0 : adapter.zenIobDeviceList.find((x) => x.deviceKey == deviceKey);
56
57
  if (!_device) {
57
- adapter.log.error(`[onMessage] DeviceKey '${deviceKey} not found in device list!'}`);
58
+ adapter.log.debug(`[onMessage] DeviceKey '${deviceKey}' not found in device list!`);
59
+ return;
58
60
  }
59
61
  let isSolarFlow = false;
60
62
  if ((_device == null ? void 0 : _device.productKey) != "8bM93H") {
@@ -85,13 +87,18 @@ const onMessageLocal = (topic, message) => {
85
87
  const topicSplitted = topic.replace("/server/app", "").split("/");
86
88
  const productKey = topicSplitted[1];
87
89
  const deviceKey = topicSplitted[2];
90
+ if (!isKnownDevice(deviceKey)) {
91
+ adapter == null ? void 0 : adapter.log.debug(`[onMessageLocal] Ignoring message on topic '${topic}', device not in device list!`);
92
+ return;
93
+ }
88
94
  let obj = {};
89
95
  try {
90
96
  obj = JSON.parse(message.toString());
91
97
  } catch {
92
98
  const txt = message.toString();
93
- adapter == null ? void 0 : adapter.log.error(`[onMessageLocal] JSON Parse error!`);
99
+ adapter == null ? void 0 : adapter.log.error(`[onMessageLocal] JSON Parse error on topic '${topic}'!`);
94
100
  adapter == null ? void 0 : adapter.log.debug(`[onMessageLocal] JSON Parse error: ${txt}!`);
101
+ return;
95
102
  }
96
103
  if ((adapter == null ? void 0 : adapter.log.level) == "debug") {
97
104
  adapter == null ? void 0 : adapter.log.debug(`[onMessageLocal] MQTT message on topic '${topic}': ${message.toString()}`);
@@ -113,6 +120,10 @@ const onMessageCloud = (topic, message) => {
113
120
  const topicSplitted = topic.replace("/server/app", "").split("/");
114
121
  const productKey = topicSplitted[1];
115
122
  const deviceKey = topicSplitted[2];
123
+ if (!isKnownDevice(deviceKey)) {
124
+ adapter == null ? void 0 : adapter.log.debug(`[onMessageCloud] Ignoring message on topic '${topic}', device not in device list!`);
125
+ return;
126
+ }
116
127
  let obj = {};
117
128
  try {
118
129
  obj = JSON.parse(message.toString());
@@ -121,8 +132,9 @@ const onMessageCloud = (topic, message) => {
121
132
  }
122
133
  } catch {
123
134
  const txt = message.toString();
124
- adapter == null ? void 0 : adapter.log.error(`[onMessageCloud] JSON Parse error!`);
135
+ adapter == null ? void 0 : adapter.log.error(`[onMessageCloud] JSON Parse error on topic '${topic}'!`);
125
136
  adapter == null ? void 0 : adapter.log.debug(`[onMessageCloud] JSON Parse error: ${txt}!`);
137
+ return;
126
138
  }
127
139
  if ((adapter == null ? void 0 : adapter.log.level) == "debug") {
128
140
  adapter == null ? void 0 : adapter.log.debug(`[onMessageCloud] MQTT message on topic '${topic}': ${message.toString()}`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/services/mqtt/mqttSharedService.ts"],
4
- "sourcesContent": ["import type mqtt from \"mqtt\";\nimport { processDeviceProperties } from \"../../helpers/processDeviceProperties\";\nimport type { ZendureSolarflow } from \"../../main\";\n\nimport type { IMqttData } from \"../../models/ISolarFlowMqttProperties\";\n\nexport let adapter: ZendureSolarflow | undefined = undefined;\n\nexport const knownPackDataProperties = [\n \"sn\",\n \"totalVol\",\n \"maxVol\",\n \"minVol\",\n \"socLevel\",\n \"maxTemp\",\n \"soh\",\n \"power\",\n \"batcur\",\n];\n\nexport const initAdapter = (_adapter: ZendureSolarflow): boolean => {\n adapter = _adapter;\n\n adapter.log.debug(\"[initAdapter] Init adapter in mqttSharedService!\");\n\n return true;\n};\n\nexport const onMessage = async (productKey: string, deviceKey: string, obj: IMqttData): Promise<void> => {\n if (adapter) {\n const _device = adapter?.zenIobDeviceList.find((x) => x.deviceKey == deviceKey);\n\n if (!_device) {\n adapter.log.error(`[onMessage] DeviceKey '${deviceKey} not found in device list!'}`);\n }\n\n let isSolarFlow = false;\n\n // Check if device is an solarflow or hyper device. Don't use LowVoltageBlock on an ACE device?\n if (_device?.productKey != \"8bM93H\") {\n isSolarFlow = true;\n }\n\n // Process properties if they exist in the message\n if (_device && obj.properties) {\n processDeviceProperties(_device, obj.properties, isSolarFlow);\n }\n\n // Process packData if it exists in the message\n if (_device && obj.packData) {\n _device.addOrUpdatePackData(obj.packData, isSolarFlow);\n }\n\n // Check if message is an ack for device automation and update state accordingly\n if (obj.function && obj.success != null && obj.success != undefined) {\n if ((obj.function == \"deviceAutomation\" || obj.function == \"hemsEP\") && obj.success == 1) {\n // setDeviceAutomationInOutLimit ack = true setzen;\n const currentValue = await adapter.getStateAsync(\n `${productKey}.${deviceKey}.control.setDeviceAutomationInOutLimit`,\n );\n\n _device?.updateSolarFlowControlState(\"setDeviceAutomationInOutLimit\", currentValue?.val ? currentValue.val : 0);\n } else if ((obj.function == \"deviceAutomation\" || obj.function == \"hemsEP\") && obj.success == 0) {\n adapter?.log.warn(\n `[onMessage] device automation failed for ${_device?.productName}: ${productKey}/${deviceKey}!`,\n );\n }\n }\n }\n};\n\nexport const onMessageLocal = (topic: string, message: Buffer): void => {\n const topicSplitted = topic.replace(\"/server/app\", \"\").split(\"/\");\n const productKey = topicSplitted[1];\n const deviceKey = topicSplitted[2];\n\n let obj: IMqttData = {};\n try {\n obj = JSON.parse(message.toString());\n } catch {\n const txt = message.toString();\n adapter?.log.error(`[onMessageLocal] JSON Parse error!`);\n\n adapter?.log.debug(`[onMessageLocal] JSON Parse error: ${txt}!`);\n }\n\n if (adapter?.log.level == \"debug\") {\n adapter?.log.debug(`[onMessageLocal] MQTT message on topic '${topic}': ${message.toString()}`);\n }\n\n onMessage(productKey, deviceKey, obj);\n\n // Relay message to cloud\n if (adapter?.config.relayMqttToCloud && adapter?.cloudMqttService?.mqttClient) {\n adapter?.log.debug(`[onMessageLocal] Relay local message to Zendure cloud MQTT!`);\n\n // Set flag to avoid loops, because the cloud will relay the message back to local and we don't want to process it twice\n obj.isHA = true;\n\n adapter.cloudMqttService.mqttClient.publish(\n topic,\n JSON.stringify(obj, (_, v) => v),\n );\n }\n};\n\nexport const onMessageCloud = (topic: string, message: Buffer): void => {\n if (topic.toLowerCase().includes(\"loginOut/force\")) {\n // TODO: Ausloggen???\n }\n\n const topicSplitted = topic.replace(\"/server/app\", \"\").split(\"/\");\n const productKey = topicSplitted[1];\n const deviceKey = topicSplitted[2];\n\n let obj: IMqttData = {};\n try {\n obj = JSON.parse(message.toString());\n\n if (obj.isHA) {\n // Message already processed in local mqtt, ignore to avoid loops\n return;\n }\n } catch {\n const txt = message.toString();\n adapter?.log.error(`[onMessageCloud] JSON Parse error!`);\n\n adapter?.log.debug(`[onMessageCloud] JSON Parse error: ${txt}!`);\n }\n\n if (adapter?.log.level == \"debug\") {\n adapter?.log.debug(`[onMessageCloud] MQTT message on topic '${topic}': ${message.toString()}`);\n }\n\n onMessage(productKey, deviceKey, obj);\n\n // Relay cloud message to local if not already from local\n if (!obj.isHA && adapter?.localMqttService?.mqttClient) {\n adapter?.log.debug(`[onMessageCloud] Relay Cloud message to local MQTT!`);\n\n adapter.localMqttService.mqttClient.publish(\n topic,\n JSON.stringify(obj, (_, v) => v),\n );\n }\n};\n\nexport const onConnected = (url: string, opts: mqtt.IClientOptions): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", true, true);\n adapter.log.info(`[onConnected] Connected with MQTT! URL: ${url}, Client ID: ${opts.clientId}`);\n }\n};\n\nexport const onReconnected = (url: string): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", true, true);\n adapter.log.info(`[onReconnected] Reconnected to MQTT! URL: ${url}`);\n }\n};\n\nexport const onDisconnected = (url: string): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", false, true);\n adapter.log.info(`[onDisconnected] Disconnected from MQTT! URL: ${url}`);\n }\n};\n\nexport const onError = (error: any, url: string): void => {\n if (adapter) {\n adapter.setState(\"info.connection\", false, true);\n adapter.log.error(`[onError] Connection to MQTT failed! URL: ${url}, Error: ${error}`);\n }\n};\n\nexport const onSubscribeReportTopic: any = (error: Error | null) => {\n if (error) {\n adapter?.log.error(`Subscription to MQTT failed! Error: ${error}`);\n } else {\n adapter?.log.debug(\"Subscription of Report Topic successful!\");\n }\n};\n\nexport const onSubscribeIotTopic: any = (error: Error | null, productKey: string, deviceKey: string) => {\n if (error) {\n adapter?.log.error(`Subscription to MQTT failed! Error: ${error}`);\n } else if (adapter) {\n adapter?.log.debug(`Subscription of IOT Topic successful! ProductKey: ${productKey}, DeviceKey: ${deviceKey}`);\n\n const _device = adapter.zenIobDeviceList.find((x) => x.productKey == productKey && x.deviceKey == deviceKey);\n\n if (_device) {\n const randomD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AQ,IAAI,MAAM,6CAA6C,GAAG,YAAY,KAAK,EAAE;AAAA,EACvF;AACF;AAEO,MAAM,yBAA8B,CAAC,UAAwB;AAClE,MAAI,OAAO;AACT,uCAAS,IAAI,MAAM,uCAAuC,KAAK;AAAA,EACjE,OAAO;AACL,uCAAS,IAAI,MAAM;AAAA,EACrB;AACF;AAEO,MAAM,sBAA2B,CAAC,OAAqB,YAAoB,cAAsB;AACtG,MAAI,OAAO;AACT,uCAAS,IAAI,MAAM,uCAAuC,KAAK;AAAA,EACjE,WAAW,SAAS;AAClB,uCAAS,IAAI,MAAM,qDAAqD,UAAU,gBAAgB,SAAS;AAE3G,UAAM,UAAU,QAAQ,iBAAiB,KAAK,CAAC,MAAM,EAAE,cAAc,cAAc,EAAE,aAAa,SAAS;AAE3G,QAAI,SAAS;AACX,YAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,EAAE,IAAI;AACrD,cAAQ,WAAW,MAAM;AACvB,gBAAQ,2BAA2B;AAAA,MACrC,GAAG,cAAc,GAAI;AAAA,IACvB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type mqtt from \"mqtt\";\nimport { processDeviceProperties } from \"../../helpers/processDeviceProperties\";\nimport type { ZendureSolarflow } from \"../../main\";\n\nimport type { IMqttData } from \"../../models/ISolarFlowMqttProperties\";\n\nexport let adapter: ZendureSolarflow | undefined = undefined;\n\nexport const knownPackDataProperties = [\n \"sn\",\n \"totalVol\",\n \"maxVol\",\n \"minVol\",\n \"socLevel\",\n \"maxTemp\",\n \"soh\",\n \"power\",\n \"batcur\",\n];\n\nexport const initAdapter = (_adapter: ZendureSolarflow): boolean => {\n adapter = _adapter;\n\n adapter.log.debug(\"[initAdapter] Init adapter in mqttSharedService!\");\n\n return true;\n};\n\nconst isKnownDevice = (deviceKey: string): boolean => !!adapter?.zenIobDeviceList.some((x) => x.deviceKey == deviceKey);\n\nexport const onMessage = async (productKey: string, deviceKey: string, obj: IMqttData): Promise<void> => {\n if (adapter) {\n const _device = adapter?.zenIobDeviceList.find((x) => x.deviceKey == deviceKey);\n\n if (!_device) {\n adapter.log.debug(`[onMessage] DeviceKey '${deviceKey}' not found in device list!`);\n return;\n }\n\n let isSolarFlow = false;\n\n // Check if device is an solarflow or hyper device. Don't use LowVoltageBlock on an ACE device?\n if (_device?.productKey != \"8bM93H\") {\n isSolarFlow = true;\n }\n\n // Process properties if they exist in the message\n if (_device && obj.properties) {\n processDeviceProperties(_device, obj.properties, isSolarFlow);\n }\n\n // Process packData if it exists in the message\n if (_device && obj.packData) {\n _device.addOrUpdatePackData(obj.packData, isSolarFlow);\n }\n\n // Check if message is an ack for device automation and update state accordingly\n if (obj.function && obj.success != null && obj.success != undefined) {\n if ((obj.function == \"deviceAutomation\" || obj.function == \"hemsEP\") && obj.success == 1) {\n // setDeviceAutomationInOutLimit ack = true setzen;\n const currentValue = await adapter.getStateAsync(\n `${productKey}.${deviceKey}.control.setDeviceAutomationInOutLimit`,\n );\n\n _device?.updateSolarFlowControlState(\"setDeviceAutomationInOutLimit\", currentValue?.val ? currentValue.val : 0);\n } else if ((obj.function == \"deviceAutomation\" || obj.function == \"hemsEP\") && obj.success == 0) {\n adapter?.log.warn(\n `[onMessage] device automation failed for ${_device?.productName}: ${productKey}/${deviceKey}!`,\n );\n }\n }\n }\n};\n\nexport const onMessageLocal = (topic: string, message: Buffer): void => {\n const topicSplitted = topic.replace(\"/server/app\", \"\").split(\"/\");\n const productKey = topicSplitted[1];\n const deviceKey = topicSplitted[2];\n\n // Ignore messages of foreign devices (e.g. other devices on a shared local broker)\n if (!isKnownDevice(deviceKey)) {\n adapter?.log.debug(`[onMessageLocal] Ignoring message on topic '${topic}', device not in device list!`);\n return;\n }\n\n let obj: IMqttData = {};\n try {\n obj = JSON.parse(message.toString());\n } catch {\n const txt = message.toString();\n adapter?.log.error(`[onMessageLocal] JSON Parse error on topic '${topic}'!`);\n\n adapter?.log.debug(`[onMessageLocal] JSON Parse error: ${txt}!`);\n return;\n }\n\n if (adapter?.log.level == \"debug\") {\n adapter?.log.debug(`[onMessageLocal] MQTT message on topic '${topic}': ${message.toString()}`);\n }\n\n onMessage(productKey, deviceKey, obj);\n\n // Relay message to cloud\n if (adapter?.config.relayMqttToCloud && adapter?.cloudMqttService?.mqttClient) {\n adapter?.log.debug(`[onMessageLocal] Relay local message to Zendure cloud MQTT!`);\n\n // Set flag to avoid loops, because the cloud will relay the message back to local and we don't want to process it twice\n obj.isHA = true;\n\n adapter.cloudMqttService.mqttClient.publish(\n topic,\n JSON.stringify(obj, (_, v) => v),\n );\n }\n};\n\nexport const onMessageCloud = (topic: string, message: Buffer): void => {\n if (topic.toLowerCase().includes(\"loginOut/force\")) {\n // TODO: Ausloggen???\n }\n\n const topicSplitted = topic.replace(\"/server/app\", \"\").split(\"/\");\n const productKey = topicSplitted[1];\n const deviceKey = topicSplitted[2];\n\n if (!isKnownDevice(deviceKey)) {\n adapter?.log.debug(`[onMessageCloud] Ignoring message on topic '${topic}', device not in device list!`);\n return;\n }\n\n let obj: IMqttData = {};\n try {\n obj = JSON.parse(message.toString());\n\n if (obj.isHA) {\n // Message already processed in local mqtt, ignore to avoid loops\n return;\n }\n } catch {\n const txt = message.toString();\n adapter?.log.error(`[onMessageCloud] JSON Parse error on topic '${topic}'!`);\n\n adapter?.log.debug(`[onMessageCloud] JSON Parse error: ${txt}!`);\n return;\n }\n\n if (adapter?.log.level == \"debug\") {\n adapter?.log.debug(`[onMessageCloud] MQTT message on topic '${topic}': ${message.toString()}`);\n }\n\n onMessage(productKey, deviceKey, obj);\n\n // Relay cloud message to local if not already from local\n if (!obj.isHA && adapter?.localMqttService?.mqttClient) {\n adapter?.log.debug(`[onMessageCloud] Relay Cloud message to local MQTT!`);\n\n adapter.localMqttService.mqttClient.publish(\n topic,\n JSON.stringify(obj, (_, v) => v),\n );\n }\n};\n\nexport const onConnected = (url: string, opts: mqtt.IClientOptions): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", true, true);\n adapter.log.info(`[onConnected] Connected with MQTT! URL: ${url}, Client ID: ${opts.clientId}`);\n }\n};\n\nexport const onReconnected = (url: string): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", true, true);\n adapter.log.info(`[onReconnected] Reconnected to MQTT! URL: ${url}`);\n }\n};\n\nexport const onDisconnected = (url: string): void => {\n if (adapter) {\n adapter.lastLogin = new Date();\n adapter.setState(\"info.connection\", false, true);\n adapter.log.info(`[onDisconnected] Disconnected from MQTT! URL: ${url}`);\n }\n};\n\nexport const onError = (error: any, url: string): void => {\n if (adapter) {\n adapter.setState(\"info.connection\", false, true);\n adapter.log.error(`[onError] Connection to MQTT failed! URL: ${url}, Error: ${error}`);\n }\n};\n\nexport const onSubscribeReportTopic: any = (error: Error | null) => {\n if (error) {\n adapter?.log.error(`Subscription to MQTT failed! Error: ${error}`);\n } else {\n adapter?.log.debug(\"Subscription of Report Topic successful!\");\n }\n};\n\nexport const onSubscribeIotTopic: any = (error: Error | null, productKey: string, deviceKey: string) => {\n if (error) {\n adapter?.log.error(`Subscription to MQTT failed! Error: ${error}`);\n } else if (adapter) {\n adapter?.log.debug(`Subscription of IOT Topic successful! ProductKey: ${productKey}, DeviceKey: ${deviceKey}`);\n\n const _device = adapter.zenIobDeviceList.find((x) => x.productKey == productKey && x.deviceKey == deviceKey);\n\n if (_device) {\n const randomDelay = Math.floor(Math.random() * 10) + 3;\n adapter.setTimeout(() => {\n _device.triggerFullTelemetryUpdate();\n }, randomDelay * 1000);\n }\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qCAAwC;AAKjC,IAAI,UAAwC;AAE5C,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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AAAA,EACvF;AACF;AAEO,MAAM,yBAA8B,CAAC,UAAwB;AAClE,MAAI,OAAO;AACT,uCAAS,IAAI,MAAM,uCAAuC,KAAK;AAAA,EACjE,OAAO;AACL,uCAAS,IAAI,MAAM;AAAA,EACrB;AACF;AAEO,MAAM,sBAA2B,CAAC,OAAqB,YAAoB,cAAsB;AACtG,MAAI,OAAO;AACT,uCAAS,IAAI,MAAM,uCAAuC,KAAK;AAAA,EACjE,WAAW,SAAS;AAClB,uCAAS,IAAI,MAAM,qDAAqD,UAAU,gBAAgB,SAAS;AAE3G,UAAM,UAAU,QAAQ,iBAAiB,KAAK,CAAC,MAAM,EAAE,cAAc,cAAc,EAAE,aAAa,SAAS;AAE3G,QAAI,SAAS;AACX,YAAM,cAAc,KAAK,MAAM,KAAK,OAAO,IAAI,EAAE,IAAI;AACrD,cAAQ,WAAW,MAAM;AACvB,gBAAQ,2BAA2B;AAAA,MACrC,GAAG,cAAc,GAAI;AAAA,IACvB;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "zendure-solarflow",
4
- "version": "5.3.1",
4
+ "version": "5.3.2",
5
5
  "news": {
6
+ "5.3.2": {
7
+ "en": "Fix to ignore MQTT messages from unknown devices",
8
+ "de": "Fix zum Ignorieren von MQTTs unbekannter Geräte",
9
+ "ru": "Исправлено игнорирование сообщений MQTT с неизвестных устройств",
10
+ "pt": "Correção para ignorar mensagens MQTT de PC",
11
+ "nl": "Oplossing om MQTT-berichten van onbekende apparaten te negeren",
12
+ "fr": "Corrigé pour ignorer les MQTT d'appareils inconnus",
13
+ "it": "Risolto il problema di ignorare MQTT da sconosciuti",
14
+ "es": "Arreglo para ignorar los mensajes MQTT de desconocidos",
15
+ "pl": "Poprawka ignorowania wiadomości MQTT z nieznanych urządzeń",
16
+ "uk": "Виправлено ігнорування повідомлень MQTT з невідомих пристроїв",
17
+ "zh-cn": "修复了忽略来自未知设备的 MQTT 消息的问题"
18
+ },
6
19
  "5.3.1": {
7
20
  "en": "Fixed an issue to ignore empty properties",
8
21
  "de": "Fehler beim Ignorieren leerer Objekte behoben",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.zendure-solarflow",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "zendure-solarflow",
5
5
  "author": {
6
6
  "name": "Peter",