-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daly H/K/M/S-Series BMS integration #4296
Open
patagonaa
wants to merge
10
commits into
esphome:next
Choose a base branch
from
patagonaa:daly_hkms
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f83bd6d
initial Daly H/K/M/S-Series component docs
patagonaa 5e11b8d
[daly_hkms_bms]: simplify example
patagonaa 1c71ee9
[daly_hkms_bms]: add integration to index
patagonaa 26e308e
[daly_hkms_bms]: replace bms picture, remove switch section
patagonaa 38f5408
[daly_hkms_bms]: add notice about different BMS generations
patagonaa f586af9
[daly_hkms_bms]: add field for using multiple BMS on one bus
patagonaa ecba93a
[daly_hkms_bms]: add notice about BMS sleep/wakeup
patagonaa 53ca3d5
Apply suggestions from code review
patagonaa 7a6582d
Merge branch 'next' into daly_hkms
patagonaa 4f43f00
[daly_hkms_bms]: clarify UART GND connection
patagonaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
Daly H/K/M/S-Series BMS Sensor | ||
============================== | ||
|
||
.. seo:: | ||
:description: Instructions for setting up a Daly H/K/M/S-Series Smart BMS | ||
:image: daly_bms.jpg | ||
|
||
The ``daly_hkms_bms`` sensor platform allows you to use a Daly H/K/M/S-Series Smart BMS | ||
(`more info <https://dalyelec.en.made-in-china.com/>`__) | ||
with ESPHome. | ||
|
||
Older Daly BMS use a custom UART-based protocol available via the :doc:`/components/sensor/daly_bms` component. | ||
|
||
.. figure:: images/daly_k-series_bms_example.png | ||
:align: center | ||
:width: 100.0% | ||
|
||
The communication with this component is done via a :ref:`UART <uart>` using a non-standard variation of the :ref:`Modbus protocol <modbus>`, | ||
either using RS485 or 3.3V UART. | ||
There may be multiple BMS on a single RS485 bus. | ||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
uart: | ||
- id: bms_uart | ||
baud_rate: 9600 | ||
... | ||
|
||
modbus: | ||
id: bms_modbus | ||
uart_id: bms_uart | ||
|
||
daly_hkms_bms: | ||
- modbus_id: bms_modbus | ||
daly_address: 1 | ||
update_interval: 10s | ||
|
||
|
||
Configuration variables: | ||
************************ | ||
|
||
- **modbus** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`Modbus Component <modbus>` if you want | ||
to use multiple Modbus buses. | ||
- **daly_address** (*Optional*, int): Address to use, defaults to ``1``. Address of the BMS can be set using the DALY PC Software. | ||
- **update_interval** (*Optional*, :ref:`config-time`): Delay between data requests, defaults to ``30s``. | ||
|
||
Sensor | ||
------ | ||
|
||
A sensor platform to read BMS data | ||
|
||
.. code-block:: yaml | ||
|
||
sensor: | ||
- platform: daly_hkms_bms | ||
daly_hkms_bms_id: bms_id | ||
voltage: | ||
name: "Battery Voltage" | ||
current: | ||
name: "Battery Current" | ||
battery_level: | ||
name: "Battery Level" | ||
remaining_capacity: | ||
name: "Remaining Capacity" | ||
cycles: | ||
name: "Battery Cycles" | ||
temperature_mos: | ||
name: "Temperature MOS" | ||
max_temperature: | ||
name: "Temperature Max" | ||
min_temperature: | ||
name: "Temperature Min" | ||
max_cell_voltage: | ||
name: "Cell Voltage Max" | ||
min_cell_voltage: | ||
name: "Cell Voltage Min" | ||
|
||
|
||
Configuration variables: | ||
************************ | ||
|
||
- **daly_hkms_bms_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the daly_hkms_bms hub if you want | ||
to use multiple BMS. | ||
|
||
- **voltage** (*Optional*): Voltage of the battery pack connected to Daly BMS. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **current** (*Optional*): Current flowing trough the BMS (input or output from batttery). | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **battery_level** (*Optional*): Battery level in % (SoC). | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **remaining_capacity** (*Optional*): The capacity in Ah left in the battery. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **cycles** (*Optional*): The number of charge cycles of the battery. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **temperature_mos** (*Optional*): The BMS MOSFET temperature. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **temperature_board** (*Optional*): The BMS PCB temperature (might not be available on all models). | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **temps_number** (*Optional*): The number of temperature sensors. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **max_temperature** (*Optional*): The higher temperature measured from the temperature sensors. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **max_temperature_probe_number** (*Optional*): The sensor number which has measured the higher temperature. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **min_temperature** (*Optional*): The lower temperature measured from the temperature sensors. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **min_temperature_probe_number** (*Optional*): The sensor number which has measured the lower temperature. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **temperature_1** (*Optional*): The first temperature sensor. There can be up to 8 temperature sensors. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **cells_number** (*Optional*): The number of cells in series in the battery pack. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **max_cell_voltage** (*Optional*): The cell of the battery with the highest voltage. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **max_cell_voltage_number** (*Optional*): The cell number of the battery with the highest voltage. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **min_cell_voltage** (*Optional*): The cell of the battery with the lowest voltage. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **min_cell_voltage_number** (*Optional*): The cell number of the battery with the lowest voltage. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
- **cell_1_voltage** (*Optional*): The voltage of cell number 1. Cell number can be from 1 to 48. | ||
All options from :ref:`Sensor <config-sensor>`. | ||
|
||
Text Sensor | ||
----------- | ||
|
||
Text sensor that indicates the status of BMS. | ||
|
||
.. code-block:: yaml | ||
|
||
text_sensor: | ||
- platform: daly_hkms_bms | ||
status: | ||
name: "BMS Status" | ||
|
||
Configuration variables: | ||
************************ | ||
|
||
- **daly_hkms_bms_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the daly_hkms_bms hub if you want | ||
to use multiple BMS. | ||
|
||
- **status** (*Optional*): The BMS Status (Charging, Discharging, Stationary). | ||
All options from :ref:`Text Sensor <config-text_sensor>`. | ||
|
||
Binary Sensor | ||
------------- | ||
|
||
Binary sensor that indicates the status of MOS. | ||
|
||
.. code-block:: yaml | ||
|
||
binary_sensor: | ||
- platform: daly_hkms_bms | ||
charging_mos_enabled: | ||
name: "Charging MOS" | ||
discharging_mos_enabled: | ||
name: "Discharging MOS" | ||
|
||
Configuration variables: | ||
************************ | ||
|
||
- **daly_hkms_bms_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the daly_hkms_bms hub if you want | ||
to use multiple BMS. | ||
|
||
- **charging_mos_enabled** (*Optional*): The BMS charging MOS status to enable the recharge of the battery. | ||
All options from :ref:`Binary Sensor <config-binary_sensor>`. | ||
|
||
- **discharging_mos_enabled** (*Optional*): The BMS discharging mos status to enable the load. | ||
All options from :ref:`Binary Sensor <config-binary_sensor>`. | ||
|
||
- **precharging_mos_enabled** (*Optional*): The BMS precharging mos status to precharge the load's capacitors. | ||
All options from :ref:`Binary Sensor <config-binary_sensor>`. | ||
|
||
- **balancing_active** (*Optional*): Whether the BMS is currently balancing the cells. | ||
All options from :ref:`Binary Sensor <config-binary_sensor>`. | ||
|
||
UART Connection | ||
--------------- | ||
|
||
Connect BMS RX to ESP TX, BMS TX to ESP RX and BMS GND to ESP GND. | ||
|
||
Alternatively, use an RS485 converter and connect A to A/+ and B to B/-. | ||
Always connect the ground, even when using RS485, to avoid stray currents running through the RS485 transceivers. | ||
|
||
Be aware that by default, the BMS goes to sleep after 1 hour and can not be woken up via RS485, | ||
only by RX/TX UART communication, charging/discharging the battery or toggling the switch input. | ||
|
||
The connectors are compatible with JST-GH (1.25mm pin pitch). | ||
|
||
.. figure:: images/daly_k-series_bms_pinout.png | ||
:align: center | ||
:width: 100.0% | ||
|
||
UART / RS485 Pinout. | ||
|
||
**3.3v Warning:** The UART 3.3v is designed to supply power to the Bluetooth module, not an entire ESP. | ||
There may be WiFi connection issues (or possibly damage to the BMS) when using this 3.3V rail to power an ESP. | ||
There is also 12V on the connector which should be able to supply more current. | ||
|
||
See Also | ||
-------- | ||
|
||
- :ref:`sensor-filters` | ||
- :doc:`/components/sensor/daly_bms` | ||
- :ref:`modbus` | ||
- :apiref:`daly_hkms_bms/daly_hkms_bms.h` | ||
- :ghedit:`Edit` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After your refactor, I think my suggestion no longer makes sense. This reverts it: