chrisb2 / pi_ina219

This Python library supports the INA219 voltage, current and power monitor from Texas Instruments with a Raspberry Pi using the I2C bus. The intent of the library is to make it easy to use the quite complex functionality of this sensor.
MIT License
114 stars 34 forks source link

Convert from Adafruit_GPIO library (which is archived) to smbus2 library #28

Open chrisb2 opened 3 years ago

chrisb2 commented 3 years ago

The Adafruit_GPIO library is now archived and so does not correctly support later versions of Raspberry Pi and OS. The plan is to replace this with smbus2.

This stacktrace occurred on a Raspberry Pi 4 with 'Bullseye' Raspberry Pi OS:

File "/usr/local/lib/python3.9/dist-packages/ina219.py", line 116, in __init__
    self._i2c = I2C.get_i2c_device(address=address, busnum=busnum)
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 63, in get_i2c_device
    busnum = get_default_bus()
  File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 55, in get_default_bus
    raise RuntimeError('Could not determine default I2C bus for platform.')
RuntimeError: Could not determine default I2C bus for platform.

A work-around for this is described in the readme.

chrisb2 commented 2 years ago

@eliran-n - please raise this as a new issue, a PR is not a suitable place to ask unrelated questions. Thx

eliran-n commented 2 years ago

@eliran-n - please raise this as a new issue, a PR is not a suitable place to ask unrelated questions. Thx

Sorry, I was connected from a mobile device and I didn't find a way to contact you. I post my question as a new issue. Thank you