Skip to content

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

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

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
Contributor

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
@jsight

jsight commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Thanks for this — merged in #11 (rebased onto current main, with a small follow-up adding the missing strings.json translation entries for battery_voltage, battery_current, and battery_temperature). Closing this one out.

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