ha: add li3_battery HA integration, replacing van-li3-battery
The li3 BMS has a persistently marginal BLE link from any single fixed vantage point on this Pi (onboard adapter, a USB dongle that turned out to be BR/EDR-only, and the Athom ESPHome BT proxy even after moving it closer). Move capture into HA proper so bluetooth.async_ble_device_from_address can pick whichever known source currently has the device, instead of hardcoding one. Protocol parsing ported verbatim from li3/van-li3-battery. van-li3-battery is disabled on the Pi; its MQTT discovery entities were cleared. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
94e6a2d811
commit
d25f48727f
@@ -0,0 +1,36 @@
|
||||
"""Constants for the Lithionics Li3 BMS integration."""
|
||||
|
||||
DOMAIN = "li3_battery"
|
||||
|
||||
# (key, name, unit, device_class, display_precision) -- precision None means a
|
||||
# non-numeric value (hex code, version string, serial number): published as-is,
|
||||
# no rounding, no state_class. Mirrors van-li3-battery's SENSORS list.
|
||||
SENSORS = [
|
||||
("voltage", "Pack Voltage", "V", "voltage", 2),
|
||||
("cell1_voltage", "Cell 1 Voltage", "V", "voltage", 2),
|
||||
("cell2_voltage", "Cell 2 Voltage", "V", "voltage", 2),
|
||||
("cell3_voltage", "Cell 3 Voltage", "V", "voltage", 2),
|
||||
("cell4_voltage", "Cell 4 Voltage", "V", "voltage", 2),
|
||||
("current", "Current", "A", "current", 2),
|
||||
("soc", "State of Charge", "%", "battery", 0),
|
||||
("bms_temperature", "BMS Temperature", "°F", "temperature", 1),
|
||||
("battery_temperature", "Battery Temperature", "°F", "temperature", 1),
|
||||
("remaining_capacity", "Remaining Capacity", "Ah", None, 0),
|
||||
("remaining_time", "Remaining Time", "min", "duration", 0),
|
||||
("can_charger_voltage", "CAN Charger Voltage", "V", "voltage", 1),
|
||||
("can_charger_current", "CAN Charger Current", "A", "current", 1),
|
||||
("can_charger_status", "CAN Charger Status", None, None, None),
|
||||
("can_status", "CAN Status", None, None, None),
|
||||
]
|
||||
|
||||
# From the one-time "$info" response -- published as diagnostic entities.
|
||||
INFO_SENSORS = [
|
||||
("total_consumed", "Lifetime Consumed", "Ah", None, 0),
|
||||
("last_fault_code", "Last Fault Code", None, None, None),
|
||||
("highest_recorded_temp", "Highest Recorded Temperature", "°F", "temperature", 0),
|
||||
("lowest_recorded_temp", "Lowest Recorded Temperature", "°F", "temperature", 0),
|
||||
("firmware_version", "Firmware Version", None, None, None),
|
||||
("aging_factor_temp", "Aging Factor (Temp)", None, None, 0),
|
||||
("aging_factor_soc", "Aging Factor (SOC)", None, None, 0),
|
||||
("serial_number", "Serial Number", None, None, None),
|
||||
]
|
||||
Reference in New Issue
Block a user