pokermaster1 / waveshareupsbattery

Waveshare UPS Hat for Raspberry PI Zero Plugin for display Battery Percent
11 stars 2 forks source link

Had installed waveshareupsbattery but still can't see battery on Gui #2

Open pupss89345 opened 5 days ago

pupss89345 commented 5 days ago

HI dear pokeermaster1 I have installed the pluging But I don't know why still no change when I click WEB GUI enable still no change Peek 2024-10-13 23-13

And I found error log in below [2024-10-13 16:36:51,443] [ERROR] Exception on /plugins/toggle [POST] Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 2525, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/ui/web/handler.py", line 71, in wrapper return f(args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/ui/web/handler.py", line 189, in plugins return 'success' if plugins.toggle_plugin(request.form['plugin'], checked) else 'failed' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/plugins/init.py", line 60, in toggle_plugin load_from_file(database[name]) File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/plugins/init.py", line 110, in load_from_file spec.loader.exec_module(instance) File "", line 936, in exec_module File "", line 1074, in get_code File "", line 1004, in source_to_code File "", line 241, in _call_with_frames_removed File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 113

waveshareupsbattery/wavesharebattery.py at main · pokermaster1/waveshareupsbattery · GitHub

^ SyntaxError: invalid character '·' (U+00B7)

pokermaster1 commented 5 days ago

did you enable i2c in raspi-config? Also please write down what hardware and what image are you are using.

pokermaster1 commented 5 days ago

okay due to the error message you posted there is a problem with the code itself you copied. Is there any non-ascii string anywhere in the code? Also did you just copied the code and pasted it in? Maybe thats the reason it does not work. Look in line 113 and try to find the error or just upload a picture from the code :)

pupss89345 commented 5 days ago

emm you'r right I use wget download py file is wrong

pokermaster1 commented 5 days ago

I personally would recommend to use filezilla or any other software where you can easily up and download files. You can also just copy the code and paste it in a manually created .py file. Hope it works for you!

pupss89345 commented 5 days ago

Thanks you a lot Now I use correct file ~ and error message is change like below problem is line 88 self.bus.write_i2c_block_data(self.addr,address,temp) I sure I2c is open because I can use pwnagotchi without microusb charge Exception on /plugins/toggle [POST] Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 2525, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/flask/app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/ui/web/handler.py", line 71, in wrapper return f(args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/ui/web/handler.py", line 189, in plugins return 'success' if plugins.toggle_plugin(request.form['plugin'], checked) else 'failed' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/plugins/init.py", line 60, in toggle_plugin load_from_file(database[name]) File "/usr/local/lib/python3.11/dist-packages/pwnagotchi/plugins/init.py", line 110, in load_from_file spec.loader.exec_module(instance) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 138, in class WaveshareBattery(plugins.Plugin): File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 145, in WaveshareBattery ina219 = INA219(addr=0x43) ^^^^^^^^^^^^^^^^^ File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 78, in init self.set_calibration_16V_5A() File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 98, in set_calibration_16V_5A self.write(_REG_CALIBRATION,self._cal_value) File "/usr/local/share/pwnagotchi/custom-plugins/wavesharebattery.py", line 88, in write self.bus.write_i2c_block_data(self.addr,address,temp) OSError: [Errno 5] Input/output error

pupss89345 commented 5 days ago

but strangely I use command check i2c no see anything image

pokermaster1 commented 5 days ago

did you really activate I2C on your machine?

Please do it again:

sudo raspi-config -> Interface options (I guess its called like that) -> Enable I2C

pupss89345 commented 5 days ago

yes I do it again image but still can't detect it I use Raspberry pi zero 2wh