syssi / esphome-jbd-bms

ESPHome component to monitor and control a Xiaoxiang Battery Management System (JBD-BMS) via UART-TTL or BLE
Apache License 2.0
102 stars 28 forks source link

Multiple BMS via BLE #52

Closed Magsybaby closed 1 year ago

Magsybaby commented 1 year ago

Is is possible to monitor multiple BMS via BLE?

I've tried to add multiple by incrementing the IDs for the devices but not having much luck...wondering if it is me being dumb.

Thanks

syssi commented 1 year ago

How many devices do you try to monitor? Could you provide your YAML? I will have a brief look. I guess you missed to change the sensor names.

syssi commented 1 year ago

I've prepared a config example here: https://github.com/syssi/esphome-jbd-bms/blob/add-multiple-devices-examples/esp32-ble-example-multiple-devices.yaml

syssi commented 1 year ago

This shouldn't happen. Could you provide your YAML?

syssi commented 1 year ago

Your YAML looks good if you use two different MAC addresses to connect to your devices.

As next step a ESPHome log would be nice. It should contain the ESPHome version (it's important to use the latest release), the BLE connection setup of both devices and some sensor readings. I hope this will help to identify the bug.

syssi commented 1 year ago

We should start with DEBUG.

syssi commented 1 year ago

Which ESPHome version do you use?

Magsybaby commented 1 year ago

Apologies for not replying to this thread. The example YAML helped me, thank you so much for that. I have been monitoring two BMS for several weeks without issue.

I have used ESPHome 2023.7+

syssi commented 1 year ago

@avense Please update ESPHome. There was a core bug in the past which is responsible for your issue.

@Magsybaby thanks for your feedback! :-)

syssi commented 1 year ago

Could you provide your YAML another time? The log book doesn't match with the provided YAML above.

syssi commented 1 year ago

Btw the log doesn't show any issues:

'baterias-lifepo4 bms0 balancer status bitmask': Sending state 0.00000 with 0 decimals of accuracy
'baterias-lifepo4 bms1 balancer status bitmask': Sending state 0.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 battery strings': Sending state 4.00000 with 0 decimals of accuracy
'baterias-lifepo4 bms1 battery strings': Sending state 4.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 battery strings': Sending state 4.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 capacity remaining': Sending state 175.76999 Ah with 2 decimals of accuracy
'baterias-lifepo4 bms1 capacity remaining': Sending state 176.86000 Ah with 2 decimals of accuracy

'baterias-lifepo4 bms0 charging cycles': Sending state 25.00000 with 0 decimals of accuracy
'baterias-lifepo4 bms1 charging cycles': Sending state 1.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 charging power': Sending state 0.00000 W with 2 decimals of accuracy
'baterias-lifepo4 bms1 charging power': Sending state 0.00000 W with 2 decimals of accuracy

'baterias-lifepo4 bms0 current': Sending state -10.25000 A with 1 decimals of accuracy
'baterias-lifepo4 bms1 current': Sending state -10.16000 A with 1 decimals of accuracy

'baterias-lifepo4 bms0 discharging power': Sending state 135.19749 W with 2 decimals of accuracy
'baterias-lifepo4 bms1 discharging power': Sending state 134.31519 W with 2 decimals of accuracy

'baterias-lifepo4 bms0 errors bitmask': Sending state 0.00000 with 0 decimals of accuracy
'baterias-lifepo4 bms1 errors bitmask': Sending state 0.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 errors': Sending state ''
'baterias-lifepo4 bms1 errors': Sending state ''

'baterias-lifepo4 bms0 nominal capacity': Sending state 230.00000 Ah with 2 decimals of accuracy
'baterias-lifepo4 bms1 nominal capacity': Sending state 230.00000 Ah with 2 decimals of accuracy

'baterias-lifepo4 bms0 operation status bitmask': Sending state 3.00000 with 0 decimals of accuracy
'baterias-lifepo4 bms1 operation status bitmask': Sending state 3.00000 with 0 decimals of accuracy

'baterias-lifepo4 bms0 power': Sending state -135.19749 W with 1 decimals of accuracy
'baterias-lifepo4 bms1 power': Sending state -134.31519 W with 1 decimals of accuracy

'baterias-lifepo4 bms0 software version': Sending state 2.40000 with 1 decimals of accuracy
'baterias-lifepo4 bms1 software version': Sending state 6.00000 with 1 decimals of accuracy

'baterias-lifepo4 bms0 state of charge': Sending state 76.00000 % with 0 decimals of accuracy
'baterias-lifepo4 bms1 state of charge': Sending state 77.00000 % with 0 decimals of accuracy

'baterias-lifepo4 bms0 temperature': Sending state 26.20000 °C with 1 decimals of accuracy
'baterias-lifepo4 bms1 temperature': Sending state 26.30000 °C with 1 decimals of accuracy

'baterias-lifepo4 bms0 total voltage': Sending state 13.19000 V with 2 decimals of accuracy
'baterias-lifepo4 bms1 total voltage': Sending state 13.22000 V with 2 decimals of accuracy

Date of manufacture: 2022.9.12
Date of manufacture: 2023.3.16
syssi commented 1 year ago

Do you see the mix up of the sensor readings at the log too? Could you provide a longer capture with multiple total voltage readings of both devices?

syssi commented 1 year ago

Do you see this effect at the logs too? I would like to make sure this doesn't happen because of mixed up MQTT topics.

syssi commented 1 year ago

Yes!

syssi commented 1 year ago

Do you use this package on purpose?

esphome:
  name: ${name}
  platformio_options:
    platform_packages:
     - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5

If not please remove these lines from your YAML:

  platformio_options:
    platform_packages:
     - toolchain-riscv3

Using this pull request isn't required anymore. The new web_server_ idf component is merged and part of the latest release. Please remove these lines too:

external_components:
  - source: ${external_components_source} 
  - source: github://pr#3500
    components:
      # list all components modified by this Pull Request here
      - web_server
      - web_server_idf
      - web_server_base
      - captive_portal
    refresh: 0s

Could you open the web interface and provide another short clip / recording of the total voltage sensor here? Thanks in advance!

syssi commented 1 year ago

My fault. This lines are still required to load this external component / project:

external_components:
  - source: ${external_components_source