Skip to content

victron_mqtt: battery power sign is most likely inverted #255

Open

Description

@frahlg

victron_mqtt on main emits the battery power as W = -bat_w, with the comment "Victron: positive power = discharging".

Victron's Venus D-Bus documentation says the opposite for the battery service: /Dc/0/Power and /Dc/0/Current are "positive when charged, negative when discharged". /Dc/Battery/Power on the system service is the same measurement. This repository's own victron.lua reads the same D-Bus value through Modbus register 842 and does not negate it. Our sign convention is battery charge positive (docs/WRITING-A-DRIVER.md, "Sign convention").

So victron_mqtt most likely shows charging as discharging. Nobody has measured it on a real GX yet.

To settle it: on a GX, read Dc/Battery/Power from MQTT while the battery charges (SoC rising) and while it discharges, and compare the sign. Then fix the driver and add a harness test.

The driver is read_only, so this affects telemetry, planning input and the site balance, not commands.

Found in the review of #254, which leaves the sign alone on purpose.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions