From 91a5a770158a81ebd935187fe70b2a5905cd5dc1 Mon Sep 17 00:00:00 2001 From: aimoehi <48529175+aimoehi@users.noreply.github.com> Date: Sat, 27 Apr 2024 00:13:54 +0200 Subject: [PATCH 1/2] Fix 'ER-State error my ISM7 (very old v1.60 Firmware) sometimes answers with ER-State and this throw this exception and cancels - with this fix it runs smoothly --- src/ism7mqtt/ISM7/Ism7Client.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ism7mqtt/ISM7/Ism7Client.cs b/src/ism7mqtt/ISM7/Ism7Client.cs index 4963173..8be8058 100644 --- a/src/ism7mqtt/ISM7/Ism7Client.cs +++ b/src/ism7mqtt/ISM7/Ism7Client.cs @@ -262,13 +262,15 @@ private async Task OnPushResponseAsync(IResponse response, CancellationToken can var resp = (TelegramBundleResp) response; if (!String.IsNullOrEmpty(resp.Errormsg)) throw new InvalidDataException(resp.Errormsg); - if (resp.State != TelegrResponseState.OK) - throw new InvalidDataException($"unexpected state '{resp.State}"); - - var hasDatapoints = _config.ProcessData(resp.Telegrams.Where(x => x.State == TelegrResponseState.OK)); - if (hasDatapoints) + //if (resp.State != TelegrResponseState.OK) + // throw new InvalidDataException($"unexpected state '{resp.State}"); + if(resp.State == TelegrResponseState.OK) { - await _messageHandler(_config, cancellationToken); + var hasDatapoints = _config.ProcessData(resp.Telegrams.Where(x => x.State == TelegrResponseState.OK)); + if (hasDatapoints) + { + await _messageHandler(_config, cancellationToken); + } } } @@ -404,4 +406,4 @@ private XmlSerializer GetSerializer() return _serializers.GetOrAdd(typeof(T), x => new XmlSerializer(x)); } } -} \ No newline at end of file +} From 5889823f400e37cd56cb6f7ae3b11a3f20ccd538 Mon Sep 17 00:00:00 2001 From: zivillian Date: Sat, 24 Aug 2024 13:29:00 +0200 Subject: [PATCH 2/2] log ER state --- src/ism7mqtt/ISM7/Ism7Client.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ism7mqtt/ISM7/Ism7Client.cs b/src/ism7mqtt/ISM7/Ism7Client.cs index 8be8058..b9b03d7 100644 --- a/src/ism7mqtt/ISM7/Ism7Client.cs +++ b/src/ism7mqtt/ISM7/Ism7Client.cs @@ -262,9 +262,11 @@ private async Task OnPushResponseAsync(IResponse response, CancellationToken can var resp = (TelegramBundleResp) response; if (!String.IsNullOrEmpty(resp.Errormsg)) throw new InvalidDataException(resp.Errormsg); - //if (resp.State != TelegrResponseState.OK) - // throw new InvalidDataException($"unexpected state '{resp.State}"); - if(resp.State == TelegrResponseState.OK) + if (resp.State != TelegrResponseState.OK) + { + await Console.Error.WriteLineAsync($"unexpected state '{resp.State}"); + } + else { var hasDatapoints = _config.ProcessData(resp.Telegrams.Where(x => x.State == TelegrResponseState.OK)); if (hasDatapoints)