iobroker.smartfriends 1.0.0 → 1.0.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/LICENSE CHANGED
@@ -1,34 +1,34 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Black-Thunder <glwars@aol.de>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
-
24
- -------------------------------------------------------------------------------
25
-
26
- LoPablo/SchellenbergApi (https://github.com/LoPablo/SchellenbergApi)
27
-
28
- ISC License
29
-
30
- Copyright 2020 Pascâl Hartmann
31
-
32
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
33
-
34
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Black-Thunder <glwars@aol.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+ -------------------------------------------------------------------------------
25
+
26
+ LoPablo/SchellenbergApi (https://github.com/LoPablo/SchellenbergApi)
27
+
28
+ ISC License
29
+
30
+ Copyright 2020 Pascâl Hartmann
31
+
32
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,67 +1,71 @@
1
- ![Logo](admin/smartfriends.png)
2
-
3
- # ioBroker.smartfriends
4
-
5
- [![NPM version](http://img.shields.io/npm/v/iobroker.smartfriends.svg)](https://www.npmjs.com/package/iobroker.smartfriends)
6
- [![Downloads](https://img.shields.io/npm/dm/iobroker.smartfriends.svg)](https://www.npmjs.com/package/iobroker.smartfriends)
7
- ![Number of Installations (latest)](http://iobroker.live/badges/smartfriends-installed.svg)
8
- ![Number of Installations (stable)](http://iobroker.live/badges/smartfriends-stable.svg)
9
- [![Known Vulnerabilities](https://snyk.io/test/github/Black-Thunder/ioBroker.smartfriends/badge.svg)](https://snyk.io/test/github/Black-Thunder/ioBroker.smartfriends)
10
-
11
- [![NPM](https://nodei.co/npm/iobroker.smartfriends.png?downloads=true)](https://nodei.co/npm/iobroker.smartfriends/)
12
-
13
- [![Test and Release](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/test-and-release.yml) [![Reviewdog](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/code-quality.yml/badge.svg)](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/code-quality.yml)
14
-
15
- ## smartfriends adapter for ioBroker
16
-
17
- This adapter enables a direct **local integration** of the **SmartFriends Box** (e.g. Smart Friends Box by Schellenberg, ABUS, Paulmann, STEINEL, etc.) into ioBroker – **without using the official cloud**.
18
-
19
- The adapter establishes a direct connection to the gateway to control and query devices locally.
20
-
21
- ## Documentation:
22
-
23
- - [English description](https://github.com/Black-Thunder/ioBroker.smartfriends/tree/master/docs/en/smartfriends.md)
24
- - [Deutsche Beschreibung](https://github.com/Black-Thunder/ioBroker.smartfriends/tree/master/docs/de/smartfriends.md)
25
-
26
- ## Discussion:
27
-
28
- - [ioBroker Forum](https://forum.iobroker.net/topic/83202)
29
-
30
- ## Changelog
31
-
32
- <!--
33
- Placeholder for the next version (at the beginning of the line):
34
- ### __WORK IN PROGRESS__
35
- -->
36
-
37
- ### 1.0.0 (2025-12-18)
38
-
39
- - (Black-Thunder) initial release
40
-
41
- ## Acknowledgements
42
-
43
- Special thanks und credits to [LoPablo](https://github.com/LoPablo/SchellenbergApi) for reverse engineering the API!
44
-
45
- ## License
46
-
47
- MIT License
48
-
49
- Copyright (c) 2025 Black-Thunder <glwars@aol.de>
50
-
51
- Permission is hereby granted, free of charge, to any person obtaining a copy
52
- of this software and associated documentation files (the "Software"), to deal
53
- in the Software without restriction, including without limitation the rights
54
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
- copies of the Software, and to permit persons to whom the Software is
56
- furnished to do so, subject to the following conditions:
57
-
58
- The above copyright notice and this permission notice shall be included in all
59
- copies or substantial portions of the Software.
60
-
61
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
67
- SOFTWARE.
1
+ ![Logo](admin/smartfriends.png)
2
+
3
+ # ioBroker.smartfriends
4
+
5
+ [![NPM version](http://img.shields.io/npm/v/iobroker.smartfriends.svg)](https://www.npmjs.com/package/iobroker.smartfriends)
6
+ [![Downloads](https://img.shields.io/npm/dm/iobroker.smartfriends.svg)](https://www.npmjs.com/package/iobroker.smartfriends)
7
+ ![Number of Installations (latest)](http://iobroker.live/badges/smartfriends-installed.svg)
8
+ ![Number of Installations (stable)](http://iobroker.live/badges/smartfriends-stable.svg)
9
+ [![Known Vulnerabilities](https://snyk.io/test/github/Black-Thunder/ioBroker.smartfriends/badge.svg)](https://snyk.io/test/github/Black-Thunder/ioBroker.smartfriends)
10
+
11
+ [![NPM](https://nodei.co/npm/iobroker.smartfriends.png?downloads=true)](https://nodei.co/npm/iobroker.smartfriends/)
12
+
13
+ [![Test and Release](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/test-and-release.yml) [![Reviewdog](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/code-quality.yml/badge.svg)](https://github.com/Black-Thunder/ioBroker.smartfriends/actions/workflows/code-quality.yml)
14
+
15
+ ## smartfriends adapter for ioBroker
16
+
17
+ This adapter enables a direct **local integration** of the **SmartFriends Box** (e.g. Smart Friends Box by Schellenberg, ABUS, Paulmann, STEINEL, etc.) into ioBroker – **without using the official cloud**.
18
+
19
+ The adapter establishes a direct connection to the gateway to control and query devices locally.
20
+
21
+ ## Documentation:
22
+
23
+ - [English description](https://github.com/Black-Thunder/ioBroker.smartfriends/tree/master/docs/en/smartfriends.md)
24
+ - [Deutsche Beschreibung](https://github.com/Black-Thunder/ioBroker.smartfriends/tree/master/docs/de/smartfriends.md)
25
+
26
+ ## Discussion:
27
+
28
+ - [ioBroker Forum](https://forum.iobroker.net/topic/83202)
29
+
30
+ ## Changelog
31
+
32
+ <!--
33
+ Placeholder for the next version (at the beginning of the line):
34
+ ### __WORK IN PROGRESS__
35
+ -->
36
+ ### 1.0.1 (2025-12-20)
37
+
38
+ - (Black-Thunder) Increased robustness when communicating with the gateway
39
+ - (Black-Thunder) Added new option to ignore certificate errors
40
+
41
+ ### 1.0.0 (2025-12-18)
42
+
43
+ - (Black-Thunder) initial release
44
+
45
+ ## Acknowledgements
46
+
47
+ Special thanks und credits to [LoPablo](https://github.com/LoPablo/SchellenbergApi) for reverse engineering the API!
48
+
49
+ ## License
50
+
51
+ MIT License
52
+
53
+ Copyright (c) 2025 Black-Thunder <glwars@aol.de>
54
+
55
+ Permission is hereby granted, free of charge, to any person obtaining a copy
56
+ of this software and associated documentation files (the "Software"), to deal
57
+ in the Software without restriction, including without limitation the rights
58
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
59
+ copies of the Software, and to permit persons to whom the Software is
60
+ furnished to do so, subject to the following conditions:
61
+
62
+ The above copyright notice and this permission notice shall be included in all
63
+ copies or substantial portions of the Software.
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
67
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
68
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
69
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
70
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
71
+ SOFTWARE.
package/io-package.json CHANGED
@@ -1,92 +1,115 @@
1
1
  {
2
- "common": {
3
- "name": "smartfriends",
4
- "version": "1.0.0",
5
- "news": {
6
- "1.0.0": {
7
- "en": "initial release",
8
- "de": "Erstveröffentlichung",
9
- "ru": "Начальная версия",
10
- "pt": "lançamento inicial",
11
- "nl": "Eerste uitgave",
12
- "fr": "Première version",
13
- "it": "Versione iniziale",
14
- "es": "Versión inicial",
15
- "pl": "Pierwsze wydanie",
16
- "zh-cn": "首次出版",
17
- "uk": "початковий випуск"
18
- }
19
- },
20
- "titleLang": {
21
- "en": "SmartFriends",
22
- "de": "SmartFriends",
23
- "ru": "SmartFriends",
24
- "pt": "SmartFriends",
25
- "nl": "SmartFriends",
26
- "fr": "SmartFriends",
27
- "it": "SmartFriends",
28
- "es": "SmartFriends",
29
- "pl": "SmartFriends",
30
- "zh-cn": "SmartFriends",
31
- "uk": "SmartFriends"
32
- },
33
- "desc": {
34
- "en": "Local control of SmartFriends gateways and connected devices without cloud access.",
35
- "de": "Lokale Steuerung von SmartFriends-Gateways und angeschlossenen Geräten ohne Cloud-Anbindung.",
36
- "ru": "Локальное управление шлюзами SmartFriends и подключёнными устройствами без облака.",
37
- "pt": "Controle local de gateways SmartFriends e dispositivos conectados sem uso de nuvem.",
38
- "nl": "Lokale aansturing van SmartFriends-gateways en aangesloten apparaten zonder cloud.",
39
- "fr": "Contrôle local des passerelles SmartFriends et des appareils connectés sans cloud.",
40
- "it": "Controllo locale dei gateway SmartFriends e dei dispositivi collegati senza cloud.",
41
- "es": "Control local de gateways SmartFriends y dispositivos conectados sin nube.",
42
- "pl": "Lokalne sterowanie bramkami SmartFriends i podłączonymi urządzeniami bez chmury.",
43
- "zh-cn": "无需云服务即可本地控制 SmartFriends 网关及其连接的设备。",
44
- "uk": "Локальне керування шлюзами SmartFriends і підключеними пристроями без хмари."
45
- },
46
- "authors": ["Black-Thunder <glwars@aol.de>"],
47
- "keywords": ["home automation", "smartfriends", "schellenberg"],
48
- "licenseInformation": {
49
- "license": "MIT",
50
- "type": "free"
51
- },
52
- "platform": "Javascript/Node.js",
53
- "icon": "smartfriends.png",
54
- "enabled": false,
55
- "extIcon": "https://raw.githubusercontent.com/Black-Thunder/ioBroker.smartfriends/master/admin/smartfriends.png",
56
- "readme": "https://github.com/Black-Thunder/ioBroker.smartfriends/blob/master/README.md",
57
- "loglevel": "info",
58
- "mode": "daemon",
59
- "type": "iot-systems",
60
- "compact": true,
61
- "connectionType": "local",
62
- "dataSource": "poll",
63
- "adminUI": {
64
- "config": "json"
65
- },
66
- "dependencies": [
67
- {
68
- "js-controller": ">=6.0.11"
69
- }
70
- ],
71
- "globalDependencies": [
72
- {
73
- "admin": ">=7.6.17"
74
- }
75
- ],
76
- "tier": 2
77
- },
78
- "encryptedNative": ["smartFriendsPassword"],
79
- "protectedNative": ["smartFriendsPassword"],
80
- "native": {
81
- "smartFriendsPort": 4300,
82
- "smartFriendsIP": "",
83
- "smartFriendsUsername": "",
84
- "smartFriendsPassword": "",
85
- "smartFriendsCSymbol": "D19033i",
86
- "smartFriendsShcVersion": "3.7.4",
87
- "smartFriendsShApiVersion": "3.4",
88
- "ignoreSslErrors": false
89
- },
90
- "objects": [],
91
- "instanceObjects": []
2
+ "common": {
3
+ "name": "smartfriends",
4
+ "version": "1.0.1",
5
+ "news": {
6
+ "1.0.1": {
7
+ "en": "Increased robustness when communicating with the gateway\nAdded new option to ignore certificate errors",
8
+ "de": "Erhöhte Robustheit bei der Kommunikation mit dem Gateway\nNeue Option hinzugefügt, um Zertifikatsfehler zu ignorieren",
9
+ "ru": "Повышенная надежность при общении с шлюзом\nДобавлена новая возможность игнорировать ошибки сертификата",
10
+ "pt": "Maior robustez ao se comunicar com o gateway\nAdicionada nova opção para ignorar erros de certificado",
11
+ "nl": "Verhoogde robuustheid bij het communiceren met de gateway\nNieuwe optie toegevoegd om certificaatfouten te negeren",
12
+ "fr": "Une robustesse accrue lors de la communication avec la passerelle\nAjout d'une nouvelle option pour ignorer les erreurs de certificat",
13
+ "it": "Maggiore robustezza quando si comunica con il gateway\nAggiunta nuova opzione per ignorare gli errori del certificato",
14
+ "es": "Mayor robustez al comunicarse con la puerta de entrada\nNueva opción para ignorar errores de certificado",
15
+ "pl": "Większa odporność podczas komunikacji z bramą\nDodano nową opcję do ignorowania błędów certyfikatu",
16
+ "uk": "Підвищена надійність при спілкуванні з шлюзом\nДодано новий варіант ігнорувати помилки сертифіката",
17
+ "zh-cn": "与网关沟通时的强度提高\n添加新选项以忽略证书错误"
18
+ },
19
+ "1.0.0": {
20
+ "en": "initial release",
21
+ "de": "Erstveröffentlichung",
22
+ "ru": "Начальная версия",
23
+ "pt": "lançamento inicial",
24
+ "nl": "Eerste uitgave",
25
+ "fr": "Première version",
26
+ "it": "Versione iniziale",
27
+ "es": "Versión inicial",
28
+ "pl": "Pierwsze wydanie",
29
+ "zh-cn": "首次出版",
30
+ "uk": "початковий випуск"
31
+ }
32
+ },
33
+ "titleLang": {
34
+ "en": "SmartFriends",
35
+ "de": "SmartFriends",
36
+ "ru": "SmartFriends",
37
+ "pt": "SmartFriends",
38
+ "nl": "SmartFriends",
39
+ "fr": "SmartFriends",
40
+ "it": "SmartFriends",
41
+ "es": "SmartFriends",
42
+ "pl": "SmartFriends",
43
+ "zh-cn": "SmartFriends",
44
+ "uk": "SmartFriends"
45
+ },
46
+ "desc": {
47
+ "en": "Local control of SmartFriends gateways and connected devices without cloud access.",
48
+ "de": "Lokale Steuerung von SmartFriends-Gateways und angeschlossenen Geräten ohne Cloud-Anbindung.",
49
+ "ru": "Локальное управление шлюзами SmartFriends и подключёнными устройствами без облака.",
50
+ "pt": "Controle local de gateways SmartFriends e dispositivos conectados sem uso de nuvem.",
51
+ "nl": "Lokale aansturing van SmartFriends-gateways en aangesloten apparaten zonder cloud.",
52
+ "fr": "Contrôle local des passerelles SmartFriends et des appareils connectés sans cloud.",
53
+ "it": "Controllo locale dei gateway SmartFriends e dei dispositivi collegati senza cloud.",
54
+ "es": "Control local de gateways SmartFriends y dispositivos conectados sin nube.",
55
+ "pl": "Lokalne sterowanie bramkami SmartFriends i podłączonymi urządzeniami bez chmury.",
56
+ "zh-cn": "无需云服务即可本地控制 SmartFriends 网关及其连接的设备。",
57
+ "uk": "Локальне керування шлюзами SmartFriends і підключеними пристроями без хмари."
58
+ },
59
+ "authors": [
60
+ "Black-Thunder <glwars@aol.de>"
61
+ ],
62
+ "keywords": [
63
+ "home automation",
64
+ "smartfriends",
65
+ "schellenberg"
66
+ ],
67
+ "licenseInformation": {
68
+ "license": "MIT",
69
+ "type": "free"
70
+ },
71
+ "platform": "Javascript/Node.js",
72
+ "icon": "smartfriends.png",
73
+ "enabled": false,
74
+ "extIcon": "https://raw.githubusercontent.com/Black-Thunder/ioBroker.smartfriends/master/admin/smartfriends.png",
75
+ "readme": "https://github.com/Black-Thunder/ioBroker.smartfriends/blob/master/README.md",
76
+ "loglevel": "info",
77
+ "mode": "daemon",
78
+ "type": "iot-systems",
79
+ "compact": true,
80
+ "connectionType": "local",
81
+ "dataSource": "poll",
82
+ "adminUI": {
83
+ "config": "json"
84
+ },
85
+ "dependencies": [
86
+ {
87
+ "js-controller": ">=6.0.11"
88
+ }
89
+ ],
90
+ "globalDependencies": [
91
+ {
92
+ "admin": ">=7.6.17"
93
+ }
94
+ ],
95
+ "tier": 2
96
+ },
97
+ "encryptedNative": [
98
+ "smartFriendsPassword"
99
+ ],
100
+ "protectedNative": [
101
+ "smartFriendsPassword"
102
+ ],
103
+ "native": {
104
+ "smartFriendsPort": 4300,
105
+ "smartFriendsIP": "",
106
+ "smartFriendsUsername": "",
107
+ "smartFriendsPassword": "",
108
+ "smartFriendsCSymbol": "D19033i",
109
+ "smartFriendsShcVersion": "3.7.4",
110
+ "smartFriendsShApiVersion": "3.4",
111
+ "ignoreSslErrors": false
112
+ },
113
+ "objects": [],
114
+ "instanceObjects": []
92
115
  }
@@ -143,76 +143,96 @@ class SchellenbergBridge {
143
143
  }
144
144
 
145
145
  handleMessage(data) {
146
- if (data) {
147
- const parsedResponse = JSONResponse.default.fromJSONString(data);
146
+ if (!data) {
147
+ return;
148
+ }
148
149
 
149
- if (parsedResponse == null || parsedResponse.responseCode == null) {
150
- this.adapter.log.debug("Invalid message received. Skipping...");
151
- return;
152
- }
150
+ let parsedResponse;
153
151
 
154
- this.adapter.log.debug(
155
- `Message received: ${parsedResponse.responseMessage} (code: ${parsedResponse.responseCode})`,
152
+ try {
153
+ parsedResponse = JSONResponse.default.fromJSONString(data);
154
+ } catch (e) {
155
+ this.adapter.log.warn(`Invalid JSON message ignored: ${e.message}`);
156
+ return;
157
+ }
158
+
159
+ if (parsedResponse == null || parsedResponse.responseCode == null) {
160
+ this.adapter.log.debug("Invalid message received. Skipping...");
161
+ return;
162
+ }
163
+
164
+ this.adapter.log.debug(
165
+ `Message received: ${parsedResponse.responseMessage} (code: ${parsedResponse.responseCode})`,
166
+ );
167
+
168
+ if (parsedResponse.currentTimestamp) {
169
+ this.adapter.log.debug(`Updated timestamp to ${parsedResponse.currentTimestamp}`);
170
+ this.lastTimestamp = parsedResponse.currentTimestamp;
171
+ }
172
+
173
+ this.handleResponseCode(parsedResponse);
174
+ }
175
+
176
+ handleResponseCode(parsedResponse) {
177
+ // Map mit allen Response-Code-Handlern
178
+ const responseHandlers = {
179
+ [-1]: r => this.rejectNextPromise(r),
180
+ [1]: r => {
181
+ this.retryCounter = 0;
182
+ this.resolveNextPromise(r);
183
+ },
184
+ [2]: r => this.handleUpdate(r),
185
+ [5]: r => this.handleSpecificResponseCode(r, 5),
186
+ [84]: _r => this.reconnectWithWarn("TLS/SSL connection to the gateway has been closed."),
187
+ [91]: _r => this.reconnectWithWarn("Connection to the gateway timed out."),
188
+ [4]: _r => {}, // Ignored (newCConfig)
189
+ [7]: _r => {}, // Ignored (newLicense)
190
+ [8]: _r => {}, // Ignored as it's just an empty message after disconnect because of responseCode=5
191
+ [15]: _r => {}, // Ignored (showModuleInfo)
192
+ [16]: _r => {}, // Ignored ('Die Smart Friends Box kann sich mit dem RemoteHome Server nicht verbinden. Überprüfen Sie bitte, ob die Smart Friends Box mit dem Internet verbunden ist.')
193
+ [20]: _r => {}, // Ignored as it's just an empty message after successful login (message: 'loginFinished')
194
+ [87]: _r => {}, // Ignored as it's just an empty message after successful login (message: 'loginFinished')
195
+ [203]: _r => {}, // Ignored time-outs ('Connection timed out')
196
+ };
197
+
198
+ const handler = responseHandlers[parsedResponse.responseCode];
199
+ if (handler) {
200
+ handler(parsedResponse);
201
+ } else {
202
+ this.adapter.log.error(
203
+ `Unknown message response code: ${parsedResponse.responseCode} (message: '${parsedResponse.responseMessage}') - Please report this to the developer!`,
156
204
  );
205
+ }
206
+ }
157
207
 
158
- if (parsedResponse.currentTimestamp) {
159
- this.adapter.log.debug(`Updated timestamp to ${parsedResponse.currentTimestamp}`);
160
- this.lastTimestamp = parsedResponse.currentTimestamp;
161
- }
208
+ handleSpecificResponseCode(parsedResponse, codeNumber) {
209
+ switch (codeNumber) {
210
+ case 5: {
211
+ // Ignore warnings when licenses are expiring soon and update messages
212
+ const message = String(parsedResponse.responseMessage || "").toLowerCase();
213
+ const isInformationalPopup = message.includes("folgende lizenzen") || message.includes("update");
162
214
 
163
- switch (parsedResponse.responseCode) {
164
- case -1:
165
- this.rejectNextPromise(parsedResponse);
166
- break;
167
- case 1:
168
- this.retryCounter = 0;
169
- this.resolveNextPromise(parsedResponse);
170
- break;
171
- case 2:
172
- this.handleUpdate(parsedResponse);
173
- break;
174
- // Message boxes and disconnections because of multiple login attempts
175
- case 5:
176
- // Ignore warnings when licenses are expiring soon and update messages
177
- if (
178
- parsedResponse.responseMessage.toLowerCase().includes("folgende lizenzen") ||
179
- parsedResponse.responseMessage.toLowerCase().includes("update")
180
- ) {
181
- break;
182
- }
183
-
184
- // Disconnect because of login
185
- this.adapter.log.warn(
186
- "Connection was closed, because credentials were used to login on a different device or the official app.",
187
- );
188
- this.reconnect();
189
- break;
190
- case 84:
191
- this.adapter.log.warn("The TLS/SSL connection to the gateway has been closed.");
192
- this.reconnect();
193
- break;
194
- case 91:
195
- this.adapter.log.warn("Connection to the gateway timed out.");
196
- this.reconnect();
197
- break;
198
- case 4: // Ignore (newCConfig)
199
- case 7: // Ignore (newLicense)
200
- case 8: // Ignore as it's just an empty message after disconnect because of responseCode=5
201
- case 15: // Ignore (showModuleInfo)
202
- case 16: // Ignore ('Die Smart Friends Box kann sich mit dem RemoteHome Server nicht verbinden. Überprüfen Sie bitte, ob die Smart Friends Box mit dem Internet verbunden ist.')
203
- case 20: // Ignore as it's just an empty message after successful login (message: 'loginFinished')
204
- case 87: // Ignore as it's just an empty message after successful login (message: 'loginFinished')
205
- case 203: // Ignore time-outs ('Connection timed out')
206
- break;
207
- default:
208
- this.adapter.log.error(
209
- `Unknown message response code: ${parsedResponse.responseCode} (message: '${parsedResponse.responseMessage}') - Please report this to the developer!`,
210
- );
211
- break;
215
+ if (isInformationalPopup) {
216
+ return;
217
+ }
218
+
219
+ // Disconnect because of login
220
+ this.adapter.log.warn(
221
+ "Connection was closed, because credentials were used to login on a different device or the official app.",
222
+ );
223
+ this.reconnect();
224
+ break;
212
225
  }
226
+ default:
227
+ break;
213
228
  }
214
229
  }
215
230
 
231
+ reconnectWithWarn(message) {
232
+ this.adapter.log.warn(message);
233
+ this.reconnect();
234
+ }
235
+
216
236
  reconnect() {
217
237
  this.adapter.setAdapterConnectionState(false);
218
238
 
@@ -30,14 +30,11 @@ class JSONResponse {
30
30
  }
31
31
 
32
32
  // e.g.: { "currentTimestamp" : 20201210140021, "response" : { "remoteHomeActivated" : true, "remoteHomeStatus" : "notConnected" }, "responseCode" : 1, "responseMessage" : "success" }
33
- return new JSONResponse(
34
- JSONHelper.default.stringToDate(
35
- object.currentTimestamp ? object.currentTimestamp : object.response.currentTimestamp,
36
- ),
37
- object.response,
38
- object.responseCode,
39
- object.responseMessage,
40
- );
33
+ // also different formats possible, e.g.: { "programmingProcess" : { "context" : "system-update", "items" : [ { "button" : { "kind" : "OK_BUTTON", "requestID" : 12, "text" : "Ja" } }, { "button" : { "kind" : "CANCEL_BUTTON", "requestID" : -4, "text" : "Nein" } } ], "nextCommand" : "changeServerSettings", "target" : "ServerSettingsHandler", "text" : "Die verwendeten App erfordert eine neuere Version der Zentrale.\n\nBitte installieren sie umgehend das neueste Update\nSoll nach updates gesucht werden?", "title" : "${Note}" }, "responseCode" : 6 }
34
+ const timestampRaw = object?.currentTimestamp ?? object?.response?.currentTimestamp ?? null;
35
+ const timestamp = timestampRaw ? JSONHelper.default.stringToDate(timestampRaw) : null;
36
+
37
+ return new JSONResponse(timestamp, object.response, object.responseCode, object.responseMessage);
41
38
  }
42
39
  }
43
40
  exports.default = JSONResponse;
package/package.json CHANGED
@@ -1,71 +1,71 @@
1
- {
2
- "name": "iobroker.smartfriends",
3
- "version": "1.0.0",
4
- "description": "smartfriends",
5
- "author": {
6
- "name": "Black-Thunder",
7
- "email": "glwars@aol.de"
8
- },
9
- "homepage": "https://github.com/Black-Thunder/ioBroker.smartfriends",
10
- "license": "MIT",
11
- "keywords": [
12
- "ioBroker",
13
- "Smart Home",
14
- "home automation",
15
- "smartfriends",
16
- "schellenberg"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/Black-Thunder/ioBroker.smartfriends.git"
21
- },
22
- "engines": {
23
- "node": ">= 20"
24
- },
25
- "dependencies": {
26
- "@iobroker/adapter-core": "^3.3.2",
27
- "base-64": "^1.0.0"
28
- },
29
- "devDependencies": {
30
- "@alcalzone/release-script": "^5.0.0",
31
- "@alcalzone/release-script-plugin-iobroker": "^4.0.0",
32
- "@alcalzone/release-script-plugin-license": "^4.0.0",
33
- "@alcalzone/release-script-plugin-manual-review": "^4.0.0",
34
- "@iobroker/adapter-dev": "^1.5.0",
35
- "@iobroker/dev-server": "^0.8.0",
36
- "@iobroker/eslint-config": "^2.2.0",
37
- "@iobroker/testing": "^5.2.2",
38
- "@tsconfig/node20": "^20.1.8",
39
- "@types/gulp": "^4.0.18",
40
- "@types/node": "^25.0.2",
41
- "@types/proxyquire": "^1.3.31",
42
- "globals": "^16.5.0",
43
- "proxyquire": "^2.1.3"
44
- },
45
- "main": "main.js",
46
- "files": [
47
- "admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).{json,json5}",
48
- "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
49
- "lib/",
50
- "www/",
51
- "io-package.json",
52
- "LICENSE",
53
- "main.js"
54
- ],
55
- "scripts": {
56
- "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
57
- "test:package": "mocha test/package --exit",
58
- "test:integration": "mocha test/integration --exit",
59
- "test": "npm run test:js && npm run test:package",
60
- "check": "tsc --noEmit -p tsconfig.check.json",
61
- "lint": "eslint -c eslint.config.mjs .",
62
- "lint:fix": "eslint -c eslint.config.mjs . --fix",
63
- "translate": "translate-adapter",
64
- "release": "release-script",
65
- "dev-server": "dev-server"
66
- },
67
- "bugs": {
68
- "url": "https://github.com/Black-Thunder/ioBroker.smartfriends/issues"
69
- },
70
- "readmeFilename": "README.md"
71
- }
1
+ {
2
+ "name": "iobroker.smartfriends",
3
+ "version": "1.0.1",
4
+ "description": "smartfriends",
5
+ "author": {
6
+ "name": "Black-Thunder",
7
+ "email": "glwars@aol.de"
8
+ },
9
+ "homepage": "https://github.com/Black-Thunder/ioBroker.smartfriends",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "ioBroker",
13
+ "Smart Home",
14
+ "home automation",
15
+ "smartfriends",
16
+ "schellenberg"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Black-Thunder/ioBroker.smartfriends.git"
21
+ },
22
+ "engines": {
23
+ "node": ">= 20"
24
+ },
25
+ "dependencies": {
26
+ "@iobroker/adapter-core": "^3.3.2",
27
+ "base-64": "^1.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@alcalzone/release-script": "^5.0.0",
31
+ "@alcalzone/release-script-plugin-iobroker": "^4.0.0",
32
+ "@alcalzone/release-script-plugin-license": "^4.0.0",
33
+ "@alcalzone/release-script-plugin-manual-review": "^4.0.0",
34
+ "@iobroker/adapter-dev": "^1.5.0",
35
+ "@iobroker/dev-server": "^0.8.0",
36
+ "@iobroker/eslint-config": "^2.2.0",
37
+ "@iobroker/testing": "^5.2.2",
38
+ "@tsconfig/node20": "^20.1.8",
39
+ "@types/gulp": "^4.0.18",
40
+ "@types/node": "^25.0.2",
41
+ "@types/proxyquire": "^1.3.31",
42
+ "globals": "^16.5.0",
43
+ "proxyquire": "^2.1.3"
44
+ },
45
+ "main": "main.js",
46
+ "files": [
47
+ "admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).{json,json5}",
48
+ "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
49
+ "lib/",
50
+ "www/",
51
+ "io-package.json",
52
+ "LICENSE",
53
+ "main.js"
54
+ ],
55
+ "scripts": {
56
+ "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
57
+ "test:package": "mocha test/package --exit",
58
+ "test:integration": "mocha test/integration --exit",
59
+ "test": "npm run test:js && npm run test:package",
60
+ "check": "tsc --noEmit -p tsconfig.check.json",
61
+ "lint": "eslint -c eslint.config.mjs .",
62
+ "lint:fix": "eslint -c eslint.config.mjs . --fix",
63
+ "translate": "translate-adapter",
64
+ "release": "release-script",
65
+ "dev-server": "dev-server"
66
+ },
67
+ "bugs": {
68
+ "url": "https://github.com/Black-Thunder/ioBroker.smartfriends/issues"
69
+ },
70
+ "readmeFilename": "README.md"
71
+ }