Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative temperatures return 65.535-ish #491

Open
osos opened this issue Nov 30, 2023 · 10 comments
Open

Negative temperatures return 65.535-ish #491

osos opened this issue Nov 30, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@osos
Copy link

osos commented Nov 30, 2023

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

@osos
Copy link
Author

osos commented Nov 30, 2023

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

@johanmeijer
Copy link
Owner

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

@johanmeijer johanmeijer added the Under Investigation We are looking at it label Dec 4, 2023
@osos
Copy link
Author

osos commented Dec 9, 2023

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

@johanmeijer
Copy link
Owner

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

@johanmeijer johanmeijer added enhancement New feature or request and removed Under Investigation We are looking at it labels Dec 11, 2023
@mariano-dagostino
Copy link

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!

@johanmeijer
Copy link
Owner

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

@mariano-dagostino
Copy link

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.

@joris-weijters
Copy link

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 )

@johanmeijer
Copy link
Owner

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.

@joris-weijters
Copy link

@johanmeijer,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants