Commit Graph
17 Commits
Author SHA1 Message Date
Joshua MesilaneandClaude Sonnet 4.6 a01d59381b fix(ens210): check correct VALID bit in T_VAL/H_VAL polling
Bit 0 of byte 2 is the T_VALID/H_VALID flag (datasheet Figure 32/33,
page 23 example: t_valid = (t_val>>16) & 0x1). The previous code checked
bit 1 (CRC LSB), which caused sporadic timeouts when the CRC happened to
have a 0 in that position.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 17:07:28 +10:00
Joshua MesilaneandClaude Sonnet 4.6 7865e9cb4b fix: standardise sensor module structure and docs
- Use multi-line ensure_python_modules list format in ens210.py,
  matching the established pattern from ina219.py
- Fix auto_install_packages indentation in ina219.py docstring
- Remove smbus2 from pyproject.toml core dependencies; sensor packages
  are handled at runtime via ensure_python_modules/auto_install_packages
- Update docs/adding_sensors.md template and guidance to match

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 16:33:37 +10:00
Joshua MesilaneandClaude Sonnet 4.6 3f7b6d5cdc 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>
2026-05-13 11:54:32 +10:00
Joshua MesilaneandClaude Sonnet 4.6 9bfe1259da feat: add ENS210 temperature/humidity sensor plug-in
Adds support for the ENS210 relative humidity and temperature sensor
as a new plug-in under repeater/sensors/ens210.py. Also adds a
commented configuration example to config.yaml.example and a
contributor guide at docs/adding_sensors.md explaining how to add
further sensor plug-ins.

## Implementation notes

### Why smbus2 instead of an Adafruit/CircuitPython library

The ENS210 has no maintained Adafruit CircuitPython driver. The
available third-party options are either unmaintained or bring in the
full Blinka/CircuitPython hardware-abstraction stack as a dependency.
smbus2 is a thin, widely-packaged wrapper around the Linux i2c-dev
kernel interface that is already present on Raspberry Pi OS and most
Debian-based systems. It has no transitive dependencies and adds no
abstraction cost.

The ENS210 protocol is simple enough that direct register access is
preferable: two writes to start a measurement (REG_SENS_RUN + REG_SENS_START)
and two three-byte block reads to retrieve temperature and humidity.
The status/validity bit is checked inline rather than relying on a
library to surface it. There is no value a higher-level driver would
add here.

### Read strategy

A fixed post-trigger delay is unreliable — the sensor datasheet quotes
~130 ms typical conversion time but the actual ready time varies. The
implementation instead polls the data-valid status bit (bit 1 of the
third byte in each register block) every 50 ms for up to
read_timeout_seconds (default 1.0 s), breaking as soon as both T and
H report valid data. This is the same approach used in the validated
reference script.

The I2C bus is opened and closed on every read rather than kept open
across poll cycles. Keeping a persistent SMBus handle caused subsequent
reads to time out, consistent with the Linux i2c-dev file descriptor
accumulating state between transactions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 11:46:26 +10:00
Joshua Mesilane f1933dd2b0 Fix up the CapabilityBoundingSet to allow changing the GID and UID as part of a polkit or sudo restart, also ensure dbus is running as on some minimised systems it might not be (hi dietpi!) 2026-05-01 19:49:15 +10:00
Joshua Mesilane 55ed40c79c Adding in UltraPeaterZero defintions 2026-05-01 16:38:58 +10:00
Joshua Mesilane a9590fac01 Fix the headless install option 2026-04-18 21:09:01 +10:00
Joshua Mesilane 7ba26b72cb Fix for polkit version detection 2026-04-18 17:39:35 +10:00
Joshua Mesilane 8ebcb09eff Headless install fix 2026-04-18 17:12:06 +10:00
Joshua Mesilane 62d6627fab Fix readme 2026-04-18 17:09:26 +10:00
Joshua Mesilane 4e3b2bbc9a Updates to support installs on the LuckFox platform 2026-04-18 16:50:44 +10:00
Joshua Mesilane 3851055b65 Fix tests 2026-04-09 09:03:02 +10:00
Joshua Mesilane 2c95c0db0a Update example config files 2026-04-09 08:59:52 +10:00
Joshua Mesilane 7370cdc688 Update openapi and fix the test script 2026-04-07 16:28:49 +10:00
Joshua Mesilane 38e1fbe3f9 Changing from 'Global' Flood to 'Unscoped' flood as '*' doesn't actually mean wildcard, it means unscoped. Region keys should still only be forwaded if they're whitelisted. UI changes pending 2026-04-06 22:32:05 +10:00
Joshua Mesilane 1a645bdbc7 Switching to adding a new preset instead of changing the existing one to prevent arguments 2026-03-03 20:24:01 +11:00
Joshua Mesilane 6c02617729 Adding in Zindello Industries UltraPeater boards pre-release 2026-03-03 20:08:25 +11:00