Skip to content

Cumulative reactive energy (kVARh) should use lowercase kvarh #105

@cpms67

Description

@cpms67

The P1 Reader component currently reports cumulative reactive energy (import/export) using the unit of measurement "kVARh" (uppercase VAR).

However, Home Assistant’s device class validation for reactive_energy only accepts lowercase "kvarh".

This causes warnings in Home Assistant logs, for example:

Entity sensor.esp8266_1_cumulative_reactive_import
is using native unit of measurement 'kVARh' which is not a valid unit
for the device class ('reactive_energy'); expected one of ['varh', 'kvarh', 'mvarh'].

Steps to reproduce:

Configure ESPHome with P1 Reader

Upload firmware

Observe Home Assistant logs → warning about invalid unit "kVARh"

Expected behavior:
Reactive energy should use the lowercase unit "kvarh".

Workaround tested:
In a local override of p1reader.cpp, I changed:

unit_of_measurement = "kVARh";

to:

unit_of_measurement = "kvarh";

After recompiling, Home Assistant accepted the unit and warnings disappeared.
ESPHome logs now show "kvarh" as expected.

Environment:

Home Assistant Core 2025.10.0

ESPHome 2025.9.3

P1 Reader version: latest

Hardware: ESP8266-1

Suggested fix:
Update p1reader.cpp to use "kvarh" instead of "kVARh" for cumulative reactive energy sensors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions