suptronics / x120x

Python script for UPS shield X1200 X1201 and X1202
4 stars 5 forks source link

python3 smbus error #6

Open johannstieger opened 1 month ago

johannstieger commented 1 month ago

Hi, when I want to run sudo python3 merged.py or sudo python3 bat.py I got these errors (line number is different in bat.py) : File "~/x120x/merged.py", line 5, in import smbus ModuleNotFoundError: No module named 'smbus'

It seems that smbus is missing. Is it better, to install smbus via sudo apt install python3-smbus or edit bat.py and merged.py and change import smbus bus = smbus.SMBus(1) to import smbus2 bus = smbus2.SMBus(1) ? In both cases I was able to read the battery status (Voltage and battery charge level) with "sudo python3 bat.py". But in none of the cases above I was able to get some informations via "sudo python3 merged.py". I only get a line break.

When I run sudo i2cdetect -y 1 I can see that address 36 is detected.

Best regards, Johann

johannstieger commented 1 month ago

I do now get data via merged.py - see pull request.