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

Battery charge limmits interfering with discharge detection #573

Closed
ElSargo opened this issue Oct 4, 2023 · 5 comments
Closed

Battery charge limmits interfering with discharge detection #573

ElSargo opened this issue Oct 4, 2023 · 5 comments

Comments

@ElSargo
Copy link

ElSargo commented Oct 4, 2023

My laptop uses charge limit's to prolong the batteries longevity, as a result that status of the battery may be discharging (since no charge is being added), but it is still using AC power.

The current discharge detection does not account for this behavior: core.py:311

if val == "Discharging":
  # we found a discharging battery
  return False

This could be fixed by checking the battery current

if val == "Discharging":
	# we found a discharging battery
	try: 
	    with open(Path(power_supply_path + supply + "/current_now")) as f:
	        current = str(f.read()[:-1])
	        # A battery's status might be "Discharging" but that doesn't necessarily mean it's draining
	        if current != "0":
	            return False
	except FileNotFoundError:
	    return False

I'm not sure if this is the optimal approach with is why I haven't opened a pr.
diff.TXT

@ElSargo
Copy link
Author

ElSargo commented Oct 4, 2023

Possibly related to #83

@shadeyg56
Copy link
Collaborator

shadeyg56 commented Oct 5, 2023

I have a charge limit set on my laptop so that it doesn't charge past 80% but I haven't had this issue.
What does running cat /sys/class/power_supply/BAT1/status output for you while the laptop is at the charge limit?

Also may I ask what you're using to limit the charge? Is it a kernel firmware or something else?

@ElSargo
Copy link
Author

ElSargo commented Oct 5, 2023

The output is "Not charging", I might be mistaken as to the cause of the issue. I thought that was it becuase auto-cpufreq --status shows

Battery is: discharging

Setting to use: "powersave" governor

The limit is being set by laptop firmware

@shadeyg56
Copy link
Collaborator

Hm yeah not sure why auto-cpufreq is picking up that its discharging

What do you get from cat /sys/class/power_supply/ACAD/online?

@ElSargo
Copy link
Author

ElSargo commented Oct 5, 2023

cat /sys/class/power_supply/ACAD/online gives no such file error
but /sys/class/power_supply/ADP1/online is 1
After taking the latest from source and installing it, it seems to be working now...
Sorry for the inconvinience

@ElSargo ElSargo closed this as completed Oct 5, 2023
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