johanmeijer / grott

Growatt inverter monitor

Home Page:https://github.com/johanmeijer/grott/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative temperatures return 65.535-ish

osos opened this issue · comments

commented

I know it is not good, but it seems the temperature for my battery is below zero these days.

The temperature seem however to be treated as an unsigned integer, thus, resulting in temperature read-outs of 65.535-65.533 . Tempertures should simply be signed int16. if treated as signed int32 it will still fail

commented

I suggest
import numpy as np
and the change of this line:

definedkey[keyword] = int(result_string[conf.recorddict[layout][keyword]["value"]:conf.recorddict[layout][keyword]["value"]+(conf.recorddict[layout][keyword]["length"]*2)],16)

to:

int_value = int(
                            result_string[
                                conf.recorddict[layout][keyword][
                                    "value"
                                ] : conf.recorddict[layout][keyword]["value"]
                                + (conf.recorddict[layout][keyword]["length"] * 2)
                            ],
                            16,
                        )
                        if conf.recorddict[layout][keyword]["length"] < 4:
                            definedkey[keyword] = int(np.int16(int_value))
                        else:
                            definedkey[keyword] = int(np.int32(int_value))

this should handle both the 16 and 32 bit values with correct sign

Do you have a growatt original record from the grott log for me so I can test it?

commented

I realised that I just need to the type of battemp, and other temperatures to 'numx' instead of 'num'.

Running for a few days now with the numx setting and seem to convert correctly.

Thus, I suggest the temperatures are by default set to numx types.

This layout was tested: examples/Record Layout/t06NNNNXSPH.json

Thanks for the solution. That is what I want to try also. I will update this in a next release.

I would like to add to this issue some other examples of values with problems:

I have an offgrid inverter that is using the layout T060104SPF

I've seen the values for

  • batterySoc go to 65535. Wich according to the documentation it should go from 1 to 100.
  • epvtoday go to 4294967295
  • bat_Volt go to 65535

My understanding is the inverter is simply sending -1 (maybe due some internal failure, not sure) and the number is converted to the highest value allowed 65535 (2^16) and 4294967295 (2^32).

Screenshot_2023-12-14_15-12-46

I'm not really sure what is the best path of action here... IMO the value shouldn't be included in the response so home assistant would render it as undefined...

Thanks for this amazing project btw!

@mariano-dagostino Do you have th eoriginal data from the inverter/datalogger when this happens? I can then test with it (and change it).

Do you have th eoriginal data from the inverter/datalogger when this happens? I can then test with it (and change it).

@johanmeijer Actually I haven't seen this behavior in a week so far. I think this was caused because I didn't configured the inverter type to be ginvtype=spf when I started playing with grott.

I have a similar issue with GROTT 2.8.3 with my inverter MOD 5kTL3-XH
Just at the end of the day, I think when the grot shutdown,
I get a 429.496.729,5 ( 2ˆ32 -1 ) Watt value for the sensor._output_power ( pvpowerout )

I configured my Inverter like as a MIN.
It looks like at the time of shutdown the inverter sends a -1 value ( FFFF FFFF ).

I see in the grottconf.py for the T06NNNNXMIN" it is a "num" ( unsigned integer ) for the others it is a numx ( signed integer )

I do not think that it hurts to configure this a numx field.

I am building a new version of Grott. I will review and try to test if the num fields can be changed to numx (supporting negative values). I am not sure if I can change al fields.

@johanmeijer,

I created a PR for the issue with the negative pvpowerout,
#527