danb35 / raspi-ups-stats

MIT License
16 stars 5 forks source link

Issue on Bullseye OS #2

Open SimpleSon opened 2 years ago

SimpleSon commented 2 years ago

Updated to the latest Raspberry Pi OS with Bullseye and now I am getting the following error when running the script. I have one of the original versions of this script on my prior build before your fork of that project, which works, but would eventually error out. I copied it over to this new Bullseye build and at immediately throws the same error as my fresh script.
RuntimeError

peter-nufc commented 2 years ago

Unfortunately I'm having the exact same issue after upgrading to Bullseye.

SimpleSon commented 2 years ago

I have fallen back to just using the stats display without the UPS info. I can get that to run properly based on the original work of @mklements, but as he suggested, I don't know that the UPS is ready for Bullseye.

BlackNet commented 2 years ago

adafruit_gpio is depreciated and should be changed to blinka. Next, INA219 is the real issue here. Seems that the library has not been ported to bullseye just yet.

BlackNet commented 2 years ago

I was able to change a few things and get it working with bullseye, with charge/discharge/voltage/etc...

BlackNet commented 2 years ago

Here is my working code, including charging/discharging/voltage/etc for this project under 11.1, Raspbian Bullseye.

https://street-tek.dev/stats.py

AlanDorn commented 2 years ago

Here is my working code, including charging/discharging/voltage/etc for this project under 11.1, Raspbian Bullseye.

https://street-tek.dev/stats.py

excuse me kind sir, after trying to apply your code to my system I appear to be running the script for a little while(varies from 1 min to 10 mins) then I get an error:

aReceiveBuf = bus.read_i2c_block_data(DEVICE_ADDR, 0, 32) ioctl(self.fd, I2C_SMBUS, msg) OSError: [Errno 121] Remote I/O error

I am able to start it up again, and it will run for a little while (again from 1-10 minutes) then it will give that error. any tips or information about fixing this issue?

BlackNet commented 2 years ago

Here is my working code, including charging/discharging/voltage/etc for this project under 11.1, Raspbian Bullseye.

https://street-tek.dev/stats.py

excuse me kind sir, after trying to apply your code to my system I appear to be running the script for a little while(varies from 1 min to 10 mins) then I get an error:

aReceiveBuf = bus.read_i2c_block_data(DEVICE_ADDR, 0, 32)

ioctl(self.fd, I2C_SMBUS, msg)

OSError: [Errno 121] Remote I/O error

I am able to start it up again, and it will run for a little while (again from 1-10 minutes) then it will give that error. any tips or information about fixing this issue?

Look in syslog, message, daemon, or kern and see what shows there it should show errors and warning related to the device and give much more details. It could be as simple as a loose connection.

Stan4oe commented 1 year ago

Here is my working code, including charging/discharging/voltage/etc for this project under 11.1, Raspbian Bullseye.

https://street-tek.dev/stats.py

HI, can you post the code here it seams, I don't have authorisation to download it. Thank you.

BlackNet commented 1 year ago

Here is my working code, including charging/discharging/voltage/etc for this project under 11.1, Raspbian Bullseye. https://street-tek.dev/stats.py

HI, can you post the code here it seams, I don't have authorisation to download it. Thank you.

Woops, I moved that to a closed system and forgot about a few links.

Code did not seem to format correctly. I attached as a txt file, just rename it to code.py (py files are not allowed for some reason)

stats.py.txt

Stan4oe commented 1 year ago

Thank you for the script, but still has some issues, probably some dependencies. Installed Ina-219, but for some reason the script cant-find it (I'm so new in this!). Can you help me. Thank you.
prsc02

Traceback (most recent call last): File "/home/PIpc/Downloads/stats.py", line 105, in ina.configure() File "/home/PIpc/.local/lib/python3.9/site-packages/ina219.py", line 173, in configure self._calibrate( File "/home/PIpc/.local/lib/python3.9/site-packages/ina219.py", line 310, in _calibrate self._calibration_register(calibration) File "/home/PIpc/.local/lib/python3.9/site-packages/ina219.py", line 356, in _calibration_register self.__write_register(self.REG_CALIBRATION, register_value) File "/home/PIpc/.local/lib/python3.9/site-packages/ina219.py", line 388, in write_register self._i2c.writeList(register, register_bytes) File "/home/PIpc/.local/lib/python3.9/site-packages/Adafruit_GPIO/I2C.py", line 127, in writeList self._bus.write_i2c_block_data(self._address, register, data) File "/home/PIpc/.local/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py", line 357, in write_i2c_block_data self._device.write(data) OSError: [Errno 121] Remote I/O error

BlackNet commented 1 year ago

That needs to be run on the pi itself, so ssh in and run from there.

Stan4oe commented 1 year ago

It is run on the pi itself. The print screen is from the monitor hock it to the pi. I try from the comand prom - same answer. Probably is somthing small but I luck of experiance.