hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
106 stars 13 forks source link

Update sensor.py #34

Closed geertsmichael closed 1 year ago

geertsmichael commented 1 year ago

I am a big fan of this project, and using this to compare my installation without a battery and with this virtual battery. To see in a year if I want to buy a home battery. I am currently unable to compare due to the rounding to 2. By rounding set to 3, which is a standard for kw, I am able to convert back to watts and compare with other meters containing the 3 digits precision. In Battery Sim 1.999 kW = 2kW, meaning 2000W. But I want to read 1999W instead.

Pleas accept this modification. And a gain a big thanks for this project.

geertsmichael commented 1 year ago

As a side effect, price is also rounded on 3 digits now.

hif2k1 commented 1 year ago

Great idea, I'll adopt this, but I think I need to work out the detail to show currency correctly as well. I haven't really set up the different types of sensor properly as I'm still learning as I go. They should each have their own class I think so I'll work on that.