Skip to content
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

How to setup ESPHome from scratch #327

Closed
moscito1010 opened this issue May 8, 2023 · 29 comments
Closed

How to setup ESPHome from scratch #327

moscito1010 opened this issue May 8, 2023 · 29 comments
Labels
question Further information is requested

Comments

@moscito1010
Copy link

Hello
Can someone link me to instructions for an absolute beginner so that I can get the code on an esp32.
I've tried it for a while now but I don't have all the basics to do it.

I have a NEEY bms 4th 4A and would like to visualize the BMS data in Home Assistant. Unfortunately, I've really never worked with plattformIO and Visual Studio. For me it's like sitting in the space shuttle and it should land :-)
Since I don't know at all how to proceed I could use a simple good guide. Preferably a YT post.

@syssi
Copy link
Owner

syssi commented May 8, 2023

Do you have access to an Linux host? Visual Studio isn't required. A few console commands should be sufficient:

https://raw.githubusercontent.com/syssi/esphome-seplos-bms/main/install.gif

  1. Use a x86 based Linux host. Please try to avoid a Raspberry Pi because of the CPU architecture
  2. Make sure python 3.x and the python package manager (called pip) is installed
  3. Install esphome using the package manager pip3 install esphome
  4. The to execute the command line tool esphome type: ~/.local/bin/esphome
  5. Create a directory for your esphome configuration YAMLs: mkdir ~/esphome
  6. Download the Heltec Balancer configuration example: cd ~/esphome; wget https://raw.githubusercontent.com/syssi/esphome-jk-bms/main/esp32-heltec-balancer-ble-example.yaml
  7. Update line 5 (the mac_address) to the MAC address of your balancer
  8. Create a secrets.yaml and provide some required secrets:
cat > ~/esphome/secrets.yaml <<EOF
wifi_ssid: MY_WIFI_SSID
wifi_password: MY_WIFI_PASSWORD

mqtt_host: MY_MQTT_HOST
mqtt_username: MY_MQTT_USERNAME
mqtt_password: MY_MQTT_PASSWORD
EOF
  1. Run the YAML using the esphome CLI (means: compile & flash the config): ~/.local/bin/esphome run esp32-heltec-balancer-ble-example.yaml
  2. Have fun! :-)

@moscito1010
Copy link
Author

I'm really blown away. Thank you for your quick help.
In fact, I only have Linux on my various Raspberry, but I'll quickly create a linux partition and install Ubuntu.

@moscito1010
Copy link
Author

oh wait. I have a NEEY balancer that only has bluetooth.
I wanted to use the ESP as a BLE2WIFI bridge.
Did I misunderstand the project? I thought it was about using an ESP32 to implement communication between the balancer and e.g. Home Assistant.

@moscito1010
Copy link
Author

forget it, I think I got it now :-)

@syssi
Copy link
Owner

syssi commented May 8, 2023

Your understanding is correct. The mentioned YAML talks to your NEEY/Heltec Balancer via BLE and publishs the received measurements via MQTT. The command topics can be used to control the balancer (settings / switches).

@moscito1010
Copy link
Author

Something is still wrong.

~/esphome$ ~/.local/bin/esphome run esp32-heltec-balancer-ble-example.yaml
INFO Reading configuration esp32-heltec-balancer-ble-example.yaml...
INFO Updating https://github.com/syssi/esphome-jk-bms.git@main
Failed config

wifi: [source esp32-heltec-balancer-ble-example.yaml:24]
ssid: !secret wifi_ssid

Must be string, got <class 'esphome.helpers.EInt'>. did you forget putting quotes around the value?.
Password: 12345678

I adapted the config on my board with the information from the website https://registry.platformio.org/platforms/platformio/espressif32/boards

substitutions:
name: heltec-balancer
device_description: "Monitor and control a Heltec/NEEY 4A balancer via bluet>
external_components_source: github://syssi/esphome-jk-bms@main
mac_address: 00:E4:4C:21:D7:53

esphome:
name: ${name}
comment: ${device_description}
projects:
name: "moscitobox.battery1"
version: 1.4.0

esp32:
board: az-delivery-devkit-v4
frame:
type: esp-idf

the secret.yaml looks like this

wifi_ssid: moscitobox
wifi_password: 12345678
mqtt_host: 192.168.178.48
mqtt_username: pi
mqtt_password: 12345678

Of course that's not my password :-)

what i should mention i have 5 balancers. do I need an ESP32 for each balancer?

I also use an ESP32 for another project to control my Bluetooth heating valves, so I can connect 6 devices to one ESP.

@moscito1010
Copy link
Author

quotation marks had to be set. It took me a while to understand :-)

@moscito1010
Copy link
Author

I give up.
This doesn't work on my system and I'm sure that the error is in front of the pc.
########
rocessing heltec-balancer (board: az-delivery-devkit-v4; framework: espidf; platform: platformio/espressif32 @ 3.5.0)


Tool Manager: Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
INFO Installing espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2
Error: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2' requirements for your system 'linux_x86_64'

and

ERROR Error while reading config: Invalid YAML syntax:

Secret 'mqtt_password' not defined
in "esp32-heltec-balancer-ble-example.yaml", line 38, column 14:
password: !secret mqtt_password
^

I have to find someone to flash my ESP. I obviously can't do it myself and you're not ESP support.
Many thanks for the help you provided.
Let's see if someone in the ESP forum can help me.

@moscito1010
Copy link
Author

Es lies mir keine Ruhe also habe ich es heute früh nochmal probiert.
Ich nutze meinen PC (Ryzen CPU) mit Ubuntu 18 lts. Ich habe apt update und upgrade vorher ausgeführt.

Ich hab Schritt für Schritt nach deiner Anleitung gehandelt aber ich komme zu keinem brauchbaren Ergebnis.
(Schritt 7) Die MAC Adresse vom NEEY habe ich mir in Ubuntu anzeigen lassen und in der yaml eingetragen .
(Schritt 8) Das Erstellen der secrets.yaml ist auch klar.
(Schritt 10) Die secrets.yaml wird aber von ESPHOME später nicht akzeptiert, das WIFI Passwort soll laut Fehlermeldung in Anführungszeichen angegeben werden. Ändere ich das scheitert es daran das 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch2' nicht gefunden wird.

Auf einem Laptop habe ich es auch probiert, das ist exakt das selbe Problem. Ich hab auch meinen Sohn gebeten das ganze mal auf seinem PC zu machen, der hat aber genau das selbe Problem. Er nutzt auch Ubuntu auf seinem Intel PC.
Ich würde meinen das du noch irgendwas zusätzlich installiert hast oder eine andere ESPHOME Version nutz damit das funktioniert.

@syssi
Copy link
Owner

syssi commented May 9, 2023

I will spin up a ubuntu 18.04 machine and give it a try. Don't give up! You are almost there!

@syssi
Copy link
Owner

syssi commented May 9, 2023

The most recent ESPHome release requires Python >=3.9. Please use Ubuntu 22 and try again.

@syssi syssi changed the title Never work before with Visual Studio/PlattformIO. How to setup ESPHome from scratch May 9, 2023
@syssi syssi added the question Further information is requested label May 9, 2023
@moscito1010
Copy link
Author

ok, i switched to version 22. Now it's working.
My ESP hardware is az-delivery-devkit-v4 and esp32cam.
ESP32CAM doesn't want to work that well but that's no big deal, I have a couple of the az-delivery-devkit-v4.

Now comes task 2 :-)
How can I connect 2 NEEYś or more to one ESP. I have a total of 5 LFP 16S battery packs.
The ESP should be fine with more than one connection, with another esp32 I connected 5 BLE heating valves, that works great.

@syssi
Copy link
Owner

syssi commented May 9, 2023

Do you know this discussion? #310 (comment)

The ESP32 supports up to 3 simultaneous BLE client connections.

@moscito1010
Copy link
Author

I read it but don't really believe it.
I have 5 eq3 BLE heater valves that I connected to an ESP32. This has been working for 2 years without any problems.
Here is the link to the project
https://github.com/softypit/esp32_mqtt_eq3

Here my screenshot
grafik

@syssi
Copy link
Owner

syssi commented May 9, 2023

Hmm... I'm talking about this limitation: https://esphome.io/components/ble_client.html#ble-client

I guess the esp32_mqtt_eq3 project doesn't maintain simultaneous BLE connections. Receiving passive advertisements doesn't does not count here either. May be you can talk sequentially to all devices using a single ESP32.

@moscito1010
Copy link
Author

moscito1010 commented May 9, 2023

ok, this is probably sufficient for a heating valve.
I took the multi ble codes from you and applied them to the remaining sections according to this scheme. This also works so far, I just don't understand the "interval" section.
I have to specify mqtt directly. when i refer to the secrets.yaml there is an error message from esphome.
man I hope I'm not annoying but this original app is just a horror and it can't do anything. Your ESP solution is just too good

Here is the result of my "copying"

substitutions:
  name: heltec-balancer
  device0: NEEY1
  device1: NEEY2
  device_description: "Monitor and control a Heltec/NEEY 4A balancer via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: 00:E4:4C:xx:xx:xx
  mac_address2: 00:E4:4C:xx:xx:xx

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp32:
  board: az-delivery-devkit-v4
  framework:
    type: esp-idf

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

ota:

logger:
  level: DEBUG

# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
api:

mqtt:
  broker: 192.168.178.48
  username: pi
  password: xxxxxxxxx
#  id: 

esp32_ble_tracker:
  on_ble_advertise:
    then:
      - lambda: |-
          if (x.get_name().rfind("GW-", 0) == 0) {
            ESP_LOGI("ble_adv", "New Heltec/NEEY balancer found");
            ESP_LOGI("ble_adv", "  Name: %s", x.get_name().c_str());
            ESP_LOGI("ble_adv", "  MAC address: %s", x.address_str().c_str());
            ESP_LOGD("ble_adv", "  Advertised service UUIDs:");
            for (auto uuid : x.get_service_uuids()) {
              ESP_LOGD("ble_adv", "    - %s", uuid.to_string().c_str());
            }
          }

ble_client:
  - mac_address: ${mac_address}
    id: client0
  - mac_address: ${mac_address2}
    id: client1

heltec_balancer_ble:
  - ble_client_id: client0
    throttle: 5s
    id: NEEY1
  - ble_client_id: client1
    throttle: 5s
    id: NEEY2

binary_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    balancing:
      name: "${device0} balancing"
    online_status:
      name: "${device0} online status"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    balancing:
      name: "${device1} balancing"
    online_status:
      name: "${device1} online status"


button:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    retrieve_settings:
      name: "${device0} retrieve settings"
    retrieve_device_info:
      name: "${device0} retrieve device info"
    retrieve_factory_defaults:
      name: "${device0} retrieve factory defaults"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    retrieve_settings:
      name: "${device1} retrieve settings"
    retrieve_device_info:
      name: "${device1} retrieve device info"
    retrieve_factory_defaults:
      name: "${device1} retrieve factory defaults"

number:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    cell_count:
      name: "${device0} cell count"
    balance_trigger_voltage:
      name: "${device0} balance trigger voltage"
    max_balance_current:
      name: "${device0} max balance current"
    balance_sleep_voltage:
      name: "${device0} balance sleep voltage"
    balance_start_voltage:
      name: "${device0} balance start voltage"
    nominal_battery_capacity:
      name: "${device0} nominal battery capacity"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    cell_count:
      name: "${device1} cell count"
    balance_trigger_voltage:
      name: "${device1} balance trigger voltage"
    max_balance_current:
      name: "${device1} max balance current"
    balance_sleep_voltage:
      name: "${device1} balance sleep voltage"
    balance_start_voltage:
      name: "${device1} balance start voltage"
    nominal_battery_capacity:
      name: "${device1} nominal battery capacity"

sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    min_cell_voltage:
      name: "${device0} min cell voltage"
    max_cell_voltage:
      name: "${device0} max cell voltage"
    min_voltage_cell:
      name: "${device0} min voltage cell"
    max_voltage_cell:
      name: "${device0} max voltage cell"
    delta_cell_voltage:
      name: "${device0} delta cell voltage"
    average_cell_voltage:
      name: "${device0} average cell voltage"
    cell_voltage_1:
      name: "${device0} cell voltage 1"
    cell_voltage_2:
      name: "${device0} cell voltage 2"
    cell_voltage_3:
      name: "${device0} cell voltage 3"
    cell_voltage_4:
      name: "${device0} cell voltage 4"
    cell_voltage_5:
      name: "${device0} cell voltage 5"
    cell_voltage_6:
      name: "${device0} cell voltage 6"
    cell_voltage_7:
      name: "${device0} cell voltage 7"
    cell_voltage_8:
      name: "${device0} cell voltage 8"
    cell_voltage_9:
      name: "${device0} cell voltage 9"
    cell_voltage_10:
      name: "${device0} cell voltage 10"
    cell_voltage_11:
      name: "${device0} cell voltage 11"
    cell_voltage_12:
      name: "${device0} cell voltage 12"
    cell_voltage_13:
      name: "${device0} cell voltage 13"
    cell_voltage_14:
      name: "${device0} cell voltage 14"
    cell_voltage_15:
      name: "${device0} cell voltage 15"
    cell_voltage_16:
      name: "${device0} cell voltage 16"
    cell_voltage_17:
      name: "${device0} cell voltage 17"
    cell_voltage_18:
      name: "${device0} cell voltage 18"
    cell_voltage_19:
      name: "${device0} cell voltage 19"
    cell_voltage_20:
      name: "${device0} cell voltage 20"
    cell_voltage_21:
      name: "${device0} cell voltage 21"
    cell_voltage_22:
      name: "${device0} cell voltage 22"
    cell_voltage_23:
      name: "${device0} cell voltage 23"
    cell_voltage_24:
      name: "${device0} cell voltage 24"
    cell_resistance_1:
      name: "${device0} cell resistance 1"
    cell_resistance_2:
      name: "${device0} cell resistance 2"
    cell_resistance_3:
      name: "${device0} cell resistance 3"
    cell_resistance_4:
      name: "${device0} cell resistance 4"
    cell_resistance_5:
      name: "${device0} cell resistance 5"
    cell_resistance_6:
      name: "${device0} cell resistance 6"
    cell_resistance_7:
      name: "${device0} cell resistance 7"
    cell_resistance_8:
      name: "${device0} cell resistance 8"
    cell_resistance_9:
      name: "${device0} cell resistance 9"
    cell_resistance_10:
      name: "${device0} cell resistance 10"
    cell_resistance_11:
      name: "${device0} cell resistance 11"
    cell_resistance_12:
      name: "${device0} cell resistance 12"
    cell_resistance_13:
      name: "${device0} cell resistance 13"
    cell_resistance_14:
      name: "${device0} cell resistance 14"
    cell_resistance_15:
      name: "${device0} cell resistance 15"
    cell_resistance_16:
      name: "${device0} cell resistance 16"
    cell_resistance_17:
      name: "${device0} cell resistance 17"
    cell_resistance_18:
      name: "${device0} cell resistance 18"
    cell_resistance_19:
      name: "${device0} cell resistance 19"
    cell_resistance_20:
      name: "${device0} cell resistance 20"
    cell_resistance_21:
      name: "${device0} cell resistance 21"
    cell_resistance_22:
      name: "${device0} cell resistance 22"
    cell_resistance_23:
      name: "${device0} cell resistance 23"
    cell_resistance_24:
      name: "${device0} cell resistance 24"
    total_voltage:
      name: "${device0} total voltage"
    temperature_sensor_1:
      name: "${device0} temperature sensor 1"
    temperature_sensor_2:
      name: "${device0} temperature sensor 2"
    total_runtime:
      name: "${device0} total runtime"
    balancing_current:
      name: "${device0} balancing current"
    # Not implemented
    # errors_bitmask:
    #   name: "${device0} errors bitmask"
    cell_detection_failed_bitmask:
      name: "${device0} cell detection failed bitmask"
    cell_overvoltage_bitmask:
      name: "${device0} cell overvoltage bitmask"
    cell_undervoltage_bitmask:
      name: "${device0} cell undervoltage bitmask"
    cell_polarity_error_bitmask:
      name: "${device0} cell polarity error bitmask"
    cell_excessive_line_resistance_bitmask:
      name: "${device0} cell excessive line resistance bitmask"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    min_cell_voltage:
      name: "${device1} min cell voltage"
    max_cell_voltage:
      name: "${device1} max cell voltage"
    min_voltage_cell:
      name: "${device1} min voltage cell"
    max_voltage_cell:
      name: "${device1} max voltage cell"
    delta_cell_voltage:
      name: "${device1} delta cell voltage"
    average_cell_voltage:
      name: "${device1} average cell voltage"
    cell_voltage_1:
      name: "${device1} cell voltage 1"
    cell_voltage_2:
      name: "${device1} cell voltage 2"
    cell_voltage_3:
      name: "${device1} cell voltage 3"
    cell_voltage_4:
      name: "${device1} cell voltage 4"
    cell_voltage_5:
      name: "${device1} cell voltage 5"
    cell_voltage_6:
      name: "${device1} cell voltage 6"
    cell_voltage_7:
      name: "${device1} cell voltage 7"
    cell_voltage_8:
      name: "${device1} cell voltage 8"
    cell_voltage_9:
      name: "${device1} cell voltage 9"
    cell_voltage_10:
      name: "${device1} cell voltage 10"
    cell_voltage_11:
      name: "${device1} cell voltage 11"
    cell_voltage_12:
      name: "${device1} cell voltage 12"
    cell_voltage_13:
      name: "${device1} cell voltage 13"
    cell_voltage_14:
      name: "${device1} cell voltage 14"
    cell_voltage_15:
      name: "${device1} cell voltage 15"
    cell_voltage_16:
      name: "${device1} cell voltage 16"
    cell_voltage_17:
      name: "${device1} cell voltage 17"
    cell_voltage_18:
      name: "${device1} cell voltage 18"
    cell_voltage_19:
      name: "${device1} cell voltage 19"
    cell_voltage_20:
      name: "${device1} cell voltage 20"
    cell_voltage_21:
      name: "${device1} cell voltage 21"
    cell_voltage_22:
      name: "${device1} cell voltage 22"
    cell_voltage_23:
      name: "${device1} cell voltage 23"
    cell_voltage_24:
      name: "${device1} cell voltage 24"
    cell_resistance_1:
      name: "${device1} cell resistance 1"
    cell_resistance_2:
      name: "${device1} cell resistance 2"
    cell_resistance_3:
      name: "${device1} cell resistance 3"
    cell_resistance_4:
      name: "${device1} cell resistance 4"
    cell_resistance_5:
      name: "${device1} cell resistance 5"
    cell_resistance_6:
      name: "${device1} cell resistance 6"
    cell_resistance_7:
      name: "${device1} cell resistance 7"
    cell_resistance_8:
      name: "${device1} cell resistance 8"
    cell_resistance_9:
      name: "${device1} cell resistance 9"
    cell_resistance_10:
      name: "${device1} cell resistance 10"
    cell_resistance_11:
      name: "${device1} cell resistance 11"
    cell_resistance_12:
      name: "${device1} cell resistance 12"
    cell_resistance_13:
      name: "${device1} cell resistance 13"
    cell_resistance_14:
      name: "${device1} cell resistance 14"
    cell_resistance_15:
      name: "${device1} cell resistance 15"
    cell_resistance_16:
      name: "${device1} cell resistance 16"
    cell_resistance_17:
      name: "${device1} cell resistance 17"
    cell_resistance_18:
      name: "${device1} cell resistance 18"
    cell_resistance_19:
      name: "${device1} cell resistance 19"
    cell_resistance_20:
      name: "${device1} cell resistance 20"
    cell_resistance_21:
      name: "${device1} cell resistance 21"
    cell_resistance_22:
      name: "${device1} cell resistance 22"
    cell_resistance_23:
      name: "${device1} cell resistance 23"
    cell_resistance_24:
      name: "${device1} cell resistance 24"
    total_voltage:
      name: "${device1} total voltage"
    temperature_sensor_1:
      name: "${device1} temperature sensor 1"
    temperature_sensor_2:
      name: "${device1} temperature sensor 2"
    total_runtime:
      name: "${device1} total runtime"
    balancing_current:
      name: "${device1} balancing current"
    # Not implemented
    # errors_bitmask:
    #   name: "${device1} errors bitmask"
    cell_detection_failed_bitmask:
      name: "${device1} cell detection failed bitmask"
    cell_overvoltage_bitmask:
      name: "${device1} cell overvoltage bitmask"
    cell_undervoltage_bitmask:
      name: "${device1} cell undervoltage bitmask"
    cell_polarity_error_bitmask:
      name: "${device1} cell polarity error bitmask"
    cell_excessive_line_resistance_bitmask:
      name: "${device1} cell excessive line resistance bitmask"

switch:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    balancer:
      name: "${device0} balancer"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    balancer:
      name: "${device1} balancer"


text_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    # Not implemented
    # errors:
    #   name: "${device0} errors"
    operation_status:
      name: "${device0} operation status"
    total_runtime_formatted:
      name: "${device0} total runtime formatted"
    buzzer_mode:
      name: "${device0} buzzer mode"
    battery_type:
      name: "${device0} battery type"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    # Not implemented
    # errors:
    #   name: "${device1} errors"
    operation_status:
      name: "${device1} operation status"
    total_runtime_formatted:
      name: "${device1} total runtime formatted"
    buzzer_mode:
      name: "${device1} buzzer mode"
    battery_type:
      name: "${device1} battery type"

interval:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    interval: "${device0} 30min"
    then:
      - button.press: retrieve_settings_button

@syssi
Copy link
Owner

syssi commented May 14, 2023

Could you rephrase your last question? What's the detail you are trying to improve? If you want to reduce the amount of traffic passed to the MQTT server you should use the throttle option.

Oh, I got it. I will provide a proper interval section later the day. The interval key accepts time intervals only like 10min or 3h. The ${deivce0} variable/substitution is wrong here. As next step the two retrieve settings buttons must get a unique identifier.

@syssi
Copy link
Owner

syssi commented May 14, 2023

substitutions:
  name: heltec-balancer
  device0: NEEY1
  device1: NEEY2
  device_description: "Monitor and control a Heltec/NEEY 4A balancer via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: 00:E4:4C:xx:xx:xx
  mac_address2: 00:E4:4C:xx:xx:xx

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp32:
  board: az-delivery-devkit-v4
  framework:
    type: esp-idf

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

ota:

logger:
  level: DEBUG

# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
api:

mqtt:
  broker: 192.168.178.48
  username: pi
  password: xxxxxxxxx
#  id: 

esp32_ble_tracker:

ble_client:
  - mac_address: ${mac_address}
    id: client0
  - mac_address: ${mac_address2}
    id: client1

heltec_balancer_ble:
  - ble_client_id: client0
    throttle: 5s
    id: NEEY1
  - ble_client_id: client1
    throttle: 5s
    id: NEEY2

button:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    retrieve_settings:
      name: "${device0} retrieve settings"
      id: neey0_retrieve_settings_button
    retrieve_device_info:
      name: "${device0} retrieve device info"
    retrieve_factory_defaults:
      name: "${device0} retrieve factory defaults"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    retrieve_settings:
      name: "${device1} retrieve settings"
      id: neey1_retrieve_settings_button
    retrieve_device_info:
      name: "${device1} retrieve device info"
    retrieve_factory_defaults:
      name: "${device1} retrieve factory defaults"

interval:
  - interval: 30min
    then:
      - button.press: neey0_retrieve_settings_button
      - button.press: neey1_retrieve_settings_button

@syssi syssi closed this as completed May 14, 2023
@moscito1010
Copy link
Author

moscito1010 commented May 14, 2023

that doesn't seem to have been the case.
Here the error message

`andy@andy:~/esphome$ ~/.local/bin/esphome run esp32-heltec-balancer-ble-example.yaml
INFO Reading configuration esp32-heltec-balancer-ble-example.yaml...
INFO Updating https://github.com/syssi/esphome-jk-bms.git@main
Failed config

interval: [source esp32-heltec-balancer-ble-example.yaml:381]

  • interval: 30min
    then:
    • button.press:

      Couldn't find ID 'neey0_retrieve_settings_button'. Please check you have defined an ID with that name in your configuration.
      id: neey0_retrieve_settings_button

    • button.press:

      Couldn't find ID 'neey1_retrieve_settings_button'. Please check you have defined an ID with that name in your configuration.
      id: neey1_retrieve_settings_button
      `

@syssi
Copy link
Owner

syssi commented May 14, 2023

Did you update the two button entities above? Please make sure to assign ids here. Please provide your full YAML if you are unsure.

@moscito1010
Copy link
Author

moscito1010 commented May 14, 2023

here the code

substitutions:
  name: heltec-balancer
  device0: NEEY0
  device1: NEEY1
#  device2: NEEY2
  device_description: "Monitor and control a Heltec/NEEY 4A balancer via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: 00:E4:4C:xx:xx:xx
  mac_address2: 00:E4:4C:xx:xx:xx

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp32:
  board: az-delivery-devkit-v4
#  board: esp32cam
  framework:
    type: esp-idf

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

ota:

logger:
  level: DEBUG

# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
api:

mqtt:
  broker: 192.168.178.48
  username: pi
  password: XXXXXXXXX
#  id: 

esp32_ble_tracker:
  on_ble_advertise:
    then:
      - lambda: |-
          if (x.get_name().rfind("GW-", 0) == 0) {
            ESP_LOGI("ble_adv", "New Heltec/NEEY balancer found");
            ESP_LOGI("ble_adv", "  Name: %s", x.get_name().c_str());
            ESP_LOGI("ble_adv", "  MAC address: %s", x.address_str().c_str());
            ESP_LOGD("ble_adv", "  Advertised service UUIDs:");
            for (auto uuid : x.get_service_uuids()) {
              ESP_LOGD("ble_adv", "    - %s", uuid.to_string().c_str());
            }
          }

ble_client:
  - mac_address: ${mac_address}
    id: client0
  - mac_address: ${mac_address2}
    id: client1

heltec_balancer_ble:
  - ble_client_id: client0
    throttle: 15s
    id: NEEY0
  - ble_client_id: client1
    throttle: 15s
    id: NEEY1

binary_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    balancing:
      name: "${device0} balancing"
    online_status:
      name: "${device0} online status"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    balancing:
      name: "${device1} balancing"
    online_status:
      name: "${device1} online status"


button:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    retrieve_settings:
      name: "${device0} retrieve settings"
    retrieve_device_info:
      name: "${device0} retrieve device info"
    retrieve_factory_defaults:
      name: "${device0} retrieve factory defaults"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    retrieve_settings:
      name: "${device1} retrieve settings"
    retrieve_device_info:
      name: "${device1} retrieve device info"
    retrieve_factory_defaults:
      name: "${device1} retrieve factory defaults"

number:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    cell_count:
      name: "${device0} cell count"
    balance_trigger_voltage:
      name: "${device0} balance trigger voltage"
    max_balance_current:
      name: "${device0} max balance current"
    balance_sleep_voltage:
      name: "${device0} balance sleep voltage"
    balance_start_voltage:
      name: "${device0} balance start voltage"
    nominal_battery_capacity:
      name: "${device0} nominal battery capacity"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    cell_count:
      name: "${device1} cell count"
    balance_trigger_voltage:
      name: "${device1} balance trigger voltage"
    max_balance_current:
      name: "${device1} max balance current"
    balance_sleep_voltage:
      name: "${device1} balance sleep voltage"
    balance_start_voltage:
      name: "${device1} balance start voltage"
    nominal_battery_capacity:
      name: "${device1} nominal battery capacity"

sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    min_cell_voltage:
      name: "${device0} min cell voltage"
    max_cell_voltage:
      name: "${device0} max cell voltage"
    min_voltage_cell:
      name: "${device0} min voltage cell"
    max_voltage_cell:
      name: "${device0} max voltage cell"
    delta_cell_voltage:
      name: "${device0} delta cell voltage"
    average_cell_voltage:
      name: "${device0} average cell voltage"
    cell_voltage_1:
      name: "${device0} cell voltage 1"
    cell_voltage_2:
      name: "${device0} cell voltage 2"
    cell_voltage_3:
      name: "${device0} cell voltage 3"
    cell_voltage_4:
      name: "${device0} cell voltage 4"
    cell_voltage_5:
      name: "${device0} cell voltage 5"
    cell_voltage_6:
      name: "${device0} cell voltage 6"
    cell_voltage_7:
      name: "${device0} cell voltage 7"
    cell_voltage_8:
      name: "${device0} cell voltage 8"
    cell_voltage_9:
      name: "${device0} cell voltage 9"
    cell_voltage_10:
      name: "${device0} cell voltage 10"
    cell_voltage_11:
      name: "${device0} cell voltage 11"
    cell_voltage_12:
      name: "${device0} cell voltage 12"
    cell_voltage_13:
      name: "${device0} cell voltage 13"
    cell_voltage_14:
      name: "${device0} cell voltage 14"
    cell_voltage_15:
      name: "${device0} cell voltage 15"
    cell_voltage_16:
      name: "${device0} cell voltage 16"
    cell_resistance_1:
      name: "${device0} cell resistance 1"
    cell_resistance_2:
      name: "${device0} cell resistance 2"
    cell_resistance_3:
      name: "${device0} cell resistance 3"
    cell_resistance_4:
      name: "${device0} cell resistance 4"
    cell_resistance_5:
      name: "${device0} cell resistance 5"
    cell_resistance_6:
      name: "${device0} cell resistance 6"
    cell_resistance_7:
      name: "${device0} cell resistance 7"
    cell_resistance_8:
      name: "${device0} cell resistance 8"
    cell_resistance_9:
      name: "${device0} cell resistance 9"
    cell_resistance_10:
      name: "${device0} cell resistance 10"
    cell_resistance_11:
      name: "${device0} cell resistance 11"
    cell_resistance_12:
      name: "${device0} cell resistance 12"
    cell_resistance_13:
      name: "${device0} cell resistance 13"
    cell_resistance_14:
      name: "${device0} cell resistance 14"
    cell_resistance_15:
      name: "${device0} cell resistance 15"
    cell_resistance_16:
      name: "${device0} cell resistance 16"
    total_voltage:
      name: "${device0} total voltage"
    temperature_sensor_1:
      name: "${device0} temperature sensor 1"
    temperature_sensor_2:
      name: "${device0} temperature sensor 2"
    total_runtime:
      name: "${device0} total runtime"
    balancing_current:
      name: "${device0} balancing current"
    # Not implemented
    # errors_bitmask:
    #   name: "${device0} errors bitmask"
    cell_detection_failed_bitmask:
      name: "${device0} cell detection failed bitmask"
    cell_overvoltage_bitmask:
      name: "${device0} cell overvoltage bitmask"
    cell_undervoltage_bitmask:
      name: "${device0} cell undervoltage bitmask"
    cell_polarity_error_bitmask:
      name: "${device0} cell polarity error bitmask"
    cell_excessive_line_resistance_bitmask:
      name: "${device0} cell excessive line resistance bitmask"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    min_cell_voltage:
      name: "${device1} min cell voltage"
    max_cell_voltage:
      name: "${device1} max cell voltage"
    min_voltage_cell:
      name: "${device1} min voltage cell"
    max_voltage_cell:
      name: "${device1} max voltage cell"
    delta_cell_voltage:
      name: "${device1} delta cell voltage"
    average_cell_voltage:
      name: "${device1} average cell voltage"
    cell_voltage_1:
      name: "${device1} cell voltage 1"
    cell_voltage_2:
      name: "${device1} cell voltage 2"
    cell_voltage_3:
      name: "${device1} cell voltage 3"
    cell_voltage_4:
      name: "${device1} cell voltage 4"
    cell_voltage_5:
      name: "${device1} cell voltage 5"
    cell_voltage_6:
      name: "${device1} cell voltage 6"
    cell_voltage_7:
      name: "${device1} cell voltage 7"
    cell_voltage_8:
      name: "${device1} cell voltage 8"
    cell_voltage_9:
      name: "${device1} cell voltage 9"
    cell_voltage_10:
      name: "${device1} cell voltage 10"
    cell_voltage_11:
      name: "${device1} cell voltage 11"
    cell_voltage_12:
      name: "${device1} cell voltage 12"
    cell_voltage_13:
      name: "${device1} cell voltage 13"
    cell_voltage_14:
      name: "${device1} cell voltage 14"
    cell_voltage_15:
      name: "${device1} cell voltage 15"
    cell_voltage_16:
      name: "${device1} cell voltage 16"
    cell_resistance_1:
      name: "${device1} cell resistance 1"
    cell_resistance_2:
      name: "${device1} cell resistance 2"
    cell_resistance_3:
      name: "${device1} cell resistance 3"
    cell_resistance_4:
      name: "${device1} cell resistance 4"
    cell_resistance_5:
      name: "${device1} cell resistance 5"
    cell_resistance_6:
      name: "${device1} cell resistance 6"
    cell_resistance_7:
      name: "${device1} cell resistance 7"
    cell_resistance_8:
      name: "${device1} cell resistance 8"
    cell_resistance_9:
      name: "${device1} cell resistance 9"
    cell_resistance_10:
      name: "${device1} cell resistance 10"
    cell_resistance_11:
      name: "${device1} cell resistance 11"
    cell_resistance_12:
      name: "${device1} cell resistance 12"
    cell_resistance_13:
      name: "${device1} cell resistance 13"
    cell_resistance_14:
      name: "${device1} cell resistance 14"
    cell_resistance_15:
      name: "${device1} cell resistance 15"
    cell_resistance_16:
      name: "${device1} cell resistance 16"
    total_voltage:
      name: "${device1} total voltage"
    temperature_sensor_1:
      name: "${device1} temperature sensor 1"
    temperature_sensor_2:
      name: "${device1} temperature sensor 2"
    total_runtime:
      name: "${device1} total runtime"
    balancing_current:
      name: "${device1} balancing current"
    # Not implemented
    # errors_bitmask:
    #   name: "${device1} errors bitmask"
    cell_detection_failed_bitmask:
      name: "${device1} cell detection failed bitmask"
    cell_overvoltage_bitmask:
      name: "${device1} cell overvoltage bitmask"
    cell_undervoltage_bitmask:
      name: "${device1} cell undervoltage bitmask"
    cell_polarity_error_bitmask:
      name: "${device1} cell polarity error bitmask"
    cell_excessive_line_resistance_bitmask:
      name: "${device1} cell excessive line resistance bitmask"

switch:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    balancer:
      name: "${device0} balancer"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    balancer:
      name: "${device1} balancer"


text_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY0
    # Not implemented
    # errors:
    #   name: "${device0} errors"
    operation_status:
      name: "${device0} operation status"
    total_runtime_formatted:
      name: "${device0} total runtime formatted"
    buzzer_mode:
      name: "${device0} buzzer mode"
    battery_type:
      name: "${device0} battery type"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    # Not implemented
    # errors:
    #   name: "${device1} errors"
    operation_status:
      name: "${device1} operation status"
    total_runtime_formatted:
      name: "${device1} total runtime formatted"
    buzzer_mode:
      name: "${device1} buzzer mode"
    battery_type:
      name: "${device1} battery type"


interval:
  - interval: 30min
    then:
      - button.press: neey0_retrieve_settings_button
      - button.press: neey1_retrieve_settings_button

@syssi
Copy link
Owner

syssi commented May 15, 2023

Please add these lines to your config:

button:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY1
    retrieve_settings:
      name: "${device0} retrieve settings"
      id: neey0_retrieve_settings_button        # <-----------------
    retrieve_device_info:
      name: "${device0} retrieve device info"
    retrieve_factory_defaults:
      name: "${device0} retrieve factory defaults"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: NEEY2
    retrieve_settings:
      name: "${device1} retrieve settings"
      id: neey1_retrieve_settings_button        # <-----------------
    retrieve_device_info:
      name: "${device1} retrieve device info"
    retrieve_factory_defaults:
      name: "${device1} retrieve factory defaults"

@physi
Copy link

physi commented May 16, 2023

I had the same problem, and disable the
api:
Section solves it, now I see values for 2 Neey in MQ

@moscito1010
Copy link
Author

the just api: commented out?

#api:
?

2 things struck me.
I don't need to press boot button to flash, but only when I flash the yaml file for 2 BMS. If I use the "single" script I have to press the button.
You cannot change the battery type in Homeassistant.

@physi
Copy link

physi commented May 17, 2023

Yes,
# api:

, but the you got no homeassistant "things" .
But that was unstable too, the esp lost contact to both neey this night and does not report anything anymore. Before I had only 1 neey and all worked perfectly good.
So I will invest another esp for each neey, that can than also monitor the temperature of each block.

Or if you get it stable up and running, pleas share your code :-)

@syssi
Copy link
Owner

syssi commented May 17, 2023

api enabled or not shouldnt make a difference in general. It looks like a resource issue. Please try to free some resources by removing unimportant/unused components and/or entities.

@physi
Copy link

physi commented May 17, 2023

tried it with only the voltages from 1-16 on 2 Neeys, does not work, maybe to much to work for one poor ESP :-)
Will use separate Esp for each bank, that works.
Thanks for your nice work on this.

@Elektrofix-OL
Copy link

Elektrofix-OL commented Nov 3, 2023

I have the same problem and have now gone back to ESPHome version 2023.5.4, but after an indefinite period of time (3 hours or 7 days) I no longer receive any data.
My Yamel:

substitutions:`
  name: speicher
  device0: akku1
  device1: akku2
  device_description: "Monitor and control a Heltec/NEEY 4A balancer via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: 00:e4:4c:21:d9:cd
  mac_address2: 3c:a5:51:85:e8:4c

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.4.0

esp32:
  board: esp32dev
  framework:
    type: esp-idf

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

ota:

logger:
  level: DEBUG
  
# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
#api:
#  encryption:
#    key: "q+W4YeOHnu8kOBLz0LYw7uUlWzzRE+NMk6CpfZE856k="

mqtt:
   broker: !secret mqtt_host
   username: !secret mqtt_username
   password: !secret mqtt_password
   id: mqtt_client

esp32_ble_tracker:
  on_ble_advertise:
    then:
      - lambda: |-
          if (x.get_name().rfind("GW-", 0) == 0) {
            ESP_LOGI("ble_adv", "New Heltec/NEEY balancer found");
            ESP_LOGI("ble_adv", "  Name: %s", x.get_name().c_str());
            ESP_LOGI("ble_adv", "  MAC address: %s", x.address_str().c_str());
            ESP_LOGD("ble_adv", "  Advertised service UUIDs:");
            for (auto uuid : x.get_service_uuids()) {
              ESP_LOGD("ble_adv", "    - %s", uuid.to_string().c_str());
            }
          }

ble_client:
  - mac_address: ${mac_address}
    id: client0
  - mac_address: ${mac_address2}
    id: client1

heltec_balancer_ble:
  - ble_client_id: client0
    throttle: 30s
    id: bms0
  - ble_client_id: client1
    throttle: 30s
    id: bms1

binary_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    balancing:
      name: "balancing ${device0}"
    online_status:
      name: "online status ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    balancing:
      name: "balancing ${device1}"
    online_status:
      name: "online status ${device1}"

button:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    retrieve_settings:
      name: "retrieve settings ${device0}"
      id: retrieve_settings_button0
    retrieve_device_info:
      name: "retrieve device info ${device0}"
    retrieve_factory_defaults:
      name: "retrieve factory defaults ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    retrieve_settings:
      name: "retrieve settings ${device1}"
      id: retrieve_settings_button1
    retrieve_device_info:
      name: "retrieve device info ${device1}"
    retrieve_factory_defaults:
      name: "retrieve factory defaults ${device1}"

number:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    cell_count:
      name: "cell count ${device0}"
    balance_trigger_voltage:
      name: "balance trigger voltage ${device0}"
    max_balance_current:
      name: "max balance current ${device0}"
    balance_sleep_voltage:
      name: "balance sleep voltage ${device0}"
    balance_start_voltage:
      name: "balance start voltage ${device0}"
    nominal_battery_capacity:
      name: "nominal battery capacity ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    cell_count:
      name: "cell count ${device1}"
    balance_trigger_voltage:
      name: "balance trigger voltage ${device1}"
    max_balance_current:
      name: "max balance current ${device1}"
    balance_sleep_voltage:
      name: "balance sleep voltage ${device1}"
    balance_start_voltage:
      name: "balance start voltage ${device1}"
    nominal_battery_capacity:
      name: "nominal battery capacity ${device1}"

sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    min_cell_voltage:
      name: "min cell voltage ${device0}"
    max_cell_voltage:
      name: "max cell voltage ${device0}"
    min_voltage_cell:
      name: "min voltage cell ${device0}"
    max_voltage_cell:
      name: "max voltage cell ${device0}"
    delta_cell_voltage:
      name: "delta cell voltage ${device0}"
    average_cell_voltage:
      name: "average cell voltage ${device0}"
    cell_voltage_1:
      name: "voltage 01 ${device0}"
    cell_voltage_2:
      name: "voltage 02 ${device0}"
    cell_voltage_3:
      name: "voltage 03 ${device0}"
    cell_voltage_4:
      name: "voltage 04 ${device0}"
    cell_voltage_5:
      name: "voltage 05 ${device0}"
    cell_voltage_6:
      name: "voltage 06 ${device0}"
    cell_voltage_7:
      name: "voltage 07 ${device0}"
    cell_voltage_8:
      name: "voltage 08 ${device0}"
    cell_voltage_9:
      name: "voltage 09 ${device0}"
    cell_voltage_10:
      name: "voltage 10 ${device0}"
    cell_voltage_11:
      name: "voltage 11 ${device0}"
    cell_voltage_12:
      name: "voltage 12 ${device0}"
    cell_voltage_13:
      name: "voltage 13 ${device0}"
    cell_voltage_14:
      name: "voltage 14 ${device0}"
    cell_voltage_15:
      name: "voltage 15 ${device0}"
    cell_voltage_16:
      name: "voltage 16 ${device0}"
    cell_resistance_1:
      name: "resistance 01 ${device0}"
    cell_resistance_2:
      name: "resistance 02 ${device0}"
    cell_resistance_3:
      name: "resistance 03 ${device0}"
    cell_resistance_4:
      name: "resistance 04 ${device0}"
    cell_resistance_5:
      name: "resistance 05 ${device0}"
    cell_resistance_6:
      name: "resistance 06 ${device0}"
    cell_resistance_7:
      name: "resistance 07 ${device0}"
    cell_resistance_8:
      name: "resistance 08 ${device0}"
    cell_resistance_9:
      name: "resistance 09 ${device0}"
    cell_resistance_10:
      name: "resistance 10 ${device0}"
    cell_resistance_11:
      name: "resistance 11 ${device0}"
    cell_resistance_12:
      name: "resistance 12 ${device0}"
    cell_resistance_13:
      name: "resistance 13 ${device0}"
    cell_resistance_14:
      name: "resistance 14 ${device0}"
    cell_resistance_15:
      name: "resistance 15 ${device0}"
    cell_resistance_16:
      name: "resistance 16 ${device0}"
    total_voltage:
      name: "total voltage ${device0}"
    temperature_sensor_1:
      name: "temperature sensor 1 ${device0}"
    temperature_sensor_2:
      name: "temperature sensor 2 ${device0}"
    total_runtime:
      name: "total runtime ${device0}"
    balancing_current:
      name: "balancing current ${device0}"
    # Not implemented
    # errors_bitmask:
    #   name: "errors bitmask ${device0}"
    cell_detection_failed_bitmask:
      name: "cell detection failed bitmask ${device0}"
    cell_overvoltage_bitmask:
      name: "cell overvoltage bitmask ${device0}"
    cell_undervoltage_bitmask:
      name: "cell undervoltage bitmask ${device0}"
    cell_polarity_error_bitmask:
      name: "cell polarity error bitmask ${device0}"
    cell_excessive_line_resistance_bitmask:
      name: "cell excessive line resistance bitmask ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    min_cell_voltage:
      name: "min cell voltage ${device1}"
    max_cell_voltage:
      name: "max cell voltage ${device1}"
    min_voltage_cell:
      name: "min voltage cell ${device1}"
    max_voltage_cell:
      name: "max voltage cell ${device1}"
    delta_cell_voltage:
      name: "delta cell voltage ${device1}"
    average_cell_voltage:
      name: "average cell voltage ${device1}"
    cell_voltage_1:
      name: "voltage 01 ${device1}"
    cell_voltage_2:
      name: "voltage 02 ${device1}"
    cell_voltage_3:
      name: "voltage 03 ${device1}"
    cell_voltage_4:
      name: "voltage 04 ${device1}"
    cell_voltage_5:
      name: "voltage 05 ${device1}"
    cell_voltage_6:
      name: "voltage 06 ${device1}"
    cell_voltage_7:
      name: "voltage 07 ${device1}"
    cell_voltage_8:
      name: "voltage 08 ${device1}"
    cell_voltage_9:
      name: "voltage 09 ${device1}"
    cell_voltage_10:
      name: "voltage 10 ${device1}"
    cell_voltage_11:
      name: "voltage 11 ${device1}"
    cell_voltage_12:
      name: "voltage 12 ${device1}"
    cell_voltage_13:
      name: "voltage 13 ${device1}"
    cell_voltage_14:
      name: "voltage 14 ${device1}"
    cell_voltage_15:
      name: "voltage 15 ${device1}"
    cell_voltage_16:
      name: "voltage 16 ${device1}"
    cell_resistance_1:
      name: "resistance 01 ${device1}"
    cell_resistance_2:
      name: "resistance 02 ${device1}"
    cell_resistance_3:
      name: "resistance 03 ${device1}"
    cell_resistance_4:
      name: "resistance 04 ${device1}"
    cell_resistance_5:
      name: "resistance 05 ${device1}"
    cell_resistance_6:
      name: "resistance 06 ${device1}"
    cell_resistance_7:
      name: "resistance 07 ${device1}"
    cell_resistance_8:
      name: "resistance 08 ${device1}"
    cell_resistance_9:
      name: "resistance 09 ${device1}"
    cell_resistance_10:
      name: "resistance 10 ${device1}"
    cell_resistance_11:
      name: "resistance 11 ${device1}"
    cell_resistance_12:
      name: "resistance 12 ${device1}"
    cell_resistance_13:
      name: "resistance 13 ${device1}"
    cell_resistance_14:
      name: "resistance 14 ${device1}"
    cell_resistance_15:
      name: "resistance 15 ${device1}"
    cell_resistance_16:
      name: "resistance 16 ${device1}"
    total_voltage:
      name: "total voltage ${device1}"
    temperature_sensor_1:
      name: "temperature sensor 1 ${device1}"
    temperature_sensor_2:
      name: "temperature sensor 2 ${device1}"
    total_runtime:
      name: "total runtime ${device1}"
    balancing_current:
      name: "balancing current ${device1}"
    # Not implemented
    # errors_bitmask:
    #   name: "errors bitmask"
    cell_detection_failed_bitmask:
      name: "cell detection failed bitmask ${device1}"
    cell_overvoltage_bitmask:
      name: "cell overvoltage bitmask ${device1}"
    cell_undervoltage_bitmask:
      name: "cell undervoltage bitmask ${device1}"
    cell_polarity_error_bitmask:
      name: "cell polarity error bitmask ${device1}"
    cell_excessive_line_resistance_bitmask:
      name: "cell excessive line resistance bitmask ${device1}"


switch:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    balancer:
      name: "balancer ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    balancer:
      name: "balancer ${device1}"

text_sensor:
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms0
    # Not implemented
    # errors:
    #   name: "errors ${device0}"
    operation_status:
      name: "operation status ${device0}"
    total_runtime_formatted:
      name: "total runtime formatted ${device0}"
    buzzer_mode:
      name: "buzzer mode ${device0}"
    battery_type:
      name: "battery type ${device0}"
  - platform: heltec_balancer_ble
    heltec_balancer_ble_id: bms1
    # Not implemented
    # errors:
    #   name: "errors ${device1}"
    operation_status:
      name: "operation status ${device1}"
    total_runtime_formatted:
      name: "total runtime formatted ${device1}"
    buzzer_mode:
      name: "buzzer mode ${device1}"
    battery_type:
      name: "battery type ${device1}"

interval:
  - interval: 30min
    then:
      - button.press: retrieve_settings_button0
      - button.press: retrieve_settings_button1

The displays in the LOG:
image
Before time to time comes:
image
If I unplug the ESP32 and restart it, everything is OK. I've already changed the board, no success. What am I doing wrong?

@syssi
Copy link
Owner

syssi commented Nov 4, 2023

@Elektrofix-OL Could you create a new issue please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants