Skip to content

Commit

Permalink
Errorhandling bei Socketfehler
Browse files Browse the repository at this point in the history
  • Loading branch information
eifel-tech committed Oct 16, 2024
1 parent c7703d8 commit 27cd9fd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ Hier können allgemeine Einstellungen des Geräts vorgenommen werden. Beispielsw
- Weitere Geräte hinzufügen, die über <ins>keinen</ins> freigeschalteten Port 443 verfügen.
- Favoriten in Settings einstellen können

### 1.2.1

- (eifel-tech) Abbrechen der Verbindung, wenn bei der Socketverbindung zum Gerät Fehler auftreten

### 1.2.0

- (eifel-tech) Möglichkeit, einzelne Geräte von der Steuerung auszuschließen.
> [!CAUTION]
> Die Konfiguration musste dafür erweitert werden, weswegen der Inhalt des Datenpunkts `info.config` gelöscht und der Adapter neu gestartet werden muss. Ebenfalls den Objektbaum `General` löschen.
> [!CAUTION]
> Die Konfiguration musste dafür erweitert werden, weswegen der Inhalt des Datenpunkts `info.config` gelöscht und der Adapter neu gestartet werden muss. Ebenfalls den Objektbaum `General` löschen.
### 1.1.2

Expand Down
15 changes: 14 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
{
"common": {
"name": "cloudless-homeconnect",
"version": "1.2.0",
"version": "1.2.1",
"news": {
"1.2.1": {
"en": "Errorhandling at socket connection",
"de": "Fehlerbehandlung bei Socketverbindung",
"ru": "Ошибка при подключении к сокету",
"pt": "Erro na conexão de soquete",
"nl": "Fout bij het verwerken van socketaansluiting",
"fr": "Gestion des erreurs à la connexion de socket",
"it": "Gestione degli errori alla connessione dell'orbita",
"es": "Manipulación de errores en la conexión de toma",
"pl": "Obróbka błędów przy podłączeniu gniazda",
"uk": "Помилка для підключення розетки",
"zh-cn": "套接字连接时处理错误"
},
"1.2.0": {
"en": "Ability to observe only individual devices",
"de": "Möglichkeit, nur einzelne Geräte zu beobachten",
Expand Down
8 changes: 5 additions & 3 deletions js/Socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ class Socket {
let options = {
origin: "",
timeout: socketTimeout * 1000,
keepAlive: true,
};
let protocol = "ws";
if (!this.isHttp) {
const _this = this;
options = {
origin: "",
timeout: socketTimeout * 1000,
keepAlive: true,
ciphers: "ECDHE-PSK-CHACHA20-POLY1305",
minVersion: "TLSv1.2",
pskCallback: function () {
Expand All @@ -84,6 +82,9 @@ class Socket {

ws.on("error", (e) => {
this.connectionEstablished = false;
this.ws.removeAllListeners();
this.ws.terminate();

this._this.log.error("Connection error for device " + this.deviceID + ": " + e);
});
ws.on("open", () => {
Expand Down Expand Up @@ -120,7 +121,8 @@ class Socket {

this.pingTimeout = setTimeout(
() => {
this.ws.close();
this.ws.terminate();
this.connectionEstablished = false;
},
socketTimeout * 4 * 1000,
);
Expand Down
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,9 @@ class CloudlessHomeconnect extends utils.Adapter {
if (device.refreshInterval) {
clearInterval(device.refreshInterval);
}
device.ws.close();
if (device.ws.isConnected()) {
device.ws.close();
}

if (this.devMap.has(devId)) {
this.devMap.delete(devId);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.cloudless-homeconnect",
"version": "1.2.0",
"version": "1.2.1",
"description": "Adapter für Homeconnect-Geräte ohne Cloud-Kommunikation",
"author": {
"name": "eifel-tech",
Expand Down

0 comments on commit 27cd9fd

Please sign in to comment.