Skip to content

feat: add LAFVIN UPS Module 3S sensor plugin (lafvin_ups_3s)#261

Merged
rightup merged 2 commits into
pyMC-dev:devfrom
CarlsonCustoms:feat/lafvin-ups-3s-sensor
May 26, 2026
Merged

feat: add LAFVIN UPS Module 3S sensor plugin (lafvin_ups_3s)#261
rightup merged 2 commits into
pyMC-dev:devfrom
CarlsonCustoms:feat/lafvin-ups-3s-sensor

Conversation

@CarlsonCustoms
Copy link
Copy Markdown
Contributor

Summary

  • Adds lafvin_ups_3s sensor type for the LAFVIN UPS Module 3S — an INA219-based UPS HAT for Raspberry Pi with a 3S Li-ion/LiPo battery pack
  • Reports pack voltage, current, power, estimated state-of-charge (0–100%), and charge state (charging / discharging / idle)
  • SoC uses a piecewise linear per-cell curve (pack voltage ÷ 3) consistent with the approach in waveshare_ups_d
  • INA219 address defaults to 0x41 (as factory-wired on the LAFVIN board); shunt resistance and max current are configurable for accurate calibration
  • Sensor module is auto-loaded by the existing SensorManager import mechanism — no changes to __init__.py or registry required

Config example

sensors:
  definitions:
    - type: lafvin_ups_3s
      name: battery
      enabled: true
      auto_install_packages: false
      settings:
        i2c_address: 0x41
        bus_number: 1
        shunt_ohms: 0.1
        max_amps: 5.0

Test plan

  • Confirm i2cdetect -y 1 shows device at 0x41 with LAFVIN UPS connected
  • Verify sensor initializes cleanly in repeater log (LAFVIN UPS 3S INA219 initialized)
  • Confirm voltage reading matches a multimeter measurement on the pack
  • Confirm charge state transitions between charging, discharging, and idle

🤖 Generated with Claude Code

rightup and others added 2 commits May 22, 2026 16:09
 pyMC_Repeater 1.0.10 updates
Adds a new sensor type for the LAFVIN UPS Module 3S, an INA219-based
uninterruptible power supply for Raspberry Pi. Reports pack voltage,
current, power, estimated state-of-charge, and charge state for a
3S Li-ion/LiPo battery configuration (9.0–12.6 V range).

The INA219 address defaults to 0x41 (as wired on the LAFVIN board)
and shunt resistance is configurable for accurate current readings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rightup rightup changed the base branch from main to dev May 26, 2026 07:57
@rightup rightup merged commit dc317b6 into pyMC-dev:dev May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants