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

Power does not show negative values. #87

Open
Oleg-Sob opened this issue Jan 16, 2022 · 4 comments
Open

Power does not show negative values. #87

Oleg-Sob opened this issue Jan 16, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Oleg-Sob
Copy link

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

333

Please tell me how can I fix this.

@Oleg-Sob Oleg-Sob added the bug Something isn't working label Jan 16, 2022
@SV-Zanshin
Copy link
Collaborator

SV-Zanshin commented Jan 16, 2022

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

@Oleg-Sob
Copy link
Author

Oleg-Sob commented Jan 16, 2022

I output to Home Assistant with a script via EspHome.

i2c:
sda: D2
scl: D1

sensor:

  • platform: ina226
    address: 0x40
    shunt_resistance: 0.0005 ohm
    current:
    name: "INA226_1 Current"
    accuracy_decimals: 1
    power:
    name: "INA226_1 Power"
    accuracy_decimals: 0
    filters:
    • lambda: return x*2.047;
      bus_voltage:
      name: "INA226_1 Bus Voltage"
      filters:
    • lambda: return x*2.047;
      shunt_voltage:
      name: "INA226_1 Shunt Voltage"
      accuracy_decimals: 0
      filters:
    • lambda: return x*107800;
      max_current: 100A
      update_interval: 10s

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

SV-Zanshin pushed a commit that referenced this issue Jan 16, 2022
@SV-Zanshin
Copy link
Collaborator

SV-Zanshin commented Jan 16, 2022

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

@SV-Zanshin
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants