Skip to content

Power Rate is always positive even when discharging #540

@MeteorRehkitz

Description

@MeteorRehkitz

Has this issue been covered in the Wiki?

  • I have read the Wiki and my issue is not covered.

Is there an existing issue reported already?

  • I have searched the existing issues, it does not exist.

What is the unexpected behavior?

The calculated power rate is always positive.
The problem seems to be that for my system the reported current form the battery is already negative and then, since it is discharging, it is again multiplied with -1 (line 446 in sensors.js). Before multiplying with -1 it should be checked whether the current is already negative.

Steps to reproduce the unexpected behavior.

  1. install Fedora asahi Linux with Gnome on M1 MacBook Air
  2. install Vitals extension
  3. see positive current while discharging

Relevant log output

cat /sys/class/power_supply/macsmc-battery/uevent 
DEVTYPE=power_supply
POWER_SUPPLY_NAME=macsmc-battery
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_CYCLE_COUNT=210
POWER_SUPPLY_VOLTAGE_MAX=13035000
POWER_SUPPLY_VOLTAGE_MIN=8527000
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=12900000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=9000000
POWER_SUPPLY_VOLTAGE_NOW=12233000
POWER_SUPPLY_CURRENT_NOW=-386000
POWER_SUPPLY_POWER_NOW=-4721000
POWER_SUPPLY_CHARGE_FULL_DESIGN=4382000
POWER_SUPPLY_CHARGE_FULL=3666000
POWER_SUPPLY_CHARGE_NOW=3143000
POWER_SUPPLY_CHARGE_COUNTER=-390577
POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=3712000
POWER_SUPPLY_CONSTANT_CHARGE_VOLTAGE=12891000
POWER_SUPPLY_CHARGE_CONTROL_START_THRESHOLD=100
POWER_SUPPLY_CHARGE_CONTROL_END_THRESHOLD=100
POWER_SUPPLY_CHARGE_BEHAVIOUR=auto
POWER_SUPPLY_ENERGY_FULL_DESIGN=49954800
POWER_SUPPLY_ENERGY_FULL=41792400
POWER_SUPPLY_ENERGY_NOW=35830200
POWER_SUPPLY_CAPACITY=91
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_TEMP=288
POWER_SUPPLY_TIME_TO_EMPTY_NOW=30360
POWER_SUPPLY_TIME_TO_FULL_NOW=0
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_SCOPE=System
POWER_SUPPLY_CHARGE_TERM_CURRENT=130000
POWER_SUPPLY_MANUFACTURE_YEAR=2021
POWER_SUPPLY_MANUFACTURE_MONTH=9
POWER_SUPPLY_MANUFACTURE_DAY=26

What distribution and version of Linux are you using?

Fedora 43

What version of Gnome are you using?

49

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions