fix: add smbus2 dependency, i2c-tools, and use hex I2C addresses in docs

- Add smbus2>=0.4.0 to pyproject.toml core dependencies so it is always
  present in the venv rather than relying on runtime auto-install
- Add i2c-tools to apt-get installs in both install and upgrade paths
  so /dev/i2c-* devices are accessible and i2cdetect is available for
  diagnostics (service user was already being added to the i2c group)
- Switch ENS210 config examples to hex I2C address notation (0x43) to
  match datasheets and i2cdetect output; update contributor docs guidance
  accordingly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Joshua Mesilane
2026-05-13 11:54:32 +10:00
parent 9bfe1259da
commit 3f7b6d5cdc
4 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -242,7 +242,7 @@ sensors:
# enabled: true
# auto_install_packages: true
# settings:
# i2c_address: 67 # 0x43 in decimal (default ENS210 address)
# i2c_address: 0x43 # Default ENS210 address
# bus_number: 1 # I2C bus number (1 for Raspberry Pi default)
# read_timeout_seconds: 1.0 # Max seconds to wait for valid data (polls every 50 ms)
+1 -1
View File
@@ -107,7 +107,7 @@ Find the `sensors.definitions` block and add your sensor alongside the existing
# some_option: value
```
Use decimal for numeric config values that would naturally be written in hex (e.g. I2C addresses: `0x43` = `67`). Add a comment showing both forms if the value is commonly written in hex.
Use hex notation for I2C addresses (e.g. `0x43`) as this matches how addresses are listed in datasheets and tools like `i2cdetect`.
### 3. Test locally
+2 -2
View File
@@ -341,7 +341,7 @@ install_repeater() {
echo "25"; echo "# Installing system dependencies..."
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev libusb-1.0-0 sudo jq pip python3-venv python3-rrdtool wget swig build-essential python3-dev
DEBIAN_FRONTEND=noninteractive apt-get install -y libffi-dev libusb-1.0-0 sudo jq pip python3-venv python3-rrdtool wget swig build-essential python3-dev i2c-tools
# Install polkit (package name varies by distro version)
DEBIAN_FRONTEND=noninteractive apt-get install -y policykit-1 2>/dev/null \
|| DEBIAN_FRONTEND=noninteractive apt-get install -y polkitd pkexec 2>/dev/null \
@@ -746,7 +746,7 @@ upgrade_repeater() {
echo "[3/9] Updating system dependencies..."
apt-get update -qq
apt-get install -y libffi-dev libusb-1.0-0 sudo jq pip python3-venv python3-rrdtool wget swig build-essential python3-dev
apt-get install -y libffi-dev libusb-1.0-0 sudo jq pip python3-venv python3-rrdtool wget swig build-essential python3-dev i2c-tools
# Install polkit (package name varies by distro version)
apt-get install -y policykit-1 2>/dev/null \
|| apt-get install -y polkitd pkexec 2>/dev/null \
+1
View File
@@ -39,6 +39,7 @@ dependencies = [
"pyserial>=3.5",
"pyjwt>=2.8.0",
"ws4py>=0.6.0",
"smbus2>=0.4.0",
]