cyrils / renogy-bt

Python library to read Renogy compatible BT-1 or BT-2 bluetooth modules using Raspberry Pi.
GNU General Public License v3.0
76 stars 27 forks source link

Temperature showing up as hotter than surface of the sun. #60

Closed Anglac closed 4 months ago

Anglac commented 4 months ago

My battery temperatures have been reporting at 11,000+ degrees f, given the lack of fires I believe this to be false.

I think the issue is that the battery temperature returns a signed int, and it's being handled as if it's unsigned.

switching line 37 of BatteryClient.py to

        celcius = bytes_to_int(bs, 5 + i*2, 2, scale = 0.1, signed=True)

seems to have it reporting more reasonable temperatures.

cyrils commented 4 months ago

@Anglac What are the values you see when adding signed flag?

Anglac commented 4 months ago

Started getting below freezing (sub 32f or 0c) temperatures after adding the signed flag. (below freezing is expected values in my area in the winter time)

Before the change was getting things like 11826.68f or 6552.6c (which was suspiciously close to 65,535 limit for unsigned 16 bit int when scaled by 0.1).

cyrils commented 4 months ago

Fixed in master