Zanduino / INA

Combined Arduino library for reading multiple INA2xx power monitor devices
GNU General Public License v3.0
158 stars 40 forks source link

Power does not show negative values. #87

Open Oleg-Sob opened 2 years ago

Oleg-Sob commented 2 years ago

Why INA226 with negative current readings, the power shows positive values. Should be negative too.

333

Please tell me how can I fix this.

SV-Zanshin commented 2 years ago

How are you calculating "Power"? Are you using "getBusMicroWatts()"?

Oleg-Sob commented 2 years ago

I output to Home Assistant with a script via EspHome.

i2c: sda: D2 scl: D1

sensor:

It may be possible to correct the formula so that Power has a negative value. I use with shunt 100A 75mV.

SV-Zanshin commented 2 years ago

I have never used Home Assist or EspHome so I'm not sure what that script does. How does it calculate power?

SV-Zanshin commented 2 years ago

I've updated the "getBusMicroWatts()" function to return negative Watts, but I don't know if that is the function you are using.