Skip to content

fenecon_battery_power never reports negative values (battery charging looks like discharging) #32

@tommapson

Description

@tommapson

Describe the bug

fenecon_battery_power only reports positive values or zero. Regardless whether the battery is charging or discharging, the metric shows a positive value. This makes it impossible to distinguish between "battery idle" and "battery charging" and renders the metric useless for energy flow dashboards.

Important note Starting from here, the analysis was written by Claude after having created a workaround using JSON exporter.

The root cause appears to be that the exporter uses _sum/EssDischargePower as its source, which only covers one direction of power flow. _sum/EssChargePower does not exist on this system (empty API response).

To Reproduce

Query the relevant FENECON REST API channels while the battery is discharging:

curl http://x:user@fems:8084/rest/channel/_sum/EssActivePower
{"value":941, "text": "Negative values for charge; positive for discharge", ...}

curl http://x:user@fems:8084/rest/channel/_sum/EssDischargePower
{"value":0, ...}

curl http://x:user@fems:8084/rest/channel/_sum/EssChargePower
(empty response)

EssActivePower correctly reports 941 W while EssDischargePower reports 0.

Expected behavior

fenecon_battery_power should be a signed metric: positive values for discharge, negative values for charge — consistent with how OpenEMS documents _sum/EssActivePower.

Suggestion

Use _sum/EssActivePower as the source instead of _sum/EssDischargePower. It is signed, reliably implemented, and explicitly documented by OpenEMS as the authoritative AC-side ESS power value.

Workaround

Scraping _sum/EssActivePower directly via prometheuscommunity/json-exporter as a separate job yields correct signed values.

Environment

  • Image: webdevops/fenecon-exporter:latest
  • FENECON/OpenEMS REST API endpoint: _sum/EssActivePower, _sum/EssDischargePower

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