This integration allows to monitor Bluetooth Low Energy (BLE) battery management systems (BMS) from within Home Assistant. After installation, no configuration is required. You can use the ESPHome Bluetooth proxy to extend the bluetooth coverage range. By using standard dashboard cards, it is easy to visualize the current state of remote batteries.
SmartBat-A
… or SmartBat-B
…)DL-
…)SP0
… or SP1
…)New device types can be easily added via the plugin architecture of this integration. See the contribution guidelines for details.
The integration provides the following information about the battery
Platform | Description | Unit | Details |
---|---|---|---|
sensor |
SoC (state of charge) | % |
range 100% (full) to 0% (battery empty) |
sensor |
stored energy | Wh |
currently stored energy |
sensor |
voltage | V |
overall battery voltage |
sensor |
current | A |
positive for charging, negative for discharging |
sensor |
power | W |
positive for charging, negative for discharging |
sensor |
temperature | °C |
individual temperature values are available as attribute to this sensor, if the BMS supports multiple sensors |
sensor |
(remaining) runtime | s |
remaining discharge time till SoC 0% |
sensor |
charge cycles | # |
|
sensor |
delta voltage | V |
maximum difference between any two cells; individual cell voltage are available as attribute to this sensor |
binary_sensor |
battery charging indicator | bool |
true if battery is charging |
Installation can be done using HACS by adding a custom repository.
configuration.yaml
).custom_components
directory (folder) there, you need to create it.custom_components
directory (folder) create a new folder called bms_ble
.custom_components/bms_ble/
directory (folder) in this repository.In case you have severe troubles,
The polling interval is 30 seconds. So at startup it takes a few minutes to detect the battery and query the sensors. Then data will be available.
Yes, you can use a template sensor or a card to show templates, e.g. Mushroom template card with the following template:
{{ timedelta(seconds=int(states("sensor.smartbat_..._runtime"), 0)) }}
results in e,g, 4 days, 4:20:00
The individual voltages are available as attribute to the delta voltage
sensor. Click the sensor and at the bottom of the graph expand the attribute
section. Alternatively, you can also find them in the developer tools.
To create individual sensors, go to Settings > Devices & Services > Helper and add a template sensor for each cell you want to monitor. Fill the configuration for, e.g. the first cell (0), as follows:
Field | Content |
---|---|
State template | {{ iif(has_value("sensor.smartbat_..._delta_voltage"), state_attr("sensor.smartbat_..._delta_voltage", "cell_voltages")[0], None) }} The index [0] can be in the range from 0 to the number of cells-1, i.e. 0-3 for a 4 cell battery. |
Unit of measurement | V |
Device class | Voltage |
State class | Measurement |
Device | smartbat_... |
or add the following snippet to your configuration.yaml
:
template:
- sensor:
- name: cell_voltage_0
state: >-
{{ state_attr('sensor.smartbat_..._delta_voltage', 'cell_voltages')[0] }}
unit_of_measurement: 'V'
state_class: measurement
device_class: voltage
availability: >-
{{ has_value('sensor.smartbat_..._delta_voltage') }}
Please follow the explanations in the previous question but use the following:
Field | Content |
---|---|
State template | {%- if has_value("sensor.smartbat_..._delta_voltage") %} {{ state_attr("sensor.smartbat_..._delta_voltage", "cell_voltages") \| max }} {% else %} None {% endif -%} |
There are plenty more functions you can use, e.g. min, and the full power of templating.
Sure, use, e.g. a threshold sensor based on the current to/from the battery. Negative means discharging, positiv is charging.
Then you need to pair your device first. This is procedure is only required once for each device.
bluetoothctl devices
to check that your devices is detected andbluetoothctl pair <MAC_of_BMS>
to start pairing the device.Once pairing is done, the integration should automatically detect the BMS.
for helping with making the integration better.