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

[Enhancement]: Improve PiSugar support #370

Closed
kfezer opened this issue Aug 21, 2024 · 3 comments · Fixed by #372
Closed

[Enhancement]: Improve PiSugar support #370

kfezer opened this issue Aug 21, 2024 · 3 comments · Fixed by #372
Assignees
Labels
enhancement New feature or request

Comments

@kfezer
Copy link

kfezer commented Aug 21, 2024

Describe the bug
When trying to run inky_run.py and pysugar board is off, bet this error:

21-08-2024 10:44:54 | inkycal.main |  INFO: name : Weather size : 984x256 px
21-08-2024 10:44:54 | inkycal.main |  INFO: PiSugar support enabled.
21-08-2024 10:44:55 | inkycal.main |  INFO: PiSugar battery capacity: None%
Traceback (most recent call last):
  File "/home/inky/Inkycal/inky_run.py", line 43, in <module>
    asyncio.run(run())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/inky/Inkycal/inky_run.py", line 18, in run
    inky = Inkycal(render=True, use_pi_sugar=True, shutdown_after_run=True)
  File "/home/inky/Inkycal/inkycal/main.py", line 168, in __init__
    if self.battery_capacity < 20:
TypeError: '<' not supported between instances of 'NoneType' and 'int'

To Reproduce
Steps to reproduce the behavior:

  1. With rpi plugged in, run inky_run.py

Expected behavior
Should handle the error of type better.

Copy link

Hi there and welcome to Inkycal. Thanks for opening this issue. As this is your first issue in this repository, please read through the contributing guidelines

@aceisace aceisace self-assigned this Aug 22, 2024
@aceisace aceisace added the enhancement New feature or request label Aug 22, 2024
@aceisace aceisace changed the title Pisugar support needs, work, errors when Pisugar board is off. [Enhancement]: Improve PiSugar support Aug 22, 2024
@aceisace
Copy link
Member

Hi @kfezer and thanks for reporting the issue. Yes, it seems this needs some improvements as the battery level cannot be read if the PiSugar board is off. Would you be willing to help test this functionality as I do not use the PiSugar on my build?
If yes, I'll have a fix ready soon and will provide you with some instructions on how to test the fix. If it works for you, then this can be made public.

@aceisace aceisace linked a pull request Aug 27, 2024 that will close this issue
aceisace added a commit that referenced this issue Aug 27, 2024
improve handling when piSugar is off
@aceisace
Copy link
Member

Okay, I got a fix ready for this and it's now available. Please run the following to get the patch;

cd ~/Inkycal && source venv/bin/activate
git pull
python inky_run.py

If something shouldn't work as expected, please re-open the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants