dj-nitehawk / Hybrid-Inverter-Monitor

Monitoring application for hybrid inverters using the Voltronic communication protocol & JK BMS via USB port.
MIT License
81 stars 23 forks source link

BUG Input string was not in a correct format. #5

Closed Saentist closed 1 year ago

Saentist commented 1 year ago

Not idea what this error is browser show only this

image

./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 6549 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
dj-nitehawk commented 1 year ago

looks like it failed to parse the values returned by the inverter. to debug this, you would have to add the following line here and then build.

Console.WriteLine("result: "+responseFromInverter);

if it doesn't write something like the following to the console, then the inverter doesn't return the correct data to be parsed:

(232.0 50.1 232.0 50.1 0000 0000 000 476 27.02 000 100 0553 0000 000.0 27.00 00000 10011101 03 04 00000 101a\xc8\r
Saentist commented 1 year ago

I get this from MPQTT software with use same hidraw (not in same time) /in a moment sun is 90 degrees from panels front/

 DEBUG masterpower_api::codec > Encoding command QuerySerialNumber.
 TRACE masterpower_api::codec > Command payload (QuerySerialNumber): ().
 TRACE masterpower_api::codec > Encoded command (QuerySerialNumber): [81, 73, 68, 214, 234, 13]
 TRACE masterpower_api::inverter > Writing command to stream
 DEBUG masterpower_api::codec    > Decoding response QuerySerialNumber.
 TRACE masterpower_api::codec    > Decoding response (QuerySerialNumber): [40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, 81].
 ERROR mpqtt                     > ParseInt(ParseIntError { kind: InvalidDigit })
dj-nitehawk commented 1 year ago

so even MPQTT has a problem parsing what the inverter returns. best way to move forward is to update the source code like i mentioned and see what the inverter returns. and adjust the code accordingly.

does your inverter work with watchpower if watchpower works, then there's hope.

Saentist commented 1 year ago

after some power on panel

 DEBUG masterpower_api::codec > Encoding command QuerySerialNumber.
 TRACE masterpower_api::codec > Command payload (QuerySerialNumber): ().
 TRACE masterpower_api::codec > Encoded command (QuerySerialNumber): [81, 73, 68, 214, 234, 13]
 TRACE masterpower_api::inverter > Writing command to stream
 DEBUG masterpower_api::codec    > Decoding response QuerySerialNumber.
 TRACE masterpower_api::codec    > Decoding response (QuerySerialNumber): [40, 53, 53, 51, 53, 53, 53, 51, 53, 53, 53, 51, 53, 53, 53, 50, 253].
 TRACE masterpower_api::codec    > Decoded response (QuerySerialNumber): QIDResponse { serial_number: 55355535553555 }
 DEBUG masterpower_api::codec    > Encoding command QueryProtocolId.
 TRACE masterpower_api::codec    > Command payload (QueryProtocolId): ().
 TRACE masterpower_api::codec    > Encoded command (QueryProtocolId): [81, 80, 73, 190, 172, 13]
 TRACE masterpower_api::inverter > Writing command to stream
 TRACE masterpower_api::codec    > Invalid response format (QueryProtocolId): [0, 0, 0, 0, 0, 0, 40, 80, 73, 51, 48, 154, 11]
 TRACE masterpower_api::codec    > Attempting to recover from invalid response
 DEBUG masterpower_api::codec    > Decoding response QueryProtocolId.
 TRACE masterpower_api::codec    > Decoding response (QueryProtocolId): [40, 80, 73, 51, 48, 154, 11].
 TRACE masterpower_api::codec    > Decoded response (QueryProtocolId): QPIResponse { protocol_id: 30 }
 DEBUG masterpower_api::codec    > Encoding command QueryFirmwareVersion.
 TRACE masterpower_api::codec    > Command payload (QueryFirmwareVersion): ().
 TRACE masterpower_api::codec    > Encoded command (QueryFirmwareVersion): [81, 86, 70, 87, 98, 153, 13]
 TRACE masterpower_api::inverter > Writing command to stream
 DEBUG masterpower_api::codec    > Decoding response QueryFirmwareVersion.
 TRACE masterpower_api::codec    > Decoding response (QueryFirmwareVersion): [40, 86, 69, 82, 70, 87, 58, 48, 48, 48, 52, 49, 46, 49, 53, 220, 170].
 TRACE masterpower_api::codec    > Decoded response (QueryFirmwareVersion): QVFWResponse { major: 65, minor: 21 }
 DEBUG masterpower_api::codec    > Encoding command QueryFirmwareVersion2.
 TRACE masterpower_api::codec    > Command payload (QueryFirmwareVersion2): ().
 TRACE masterpower_api::codec    > Encoded command (QueryFirmwareVersion2): [81, 86, 70, 87, 50, 195, 245, 13]
 TRACE masterpower_api::inverter > Writing command to stream
 TRACE masterpower_api::codec    > Invalid response format (QueryFirmwareVersion2): [0, 0, 0, 0, 0, 0, 40, 78, 65, 75, 115, 115]
 TRACE masterpower_api::codec    > Attempting to recover from invalid response
 DEBUG masterpower_api::codec    > Decoding response QueryFirmwareVersion2.
 TRACE masterpower_api::codec    > Decoding response (QueryFirmwareVersion2): [40, 78, 65, 75, 115, 115].
 ERROR mpqtt                     > InvalidPayload(None)

but app still show red messages

root@ET1610PT:/opt/INV/INV-MON# ll
общо 57132
drwxr-xr-x 3 root root     4096 юли 19 13:45 ./
drwxr-xr-x 5 root root     4096 юли 19 13:41 ../
-rw-r--r-- 1 root root      201 юли 19 13:45 appsettings.json
-rw-r--r-- 1 root root      202 юли 17 20:42 hidrawmatch.sh
-rw-r--r-- 1 root root    57344 юли 19 10:52 InverterMon.db
-rw-r--r-- 1 root root 58420271 юли 19 11:12 InverterMon.Server
drwxr-xr-x 5 root root     4096 юли 19 11:12 wwwroot/
root@ET1610PT:/opt/INV/INV-MON# chmod +x InverterMon.Server
root@ET1610PT:/opt/INV/INV-MON# info: FastEndpoints.StartupTimer[0]
      Registered 5 endpoints in 3515 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HMJ9EHJRHN9U", Request id "0HMJ9EHJRHN9U:00000009": An unhandled exception was thrown by the application.
      System.OperationCanceledException: The operation was canceled.
         at System.Threading.CancellationToken.ThrowOperationCanceledException()
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream , TValue , JsonTypeInfo , CancellationToken )
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream , TValue , JsonTypeInfo , CancellationToken )
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream , TValue , JsonTypeInfo , CancellationToken )
         at FastEndpoints.Endpoint`2.ExecAsync(HttpContext ctx, EndpointDefinition endpoint, CancellationToken cancellation)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.

Interface is loading

image

https://github.com/jblance/mpp-solar/tree/master/docs/protocols

guess this is correct output https://github.com/manio/skymax-demo

./inverter_poller -1 -d
Tue Jul 19 14:12:54 2022 INVERTER: Debug set
Tue Jul 19 14:12:54 2022 INVERTER: Current CRC: 49 C1
Tue Jul 19 14:12:54 2022 INVERTER: QMOD reply size (5 bytes)
Tue Jul 19 14:12:54 2022 INVERTER: QMOD: 5 bytes read: (S
Tue Jul 19 14:12:54 2022 INVERTER: QMOD query finished
Tue Jul 19 14:12:54 2022 INVERTER: Current CRC: B7 A9
Tue Jul 19 14:12:54 2022 INVERTER: QPIGS reply size (110 bytes)
Tue Jul 19 14:12:54 2022 INVERTER: QPIGS: 110 bytes read: (000.0 00.0 000.0 00.0 0000 0000 000 249 00.10 000 000 0025 00.0 254.9 00.00 00000 00000000 00 00 00000 010
Tue Jul 19 14:12:54 2022 INVERTER: QPIGS query finished
Tue Jul 19 14:12:54 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:12:55 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:12:55 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:12:55 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:12:55 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:12:55 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:00 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:01 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:01 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:01 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:01 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:01 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:06 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:06 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:06 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:06 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:06 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:06 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:11 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:12 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:12 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:12 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:12 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:12 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:17 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:18 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:18 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:18 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:18 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:18 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:23 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:23 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:23 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:23 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:23 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:23 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:28 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:29 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:29 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:29 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:29 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:29 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:34 2022 INVERTER: Current CRC: F8 54
Tue Jul 19 14:13:35 2022 INVERTER: QPIRI reply size (97 bytes)
Tue Jul 19 14:13:35 2022 INVERTER: QPIRI: incorrect start/stop bytes.  Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Tue Jul 19 14:13:35 2022 INVERTER: Current CRC: B4 DA
Tue Jul 19 14:13:35 2022 INVERTER: QPIWS reply size (36 bytes)
Tue Jul 19 14:13:35 2022 INVERTER: QPIWS: incorrect start/stop bytes.  Buffer: (000001000000000001000010000000000100 48.0 46.0 42.0 56.4 54.0 3 10 010 0 1 3 1 01 0 0 54.0 0 1O; 00000 010
Saentist commented 1 year ago

Just for information, possible solution described here https://github.com/ned-kelly/docker-voltronic-homeassistant/issues/20

Saentist commented 1 year ago

How to see this string?

with QPIGS command i see image

but still this error

dj-nitehawk commented 1 year ago

try this debug build it will log the response from the inverter along with a stack trace. let's see what your answers.

Saentist commented 1 year ago

Change TAG from CLOSED to UNDER-INVESTIGATION ;)

Saentist commented 1 year ago

badly panels are in shade image

but response is

./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 3348 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
INVERTER RESPONSE: (000.0 00.0 000.0 00.0 0000 0000 000 000 00.00 000 000 0000 00.0 000.0 00.00 00000 00000000 00 00 00000 000??
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus , TypeCode )
   at System.Number.ParseDecimal(ReadOnlySpan`1 , NumberStyles , NumberFormatInfo )
   at System.Decimal.Parse(String s)
   at InverterMon.Server.InverterService.Commands.GetStatus.Parse(String responseFromInverter) in D:\SOURCE-CONTROL\InverterMon\src\Server\InverterService\Commands\GetStatus.cs:line 20
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.

strange this build stop to add new lines as regular version

there is some explanation about returns decoding https://github.com/prajna-pranab/converse/blob/master/index.html

dj-nitehawk commented 1 year ago

send the log when the values are not all zeros. and yes I'm stopping execution after one error. cause just 1 stack trace is all I need. but need some real power values to see what's really going on. do you not have grid power connected to the inverter? and also no batteries connected? only solar connected?

Saentist commented 1 year ago

Yes total offline ;) funny is that charger will blow battery I use with this 10A minimum, so I charge with external charger. But am in process of create garden solar array with 4.5KW and rearrange cabling to hybrid output from inverter, as should be

Saentist commented 1 year ago

So sun return and data come ;)

./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 3613 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
INVERTER RESPONSE: (000.0 00.0 000.0 00.0 0000 0000 000 237 00.10 000 000 0028 00.0 242.1 00.00 00000 00000000 00 00 00000 010?T
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus , TypeCode )
   at System.Number.ParseDecimal(ReadOnlySpan`1 , NumberStyles , NumberFormatInfo )
   at System.Decimal.Parse(String s)
   at InverterMon.Server.InverterService.Commands.GetStatus.Parse(String responseFromInverter) in D:\SOURCE-CONTROL\InverterMon\src\Server\InverterService\Commands\GetStatus.cs:line 20
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.

if this can make your live easyer

Command: QPIGS - General Status Parameters inquiry
------------------------------------------------------------
raw_response                    '(000.0 00.0 000.0 00.0 0000 0000 000 221 00.20 000 000 0029 00.0 225.4 00.00 00000 00000000 00 00 00000 010\x9b\x96\r'
Parameter                       Value           Unit
ac_input_voltage                0.0             V
ac_input_frequency              0.0             Hz
ac_output_voltage               0.0             V
ac_output_frequency             0.0             Hz
ac_output_apparent_power        0               VA
ac_output_active_power          0               W
ac_output_load                  0               %
bus_voltage                     221             V
battery_voltage                 0.2             V
battery_charging_current        0               A
battery_capacity                0               %
inverter_heat_sink_temperature  29              °C
pv_input_current_for_battery    0.0             A
pv_input_voltage                225.4           V
battery_voltage_from_scc        0.0             V
battery_discharge_current       0               A
is_sbu_priority_version_added   0               bool
is_configuration_changed        0               bool
is_scc_firmware_updated         0               bool
is_load_on                      0               bool
is_battery_voltage_to_steady_while_charging     0               bool
is_charging_on                  0               bool
is_scc_charging_on              0               bool
is_ac_charging_on               0               bool
rsv1                            0               A
rsv2                            0               A
pv_input_power                  0               W
is_charging_to_float            0               bool
is_switched_on                  1               bool
is_reserved                     0               bool

 ./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 3412 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
INVERTER RESPONSE: (000.0 00.0 229.8 50.0 0000 0000 000 390 00.00 000 000 0037 00.0 215.3 00.00 00000 00010000 00 00 00001 010%?
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus , TypeCode )
   at System.Number.ParseDecimal(ReadOnlySpan`1 , NumberStyles , NumberFormatInfo )
   at System.Decimal.Parse(String s)
   at InverterMon.Server.InverterService.Commands.GetStatus.Parse(String responseFromInverter) in D:\SOURCE-CONTROL\InverterMon\src\Server\InverterService\Commands\GetStatus.cs:line 20
fail: InverterMon.Server.InverterService.CommandExecutor[0]
      execution error: Input string was not in a correct format.
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...

-----------------

Command: QPIGS - General Status Parameters inquiry
------------------------------------------------------------
raw_response                    '(000.0 00.0 229.9 50.0 0000 0000 000 388 00.00 000 000 0037 00.0 220.0 00.00 00000 00010000 00 00 00000 010\x83G\r'

difference:

INVERTER RESPONSE: 
(000.0 00.0 229.8 50.0 0000 0000 000 390 00.00 000 000 0037 00.0 215.3 00.00 00000 00010000 00 00 00001 010%?
raw_response              
'(000.0 00.0 229.9 50.0 0000 0000 000 388 00.00 000 000 0037 00.0 220.0 00.00 00000 00010000 00 00 00000 010\x83G\r'

or in JSON

{
    "_command": "QPIGS",
    "_command_description": "General Status Parameters inquiry",
    "ac_input_voltage": 0.0,
    "ac_input_frequency": 0.0,
    "ac_output_voltage": 229.5,
    "ac_output_frequency": 49.9,
    "ac_output_apparent_power": 0,
    "ac_output_active_power": 0,
    "ac_output_load": 0,
    "bus_voltage": 388,
    "battery_voltage": 0.0,
    "battery_charging_current": 0,
    "battery_capacity": 0,
    "inverter_heat_sink_temperature": 38,
    "pv_input_current_for_battery": 0.0,
    "pv_input_voltage": 213.0,
    "battery_voltage_from_scc": 0.0,
    "battery_discharge_current": 0,
    "is_sbu_priority_version_added": 0,
    "is_configuration_changed": 0,
    "is_scc_firmware_updated": 0,
    "is_load_on": 1,
    "is_battery_voltage_to_steady_while_charging": 0,
    "is_charging_on": 0,
    "is_scc_charging_on": 0,
    "is_ac_charging_on": 0,
    "rsv1": 0,
    "rsv2": 0,
    "pv_input_power": 1,
    "is_charging_to_float": 0,
    "is_switched_on": 1,
    "is_reserved": 0
}
dj-nitehawk commented 1 year ago

can you give v1.4 a try? https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor/releases/tag/v1.4

i believe the parsing issue is caused by a system culture issue. so i've locked the culture of the app domain to en-US let's see if that does the trick.

Saentist commented 1 year ago

We have some success but new problem come image Menu missing /actually I found next BUG hour ago but not expect to have such effect/ http://xxx.xx/api/settings/get-charge-ampere-values ERROR 404 https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor/blob/760b1df9ab9eb01041bc663cced9beea3068d076/src/Server/InverterService/Commands/GetChargeAmpereValues.cs#L5 inverter do not respond on command QMCHGCR

Command: command help - List available commands for protocol PI30
------------------------------------------------------------
Parameter                       Value           Unit
F                               Set Device Output Frequency -- examples: F50 (set output frequency to 50Hz) or F60 (set output frequency to 60Hz)
MCHGC                           Set Max Charging Current (for parallel units) -- examples: MCHGC040 (set unit 0 to max charging current of 40A), MCHGC160 (set unit 1 to max charging current of 60A)
MNCHGC                          Set Utility Max Charging Current (more than 100A) (for 4000/5000) -- example: MNCHGC1120 (set unit 1 utility max charging current to 120A)
MUCHGC                          Set Utility Max Charging Current -- example: MUCHGC130 (set unit 1 utility max charging current to 30A)
PBCV                            Set Battery re-charge voltage -- example PBCV44.0 - set re-charge voltage to 44V (12V unit: 11V/11.3V/11.5V/11.8V/12V/12.3V/12.5V/12.8V, 24V unit: 22V/22.5V/23V/23.5V/24V/24.5V/25V/25.5V, 48V unit: 44V/45V/46V/47V/48V/49V/50V/51V)
PBDV                            Set Battery re-discharge voltage -- example PBDV48.0 - set re-discharge voltage to 48V (12V unit: 00.0V/12V/12.3V/12.5V/12.8V/13V/13.3V/13.5V/13.8V/14V/14.3V/14.5, 24V unit: 00.0V/24V/24.5V/25V/25.5V/26V/26.5V/27V/27.5V/28V/28.5V/29V, 48V unit: 00.0V/48V/49V/50V/51V/52V/53V/54V/55V/56V/57V/58V, 00.0V means battery is full(charging in float mode).)
PBFT                            Set Battery Float Charging Voltage -- example PBFT58.0 - set battery float charging voltage to 58V (48.0 - 58.4V for 48V unit)
PBT                             Set Battery Type -- examples: PBT00 (set battery as AGM), PBT01 (set battery as FLOODED), PBT02 (set battery as USER)
PCP                             Set Device Charger Priority -- examples: PCP00 (set utility first), PCP01 (set solar first), PCP02 (HS only: set solar and utility), PCP03 (set solar only charging)
PCVV                            Set Battery C.V. (constant voltage) charging voltage -- example PCVV48.0 - set charging voltage to 48V (48.0 - 58.4V for 48V unit)      
PE                              Set the enabled state of an Inverter setting -- examples: PEa - enable a (buzzer) [a=buzzer, b=overload bypass, j=power saving, K=LCD go to default after 1min, u=overload restart, v=overtemp restart, x=backlight, y=alarm on primary source interrupt, z=fault code record]
PD                              Set the disabled state of an Inverter setting -- examples: PDa - disable a (buzzer) [a=buzzer, b=overload bypass, j=power saving, K=LCD go to default after 1min, u=overload restart, v=overtemp restart, x=backlight, y=alarm on primary source interrupt, z=fault code record]
PF                              Set Control Parameters to Default Values -- example PF (reset control parameters to defaults)
PGR                             Set Grid Working Range -- examples: PCR00 (set device working range to appliance), PCR01 (set device working range to UPS)
POP                             Set Device Output Source Priority -- examples: POP00 (set utility first), POP01 (set solar first), POP02 (set SBU priority)
POPLG                           Set Device Operation Logic -- examples: POPLG00 (set Auto mode), POPLG01 (set Online mode), POPLG02 (set ECO mode)
POPM                            Set Device Output Mode (for 4000/5000) -- examples: POPM01 (set unit 0 to 1 - parallel output), POPM10 (set unit 1 to 0 - single machine output), POPM02 (set unit 0 to 2 - phase 1 of 3), POPM13 (set unit 1 to 3 - phase 2 of 3), POPM24 (set unit 2 to 4 - phase 3 of 3)
PPCP                            Set Parallel Device Charger Priority (for 4000/5000) -- examples: PPCP000 (set unit 1 to 00 - utility first), PPCP101 (set unit 1 to 01 - solar first), PPCP202 (set unit 2 to 02 - solar and utility), PPCP003 (set unit 0 to 03 - solar only charging)
PPVOKC                          Set PV OK Condition -- examples: PPVOKC0 (as long as one unit has connected PV, parallel system will consider PV OK), PPVOKC1 (only if all inverters have connected PV, parallel system will consider PV OK)
PSDV                            Set Battery Cut-off Voltage -- example PSDV40.0 - set battery cut-off voltage to 40V (40.0 - 48.0V for 48V unit)
PSPB                            Set Solar Power Balance -- examples: PSPB0 (PV input max current will be the max charged current), PSPB1 (PV input max power will be the sum of the max charge power and loads power)
PBATCD                          Battery charge/discharge controlling command -- examples: PBATCDxxx (please read description, use carefully)
DAT                             Set Date Time -- examples: DATYYYYMMDDHHMMSS (14 digits after DAT)
PBATMAXDISC                     Battery max discharge current -- examples: PBATMAXDISCxxx (000- disable or 030-150A)
Q1                              Q1 query
QBOOT                           DSP Has Bootstrap inquiry
QDI                             Default Settings inquiry -- queries the default settings from the Inverter
QFLAG                           Flag Status inquiry -- queries the enabled / disabled state of various Inverter settings (e.g. buzzer, overload, interrupt alarm)       
QID                             Device Serial Number inquiry -- queries the device serial number
QMCHGCR                         Max Charging Current Options inquiry -- queries the maximum charging current setting of the Inverter
QMOD                            Mode inquiry -- queries the Inverter mode
QMUCHGCR                        Max Utility Charging Current Options inquiry -- queries the maximum utility charging current setting of the Inverter
QOPM                            Output Mode inquiry -- queries the output mode of the Inverter (e.g. single, parallel, phase 1 of 3 etc)
QPGS                            Parallel Information inquiry -- example: QPGS1 queries the values of various metrics from instance 1 of parallel setup Inverters (numbers from 0)
QPI                             Protocol ID inquiry -- queries the device protocol ID. e.g. PI30 for HS series
QPIGS                           General Status Parameters inquiry -- queries the value of various metrics from the Inverter
QPIRI                           Current Settings inquiry -- queries the current settings from the Inverter
QPIWS                           Warning status inquiry -- queries any active warnings flags from the Inverter
QVFW                            Main CPU firmware version inquiry -- queries the main CPU firmware version
QVFW2                           Secondary CPU firmware version inquiry -- queries the secondary CPU firmware version

so solution can be

Command: QMUCHGCR - Max Utility Charging Current Options inquiry
------------------------------------------------------------
Parameter                       Value           Unit
max_utility_charging_current    002             A
unknown_value_in_response_1     010
unknown_value_in_response_2     020
unknown_value_in_response_3     030
unknown_value_in_response_4     040
unknown_value_in_response_5     050
unknown_value_in_response_6     060

OR

Command: QPIRI - Current Settings inquiry
------------------------------------------------------------
Parameter                       Value           Unit
ac_input_voltage                230.0           V
ac_input_current                21.7            A
ac_output_voltage               230.0           V
ac_output_frequency             50.0            Hz
ac_output_current               21.7            A
ac_output_apparent_power        5000            VA
ac_output_active_power          5000            W
battery_voltage                 48.0            V
battery_recharge_voltage        46.0            V
battery_under_voltage           42.0            V
battery_bulk_charge_voltage     56.4            V
battery_float_charge_voltage    54.0            V
battery_type                    TBD
max_ac_charging_current         10              A
max_charging_current            20              A
input_voltage_range             Appliance
output_source_priority          Solar first
charger_source_priority         Only solar charging permitted
max_parallel_units              1               units
machine_type                    Off Grid
topology                        transformerless
output_mode                     single machine output
battery_redischarge_voltage     54.0            V
pv_ok_condition                 As long as one unit of inverters has connect PV, parallel system will consider PV OK
pv_power_balance                PV input max power will be the sum of the max charged power and loads power
dj-nitehawk commented 1 year ago

for missing top menu, just do a CTRL+F5 page refresh.

Saentist commented 1 year ago

clearing cache helped but Settings still not opens

./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 3399 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HMJDDUK1GG9H", Request id "0HMJDDUK1GG9H:00000002": An unhandled exception was thrown by the application.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
         at InverterMon.Server.InverterService.Commands.Command`1.WhileProcessing(CancellationToken c)
         at InverterMon.Server.Endpoints.Settings.GetChargeAmpereValues.Endpoint.HandleAsync(CancellationToken c)
         at FastEndpoints.Endpoint`2.ExecAsync(HttpContext ctx, EndpointDefinition endpoint, CancellationToken cancellation)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HMJDDUK1GG9K", Request id "0HMJDDUK1GG9K:00000015": An unhandled exception was thrown by the application.
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
         at InverterMon.Server.InverterService.Commands.Command`1.WhileProcessing(CancellationToken c)
         at InverterMon.Server.Endpoints.Settings.GetSettingValues.Endpoint.HandleAsync(CancellationToken c)
         at FastEndpoints.Endpoint`2.ExecAsync(HttpContext ctx, EndpointDefinition endpoint, CancellationToken cancellation)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
dj-nitehawk commented 1 year ago

does it take more than 5 seconds in inverter_poller to retrieve the result of QMUCHGCR? also does QMCHGCR work with inverter_poller?

dj-nitehawk commented 1 year ago

let's see the log from this debug build: https://filedn.com/lnBhfXoAIklXFOaQ7BSCnmp/debug-linux-x64.7z

Saentist commented 1 year ago

result of QMCHGCR

{"error": "NAK"}
Parameter                       Value           Unit
error                           NAK
./InverterMon.Server
info: FastEndpoints.StartupTimer[0]
      Registered 6 endpoints in 3556 milliseconds.
info: InverterMon.Server.InverterService.CommandExecutor[0]
      inverter connected!
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://0.0.0.0:82
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /opt/INV/INV-MON/
QMCHGCR: (NAKs
QMUCHGCR: (NAKs
QMCHGCR: (NAKs
dj-nitehawk commented 1 year ago

so your inverter doesn't accept QMCHGCR/QMUCHGCR commands. no idea what to do about that :-( can you send QMCHGCR/QMUCHGCR with any other applications? they all get a "NAK" from the inverter right?

Saentist commented 1 year ago
Command: QMUCHGCR - Max Utility Charging Current Options inquiry
------------------------------------------------------------
Parameter                       Value           Unit
max_utility_charging_current    002             A
unknown_value_in_response_1     010
unknown_value_in_response_2     020
unknown_value_in_response_3     030
unknown_value_in_response_4     040
unknown_value_in_response_5     050
unknown_value_in_response_6     060

QMCHGCR
Parameter                       Value           Unit
error                           NAK
dj-nitehawk commented 1 year ago

so QMCHGCR command doesn't work on your inverter.

try this build: https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor/releases/tag/v1.4.1

it should hopefully not crap out when the inverter doesn't respond successfully.

Saentist commented 1 year ago

Settings show Loading... and nothing more no error in console

dj-nitehawk commented 1 year ago

in that case there's not much more I can do from here. you will have to debug the source code yourself with your inverter.

if you find a fix, do send in a PR.

good luck!

Saentist commented 1 year ago

Badly I'm not programming. I can collect information and make suggestions

good suggestion in this case is to be able to run app with some options as

--report with will create report text file with all commands https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor/issues/5#issuecomment-1193306878

Add tags to this project, that will help more people to find it, hope some one will have skills to help with code.

Saentist commented 1 year ago

by the way when reading API commands QMCHGCR can be replaces by

Command: QMUCHGCR - Max Utility Charging Current Options inquiry
------------------------------------------------------------
Parameter                       Value           Unit
max_utility_charging_current    002             A
unknown_value_in_response_1     010
unknown_value_in_response_2     020
unknown_value_in_response_3     030
unknown_value_in_response_4     040
unknown_value_in_response_5     050
unknown_value_in_response_6     060

because QMCHGCR its not supported in USB mode only in RS232

other interesting QUERY commands QMN (some product identification) QSID (advanced version of QID) QBEQI (battery charging parameters) QET: Query total PV generated energy QEYyyyy: Query PV generated energy of year QEMyyyymm: Query PV generated energy of month QEDyyyymmdd: Query PV generated energy of day QLT: Query total output load energy QLYyyyy: Query output load energy of year QLMyyyymm: Query output load energy of monthQLMyyyymm: Query output load energy of month QLDyyyymmdd: Query output load energy of dayQLDyyyymmdd: Query output load energy of day

this video explain lot more https://www.youtube.com/watch?v=dlhsc_KjIM4&list=PLDW1zKN_tjaJDp-Ukz8KApchBgA60AFC_

dj-nitehawk commented 1 year ago

try https://github.com/dj-nitehawk/Hybrid-Inverter-Monitor/releases/tag/v1.4.2 last one ;-)

Saentist commented 1 year ago

simple way to debug calling string

cat /dev/hidraw2

(000.0 00.0 000.0 00.0 0000 0000 000 223 00.10 000 000 0036 00.0 228.2 00.00 00000 00000000 00 00 00000 010kX
(NAKss 00.0 000.0 00.0 0000 0000 000 223 00.10 000 000 0036 00.0 228.2 00.00 00000 00000000 00 00 00000 010kX
(NAKss
(PI30▒5355535552▒ 00.0 0000 0000 000 221 00.20 000 000 0035 00.0 225.0 00.00 00000 00000000 00 00 00000 010E▒

interesting ;)

but what happens if used this config


{
  "LaunchSettings": {
    "DeviceAddress": "/dev/ttyUSB1",
    "WebPort": 82
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  }
}

PV

So it work in com port without a problem.

now I see in settings place for new tab called Invertor info QMN, QBEQI, QPIRI, QVFW, QVFW2, QVFW3, QVFW4, QDI

Command: QMN - No description found
------------------------------------------------------------
Parameter                       Value           Unit
warning                         No definition for command QMN in protocol b'PI30'
 esponse                        (VMIII-5000¨'  <<<<Inverter Type

Command: QBEQI - No description found
------------------------------------------------------------
Parameter                       Value           Unit
warning                         No definition for command QBEQI in protocol b'PI30'
response                        (0 060 030 010 030 58.40 000 120 0 0000HÞ

Command: QPIRI - Current Settings inquiry
------------------------------------------------------------
Parameter                       Value           Unit
ac_input_voltage                230.0           V
ac_input_current                21.7            A
ac_output_voltage               230.0           V
ac_output_frequency             50.0            Hz
ac_output_current               21.7            A
ac_output_apparent_power        5000            VA
ac_output_active_power          5000            W
battery_voltage                 48.0            V
battery_recharge_voltage        46.0            V
battery_under_voltage           42.0            V
battery_bulk_charge_voltage     56.4            V
battery_float_charge_voltage    54.0            V
battery_type                    TBD
max_ac_charging_current         10              A
max_charging_current            10              A
input_voltage_range             Appliance
output_source_priority          Solar first
charger_source_priority         Only solar charging permitted
max_parallel_units              1               units
machine_type                    Off Grid
topology                        transformerless
output_mode                     single machine output
battery_redischarge_voltage     54.0            V
pv_ok_condition                 As long as one unit of inverters has connect PV, parallel system will consider PV OK
pv_power_balance                PV input max power will be the sum of the max charged power and loads power

Command: QFLAG - Flag Status inquiry
------------------------------------------------------------
Parameter                       Value           Unit
overload_restart                enabled
over_temperature_restart        enabled
lcd_backlight                   enabled
primary_source_interrupt_alarm  enabled
record_fault_code               enabled
buzzer                          disabled
overload_bypass                 disabled
power_saving                    disabled
lcd_reset_to_default            disabled

Command: QVFW - Main CPU firmware version inquiry
------------------------------------------------------------
Parameter                       Value           Unit
main_cpu_firmware_version       VERFW:00041.15

QVFW2
Parameter                       Value           Unit
error                           NAK

Command: QVFW3 - No description found
------------------------------------------------------------
Parameter                       Value           Unit
warning                         No definition for command QVFW3 in protocol b'PI30'
response                        (VERFW:00002.40a

QVFW4
Parameter                       Value           Unit
error                           NAK

Command: QDI - Default Settings inquiry
------------------------------------------------------------
Parameter                       Value           Unit
ac_output_voltage               230.0           V
ac_output_frequency             50.0            Hz
max_ac_charging_current         30              A
battery_under_voltage           42.0            V
battery_float_charge_voltage    54.0            V
battery_bulk_charge_voltage     56.4            V
battery_recharge_voltage        46.0            V
max_charging_current            60              A
input_voltage_range             Appliance
output_source_priority          Utility first
charger_source_priority         Solar + Utility
battery_type                    AGM
buzzer                          enabled
power_saving                    disabled
overload_restart                disabled
over_temperature_restart        disabled
lcd_backlight                   enabled
primary_source_interrupt_alarm  enabled
record_fault_code               enabled
overload_bypass                 disabled
lcd_reset_to_default            enabled
output_mode                     single machine output
battery_redischarge_voltage     54.0            V
pv_ok_condition                 As long as one unit of inverters has connect PV, parallel system will consider PV OK
pv_power_balance                PV input max power will be the sum of the max charged power and loads power

Command: QBEQI - Equalisation status
------------------------------------------------------------
Parameter                       Value           Unit
warning                         No definition for command QBEQI in protocol b'PI30'
response                        (0 060 030 010 030 58.40 000 120 0 0000HÞ

I can create Feature Request for this if needed.