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

Improve sensors_battery for linux platforms #1266

Closed
wants to merge 1 commit into from
Closed

Improve sensors_battery for linux platforms #1266

wants to merge 1 commit into from

Conversation

yehan2002
Copy link

add fallback for power_now
add new paths for power cables

add fallback for power_now
add new paths for power cables
@@ -1243,7 +1243,9 @@ def multi_cat(*paths):
energy_full = multi_cat(
root + "/energy_full",
root + "/charge_full")
if energy_now is None or power_now is None:
if power_now is None:
power_now = 0 # provide a fallback since some systems don't provide this.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. If power_now can't be determined we also cannot determine secsleft so it's probably better to just return None

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but in case power_now is not available this still gives the battery percentage and whether or not the charger is connected

@yehan2002 yehan2002 closed this Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants