zivillian / ora2mqtt

GWM ORA Funky Cat to MQTT Bridge
14 stars 2 forks source link

The JSON value could not be converted to System.Double. Path: $.data.latitude #23

Closed cram-89 closed 2 months ago

cram-89 commented 3 months ago

Login mit v0.0.4 funktioniert nun wieder. Aber leider kommt anschließend dieses Fehlermeldung, wenn ich das Programm starten möchte:

C:\Users\User\Downloads\ora2mqtt-win-x64_v0.0.4>ora2mqtt
System.Text.Json.JsonException: The JSON value could not be converted to System.Double. Path: $.data.latitude | LineNumber: 0 | BytePositionInLine: 1912.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.Utf8JsonReader.TryGetDouble(Double& value)
   at System.Text.Json.Utf8JsonReader.GetDouble()
   at System.Text.Json.Serialization.Converters.DoubleConverter.ReadNumberWithCustomHandling(Utf8JsonReader& reader, JsonNumberHandling handling, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.ReadAllAsync[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsyncCore[T](HttpContent content, Encoding sourceEncoding, JsonSerializerOptions options, CancellationToken cancellationToken)
   at libgwmapi.GwmApiClient.GetResponseAsync[T](HttpResponseMessage response, CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/libgwmapi/GwmApiClient.cs:line 118
   at libgwmapi.GwmApiClient.GetAppAsync[T](String url, CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/libgwmapi/GwmApiClient.cs:line 105
   at ora2mqtt.RunCommand.PublishStatusAsync(IMqttClient mqtt, GwmApiClient gwm, CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/RunCommand.cs:line 116
   at ora2mqtt.RunCommand.Run(CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/RunCommand.cs:line 42
   at Program.<Main>$(String[] args) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/Program.cs:line 23
zwoabier commented 3 months ago

Same for me running the latest v0.0.4 docker container

zivillian commented 2 months ago

OK, shit. Should be an easy fix.

zivillian commented 2 months ago

can you test again with the binaries from #24?

zwoabier commented 2 months ago

I'm getting this with the binaries. I tried to configure again and it was successful but run the application fails

System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at libgwmapi.GwmApiClient.GetAppAsync[T](String url, CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/libgwmapi/GwmApiClient.cs:line 104
   at ora2mqtt.RunCommand.PublishStatusAsync(IMqttClient mqtt, GwmApiClient gwm, CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/RunCommand.cs:line 113
   at ora2mqtt.RunCommand.Run(CancellationToken cancellationToken) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/RunCommand.cs:line 42
   at Program.<Main>$(String[] args) in /home/runner/work/ora2mqtt/ora2mqtt/ora2mqtt/Program.cs:line 23

Is this somehow related to the certificats? The issue we had at the beginning with linux?

zwoabier commented 2 months ago

Yes. I built the docker container from the pr and I validated that it is working now again with this fix

schneimi77 commented 2 months ago

Same for me, I have build the container with the modified files and it's working now.

Thank you!