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

BMS Watthours sensor #110

Closed
FozzieUK opened this issue Apr 3, 2023 · 5 comments
Closed

BMS Watthours sensor #110

FozzieUK opened this issue Apr 3, 2023 · 5 comments

Comments

@FozzieUK
Copy link
Contributor

FozzieUK commented Apr 3, 2023

Just out of interest i've been getting to the bottom of 'what' the watthours sensor actually is.

I created a watthrate sensor to track it and confirm its value, I had to remove the scale to bring it in line.

wh3

The only thing I wasn't sure of, was whether the counter was 16 or a 32 bit register - so tracked it for the last few, it eventually got to 65535 and rolled to 0 without any adjacent register incrementing, confirming it is 16 bit, and simply a counter used internally by the BMS as an energy meter to track all battery activity in watts.

So the only changes are the scale 0.1 is incorrect, and should be removed, and the unit of measurement is Wh (not kWh)

native_unit_of_measurement="kWh",
scale=0.1,

@canton7
Copy link
Collaborator

canton7 commented Apr 3, 2023

Nice work! So it's the integral of all (absolute) battery charge and discharge?

It's a shame that it wraps at 16 bits -- I wonder whether it's worth trying to unwrap that in HA...

Maybe we should /1000 and keep the unit as kWh, for consistency with other energy sensors?

@FozzieUK
Copy link
Contributor Author

FozzieUK commented Apr 3, 2023

@canton7 yes that's it exactly 👍

I was really hoping it was going to be an int32 😢 - but it's connected to the battery cycle counter, the BMS must do some internal maths on the capacity of batteries installed and increment the cycles so it's probably not worth re-creating a bigger number in HA as you could get there (roughly) by taking your (cycles * known capacity) + watthours.

Actually /1000 would make a lot of sense to keep in kWh (and help the HA database) 😄

@canton7
Copy link
Collaborator

canton7 commented Apr 5, 2023

To be honest, do we even want this sensor? Is it of any use to anyone?

@FozzieUK
Copy link
Contributor Author

FozzieUK commented Apr 5, 2023

Agree, I don't think there is a lot of value to it (it might have been if it were a really big number), but it can easily be recreated in HA if anyone wants a watt usage meter - I would be inclined to remove it.

FozzieUK added a commit to FozzieUK/foxess_modbus that referenced this issue Apr 20, 2023
Just following on from issue nathanmarlor#110 this corrects the scale and unit of measurement - a slightly wider decision required as to whether this sensor is needed at all, but at least with these changes it provides a sensor that matches it's name (watthours).
@canton7
Copy link
Collaborator

canton7 commented Apr 22, 2023

This is now in

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

No branches or pull requests

2 participants