Skip to content

Add battery voltage, current, power, and temperature sensors - #9

Open
turbozv wants to merge 5 commits into
jsight:mainfrom
turbozv:main
Open

Add battery voltage, current, power, and temperature sensors#9
turbozv wants to merge 5 commits into
jsight:mainfrom
turbozv:main

Conversation

@turbozv

@turbozv turbozv commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Adds Home Assistant sensors for battery pack telemetry exposed through the Pecron API:

  • Battery voltage
  • Signed battery current
  • Calculated battery power (voltage × current)
  • Battery temperature

Battery power is positive while charging and negative while discharging.

Implementation

  • Reads measurements from the nested battery_pack packet
  • Discovers supported sensors through the host_packet_data_jdb TSL property
  • Handles missing, invalid, and non-finite telemetry gracefully
  • Sets sensible display precision for voltage and power

Testing

Added tests covering:

  • Sensor metadata and units
  • TSL-based entity discovery
  • Charging, discharging, and idle power calculations
  • Missing and malformed battery packet values

Verified E2E with my Pecron E2400LFP

image

turbozv added 5 commits July 17, 2026 19:09
…ent-support

Add battery voltage and current sensors
* fix: read battery packet measurements

* test: cover battery packet telemetry

* feat: add battery temperature sensor
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.

1 participant