Hauptmenü

JK BMS

Begonnen von domo, 16 März 2024, 16:19:16

Vorheriges Thema - Nächstes Thema

Jamo

Hallo Ihr 2,
warum schreibt Ihr nicht in Englisch in der "English Corner"? Dann hat der User domo auch was davon.
Bullseye auf iNUC, Homematic + HMIP(UART/HMUSB), Debmatic, HUEBridge, Zigbee/ConbeeII, FB, Alexa (fhem-lazy), Livetracking, LaCrosse JeeLink, LoRaWan / TTN / Chirpstack

holle75

you are right, but writing/thinking in a language thats not your mother tongue is harder. Especially on topics that are more complicated than a relaxed conversation and having a tendency to get technical.
Anyways, i promise to write an english summary when the work is done .... so Gisbert and i can continue in german for a bit. Or i open up a new topic (which helps none of us, imho).

holle75

Gisbert, kurze Zwischenfrage: wo hattest du die Basis für deinen yaml file her? Ich bin schon relativ weit (Gott, was für ein gezicke dieses bin-file kompiliert zu bekommen) und will gerade auf der ESP32 Seite noch ein bißchen optimieren ... bevor ich mich an die Verbindung mache.

Gisbert

Hallo holle75,

den yaml-File hab ich aus dem Projekt von syssi auf GitHub. Es gibt da etliche Varianten, ich hab mich dann für diese entschieden und etwas auf meine Bedürfnisse angepasst.

Viele Grüße Gisbert
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | tuya local | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY | DEYE | JK-BMS | ESPHome

holle75

Ah jetzt, ich habe nur in dem Readme das Beispiel gefunden. IN den Files sollte man schauen ;)

holle75

#20
... weißt du noch, welcher file deine Basis war? Wenn ich das richtig überblicke, gibts da schon deutliche Unterschiede wie die Daten ausgelesen werden.... und vor allem die Frage (an mich) welche Basis dann für meinen ESP32 und BMS die Richtige ist.

EDIT: ok, gefunden -> esp32-example.yaml (erst denken, dann schreiben)

holle75

... ohoh, und woher wußtest du welchen PIN am Rs485 Stecker am BMS du mit GPIO17, GPIO16, GND verbinden musstest?
Muss ich wahrscheinlich das JK-BMS Manual durchforsten

holle75

Ich muss nochmal auf die physische Verbindung und die damit einhergehenden Einstellungen eingehen. Bei meinem JK-PB2A16S20P hat es

RS485|CAN|RS232|Rs485|RS485

im Panel.

Korrespondierend, wenn ich es richtig verstanden habe, kannst du in der App/Software UART Protokolle für 1 und 2 einstellen. Auf welche Ports die sich jetzt beziehen wäre interessant.

... und vor allem, welchen Port und welchen Pin hast du mit dem ESP32 verbunden?

CAN (zur Anlage) und die beiden rechten RS485 (wohl zum Verbinden mehrerer Batterien) sind wohl nicht für unseren Fall vorgesehen. Bleibt nur der linke RS485 und der mittlere RS232?

Gisbert

Hallo holle75,

mein Board ist deutlich einfacher aufgebaut. Die Beschreibung von syssi auf GitHub trifft genau zu:
ZitatThe UART-TTL (labeled as RS485) socket of the BMS can be attached to any UART pins of the ESP. A hardware UART should be preferred because of the high baudrate (115200 baud). The connector is called 4 Pin JST with 1.25mm pitch.

Am BMS hat dieser Stecker die Bezeichnung GPS/RS485.

Auch die App sieht bei mir anders aus, d.h. hier kann ich dir keinen Rat geben. In der App gibt es bei meinem BMS die Option bei Port Switch: CAN oder RS485 - sie steht bei mir auf CAN. Ich habe keine Signalverbindung zwischen meinem Wechselrichter und dem JK-BMS.

Versuche ein aussagekräftiges Dokument deines JK-BMS zu finden. Das müsste ein Dokument mit 50+ Seiten sein. Vielleicht ist da beschrieben, wie die PIN-Belegungen sind. Ansonsten müsstest du schauen, wie die PIN-Belegung eines RJ45-Steckers bei einer RS485-Schnittstelle aussieht.
Auf jeden Fall solltest du dann messen, welche Adern 3.3V gegen eine GND-Ader haben. Diese 3 Adern sollten dann mit dem ESP32 verbunden werden.

Ich hatte mir noch dieses Zubehörteil gekauft, dass ich aber dann gar nicht benötigt habe: https://www.nkon.nl/de/charger-84/bms-mod/accessoires/jk-485-converter-for-jk-bms-rs485-adapter-module.html. Falls du es benötigst, kannst du das gerne haben.

Viele Grüße Gisbert
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | tuya local | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY | DEYE | JK-BMS | ESPHome

Gisbert

Noch ein Hinweis: dieses Forum ist für PV und Akku möglicherweise nicht das beste. Es gibt noch das Akkudoktor-Forum und das Photovoltaik-Forum - vielleicht wurde da dein konkreter Aufbau schon mal behandelt.
Aktuelles FHEM | PROXMOX | Fujitsu Futro S740 | Debian 12 | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | tuya local | Wlan-Kamera | SIGNALduino, Flamingo Rauchmelder FA21/22RF | RHASSPY | DEYE | JK-BMS | ESPHome

holle75

Danke Gisbert, ja Akkudoktor Forum mag ich gerne. Habe da auch eine ähnliche Frage zur physischen Verbindung laufen. Das JK Manual zum BMS ist schon ok, nur genau zu den beschriebenen Punkten ein wenig "dünne". Will sagen, zumindest ich, finde einfach nicht raus, welcher Port/Einstellungen es denn jetzt genau wäre.

Tendenz mit den, ebenfalls dünnen, Infos aus anderen Foren bis jetzt ist der RS232 Port derjenige welcher genutzt werden könnte/sollte. Aber ich möchte mir ungern das BMS oder den ESP32 braten. Das sind die kleinen Details die nie jemand dediziert beschreibt weil scheinbar völlig klar ;) ... trotz wenn falsch, deutlichen Auswirkungen.

Zu "dem Teil" was du nicht benötigst: Auch ich habe genau das Teil gekauft und nicht benötigt ;) ... verstehen, was es genau macht oder wofür es gut wäre, tue ich auch nicht. Nach den Anschlüssen zu urteilen müsste man es aber intern nutzen.

holle75

#26
Die Zusammenfassung:

Es gibt ein git Projekt für die kabelgebundene Verbindung vom "neuen JK inverter BMS" -> https://github.com/txubelaxu/esphome-jk-bms
Dieses beschäftigt sich mit der RS485 Schnittstelle und man braucht für seinen ESP32 noch einen zusätzlichen RS485 Konverter.

Da ich mich als Unwissender erstmal nur mit dem von Gisbert verlinkten git Projekt -> https://github.com/syssi/esphome-jk-bms
auseinandergesetzt hatte, stand ich zwischenzeitlich ein wenig auf dem Schlauch.

Dann habe ich mich entschieden den Bluetooth Weg zu gehen.... und zweiteres git https://github.com/syssi/esphome-jk-bms
war wieder aktuell.

Ich muss jetzt mal für ein paar Wochen die Stabilität verfolgen, aber für den Anfang sieht das ziemlich gut aus. Alle Werte aus dem BMS laufen in fhem über MQTT2 (interner Server) auf.

Als erstes Gisberts Link zum flashen gefolgt -> https://smarthomeyourself.de/wiki/esphome/esphome-mit-python-ueber-die-kommandozeile-flashen/
hier zu beachten, dass der Install von Python bei mir nur final nutzbar über Windows-App-Install funktioniert hat. Hatte ich noch nie probiert, nervt, aber nur so gings.

Dann müssen noch irgendwelche Repos nachinstalliert werden. Vergessen. Die error messages beim ersten kompilieren zeigen aber auf, was fehlt.

Danach muss man im yaml file DEBUG mode anschalten, um an die MAC Adresse vom BMS zu kommen (wird dir wenn beim ESP32 eingeloggt in den Debugs gezeigt) . Danach mit der gefundenen MAC Adresse im yaml neu flashen. Ja, um drei Ecken ... vielleicht gibts einen besseren Weg.

dann autocreate in fhem´s MQTT2 Server (oder welchen du benutzt) an und die Sache rennt.

Mein yaml für hardware vers 15.x

substitutions:
  name: jk-bms
  device_description: "Monitor and control a JK-BMS v15 via bluetooth"
  external_components_source: github://syssi/esphome-jk-bms@main
  mac_address: C8:47:80:xx:xx:xx
  # Please use "JK02_24S" if you own a old JK-BMS < hardware version 11.0 (hardware version >= 6.0 and < 11.0)
  # Please use "JK02_32S" if you own a new JK-BMS >= hardware version 11.0 (f.e. JK-B2A8S20P hw 11.XW, sw 11.26)
  # Please use "JK04" if you have some old JK-BMS <= hardware version 3.0 (f.e. JK-B2A16S hw 3.0, sw. 3.3.0)
  protocol_version: JK02_32S

esphome:
  name: ${name}
  comment: ${device_description}
  min_version: 2024.6.0
  project:
    name: "syssi.esphome-jk-bms"
    version: 2.0.0
# this should match your ESP32 --- take care
esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

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

wifi:
  ssid: ssidxxxx
  password: passwordxxxx

# Optional manual IP - damit gelingt ein wireless update in Home Assistant und in ESPHome
# manual IP
  use_address: 192.168.1.70
  manual_ip:
    static_ip: 192.168.1.70
    gateway: 192.168.1.1
    subnet: 255.255.255.0

web_server:
  port: 80

ota:
  platform: esphome
  password: passowrdxxx
  on_begin:
    then:
      - switch.turn_off: ble_client_switch0
      - logger.log: "BLE connection suspended for OTA update"

# for the first run to find out the mac address of your BMS you need DEBUG instead of INFO
logger:
  level: INFO

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

mqtt:
  broker: 192.168.1.23
  port: 1883
  username: usernamexxx
  password: passwordxxx
  id: MQTT2_JK_BMS_Container_ESP32

esp32_ble_tracker:
  on_ble_advertise:
    then:
      - lambda: |-
          if (x.get_name().rfind("JK-", 0) == 0 || x.get_name().rfind("JK_", 0) == 0) {
            ESP_LOGI("ble_adv", "New JK-BMS 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

jk_bms_ble:
  - ble_client_id: client0
    protocol_version: ${protocol_version}
    throttle: 5s
    id: bms0

binary_sensor:
  - platform: jk_bms_ble
    balancing:
      name: "${name} balancing"
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"
    heating:
      name: "${name} heating"
    online_status:
      name: "${name} online status"

button:
  - platform: jk_bms_ble
    retrieve_settings:
      name: "${name} retrieve settings"
    retrieve_device_info:
      name: "${name} retrieve device info"

number:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    balance_trigger_voltage:
      name: "${name} balance trigger voltage"
    cell_count:
      name: "${name} cell count"
    total_battery_capacity:
      name: "${name} total battery capacity"
    cell_voltage_overvoltage_protection:
      name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
      name: "${name} cell voltage overvoltage recovery"
    cell_voltage_undervoltage_protection:
      name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
      name: "${name} cell voltage undervoltage recovery"
    balance_starting_voltage:
      name: "${name} balance starting voltage"
    voltage_calibration:
      name: "${name} voltage calibration"
    current_calibration:
      name: "${name} current calibration"
    power_off_voltage:
      name: "${name} power off voltage"
    max_balance_current:
      name: "${name} max balance current"
    max_charge_current:
      name: "${name} max charge current"
    max_discharge_current:
      name: "${name} max discharge current"
    smart_sleep_voltage:
      name: "${name} smart sleep voltage"
    cell_soc100_voltage:
      name: "${name} cell soc100 voltage"
    cell_soc0_voltage:
      name: "${name} cell soc0 voltage"
    cell_request_charge_voltage:
      name: "${name} cell request charge voltage"
    cell_request_float_voltage:
      name: "${name} cell request float voltage"

sensor:
  - platform: jk_bms_ble
    jk_bms_ble_id: bms0
    min_cell_voltage:
      name: "${name} min cell voltage"
    max_cell_voltage:
      name: "${name} max cell voltage"
    min_voltage_cell:
      name: "${name} min voltage cell"
    max_voltage_cell:
      name: "${name} max voltage cell"
    delta_cell_voltage:
      name: "${name} delta cell voltage"
    average_cell_voltage:
      name: "${name} average cell voltage"
    cell_voltage_1:
      name: "${name} cell voltage 1"
    cell_voltage_2:
      name: "${name} cell voltage 2"
    cell_voltage_3:
      name: "${name} cell voltage 3"
    cell_voltage_4:
      name: "${name} cell voltage 4"
    cell_voltage_5:
      name: "${name} cell voltage 5"
    cell_voltage_6:
      name: "${name} cell voltage 6"
    cell_voltage_7:
      name: "${name} cell voltage 7"
    cell_voltage_8:
      name: "${name} cell voltage 8"
#    cell_voltage_9:
#      name: "${name} cell voltage 9"
#    cell_voltage_10:
#      name: "${name} cell voltage 10"
#    cell_voltage_11:
#      name: "${name} cell voltage 11"
#    cell_voltage_12:
#     name: "${name} cell voltage 12"
#    cell_voltage_13:
#      name: "${name} cell voltage 13"
#    cell_voltage_14:
#      name: "${name} cell voltage 14"
#    cell_voltage_15:
#      name: "${name} cell voltage 15"
#    cell_voltage_16:
#      name: "${name} cell voltage 16"
#    cell_voltage_17:
#      name: "${name} cell voltage 17"
#    cell_voltage_18:
#      name: "${name} cell voltage 18"
#    cell_voltage_19:
#      name: "${name} cell voltage 19"
#    cell_voltage_20:
#      name: "${name} cell voltage 20"
#    cell_voltage_21:
#      name: "${name} cell voltage 21"
#    cell_voltage_22:
#      name: "${name} cell voltage 22"
#    cell_voltage_23:
#      name: "${name} cell voltage 23"
#    cell_voltage_24:
#      name: "${name} cell voltage 24"
#    cell_resistance_1:
#      name: "${name} cell resistance 1"
#    cell_resistance_2:
#      name: "${name} cell resistance 2"
#    cell_resistance_3:
#      name: "${name} cell resistance 3"
#    cell_resistance_4:
#      name: "${name} cell resistance 4"
#    cell_resistance_5:
#      name: "${name} cell resistance 5"
#    cell_resistance_6:
#      name: "${name} cell resistance 6"
#    cell_resistance_7:
#      name: "${name} cell resistance 7"
#    cell_resistance_8:
#      name: "${name} cell resistance 8"
#    cell_resistance_9:
#      name: "${name} cell resistance 9"
#    cell_resistance_10:
#      name: "${name} cell resistance 10"
#    cell_resistance_11:
#      name: "${name} cell resistance 11"
#    cell_resistance_12:
#      name: "${name} cell resistance 12"
#    cell_resistance_13:
#      name: "${name} cell resistance 13"
#    cell_resistance_14:
#      name: "${name} cell resistance 14"
#    cell_resistance_15:
#      name: "${name} cell resistance 15"
#    cell_resistance_16:
#      name: "${name} cell resistance 16"
#    cell_resistance_17:
#      name: "${name} cell resistance 17"
#    cell_resistance_18:
#      name: "${name} cell resistance 18"
#    cell_resistance_19:
#      name: "${name} cell resistance 19"
#    cell_resistance_20:
#      name: "${name} cell resistance 20"
#    cell_resistance_21:
#      name: "${name} cell resistance 21"
#    cell_resistance_22:
#      name: "${name} cell resistance 22"
#    cell_resistance_23:
#      name: "${name} cell resistance 23"
#    cell_resistance_24:
#      name: "${name} cell resistance 24"
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    heating_current:
      name: "${name} heating current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    temperature_sensor_1:
      name: "${name} temperature sensor 1"
    temperature_sensor_2:
      name: "${name} temperature sensor 2"
    temperature_sensor_3:
      name: "${name} temperature sensor 3"
    temperature_sensor_4:
      name: "${name} temperature sensor 4"
    temperature_sensor_5:
      name: "${name} temperature sensor 5"
    power_tube_temperature:
      name: "${name} power tube temperature"
    balancing:
      name: "${name} balancing"
    state_of_charge:
      name: "${name} state of charge"
    capacity_remaining:
      name: "${name} capacity remaining"
    total_battery_capacity_setting:
      name: "${name} total battery capacity setting"
    charging_cycles:
      name: "${name} charging cycles"
    total_charging_cycle_capacity:
      name: "${name} total charging cycle capacity"
    total_runtime:
      name: "${name} total runtime"
    balancing_current:
      name: "${name} balancing current"
    errors_bitmask:
      name: "${name} errors bitmask"
    emergency_time_countdown:
      name: "${name} emergency time countdown"

switch:
  - platform: jk_bms_ble
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"
    balancer:
      name: "${name} balancer"
    emergency:
      name: "${name} emergency"
    heating:
      name: "${name} heating"
    disable_temperature_sensors:
      name: "${name} disable temperature sensors"
    display_always_on:
      name: "${name} display always on"
    smart_sleep:
      name: "${name} smart sleep"
    disable_pcl_module:
      name: "${name} disable pcl module"
    timed_stored_data:
      name: "${name} timed stored data"
    charging_float_mode:
      name: "${name} charging float mode"

  - platform: ble_client
    ble_client_id: client0
    id: ble_client_switch0
    name: "${name} enable bluetooth connection"

text_sensor:
  - platform: jk_bms_ble
    errors:
      name: "${name} errors"
    total_runtime_formatted:
      name: "${name} total runtime formatted"

das ist für 8 Zellen. Falls man mehr hat entsprechend die auskommentierten Zellen anpassen.
This yaml is for 8 cells, please check lines marked with # in the lower part if you have more.

Mein fhem DEF RAW, basierend auf Gisberts

defmod MQTT2_JK_BMS MQTT2_DEVICE jk_bms_2462abc9d910
attr MQTT2_JK_BMS autocreate 0
attr MQTT2_JK_BMS event-min-interval .*:600
attr MQTT2_JK_BMS event-on-change-reading cell_voltage_1:0.01,cell_voltage_2:0.01,cell_voltage_3:0.01,cell_voltage_4:0.01,cell_voltage_5:0.01\
,cell_voltage_6:0.01,cell_voltage_7:0.01,cell_voltage_8:0.01,balancer,current:1,capacity_remaining:1,charging_cycle,power\
,average_cell_voltage:0.1,delta_cell_voltage,total_voltage:0.1,max_cell_voltage,min_cell_voltage,SOC:1,Zeitstempel,sensor_online_status,status
attr MQTT2_JK_BMS event-on-update-reading .*
attr MQTT2_JK_BMS readingList jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_errors/state:.* errors\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_balancing_current/state:.* balancing_current\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_state_of_charge/state:.* SOC\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_capacity_remaining/state:.* capacity_remaining\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_total_battery_capacity_setting/state:.* total_battery_capacity_setting\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_charging_cycles/state:.* charging_cycles\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_total_charging_cycle_capacity/state:.* charging_cycle_capacity\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_total_runtime/state:.* total_runtime\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_total_runtime_formatted/state:.* total_runtime_formatted\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_heating_current/state:.* heating_current\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_1/state:.* cell_voltage_1\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_2/state:.* cell_voltage_2\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_3/state:.* cell_voltage_3\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_4/state:.* cell_voltage_4\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_5/state:.* cell_voltage_5\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_6/state:.* cell_voltage_6\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_7/state:.* cell_voltage_7\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_cell_voltage_8/state:.* cell_voltage_8\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_min_cell_voltage/state:.* min_cell_voltage\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_max_cell_voltage/state:.* max_cell_voltage\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_average_cell_voltage/state:.* average_cell_voltage\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_delta_cell_voltage/state:.* delta_cell_voltage\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_max_voltage_cell/state:.* max_voltage_cell_nr\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_min_voltage_cell/state:.* min_voltage_cell_nr\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_power_tube_temperature/state:.* power_tube_temperature\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_total_voltage/state:.* total_voltage\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_current/state:.* current\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_power/state:.* power\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_charging_power/state:.* charging_power\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_discharging_power/state:.* discharging_power\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_temperature_sensor_1/state:.* temperature_sensor_1\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_temperature_sensor_2/state:.* temperature_sensor_2\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_temperature_sensor_3/state:.* temperature_sensor_3\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_temperature_sensor_4/state:.* temperature_sensor_4\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_temperature_sensor_5/state:.* temperature_sensor_5\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_errors_bitmask/state:.* errors_bitmask\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_balancing/state:.* balancing\
jk_bms_2462abc9d910:jk-bms/sensor/jk-bms_emergency_time_countdown/state:.* emergency_time_countdown\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_charging/state:.* switch_charging\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_discharging/state:.* switch_discharging\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_balancer/state:.* switch_balancer\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_enable_bluetooth_connection/state:.* switch_enable_bluetooth_connection\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_emergency/state:.* switch_emergency\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_heating/state:.* switch_heating\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_disable_temperature_sensors/state:.* switch_disable_temperature_sensors\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_display_always_on/state:.* switch_display_always_on\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_smart_sleep/state:.* switch_smart_sleep\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_disable_pcl_module/state:.* switch_disable_pcl_module\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_timed_stored_data/state:.* switch_timed_stored_data\
jk_bms_2462abc9d910:jk-bms/switch/jk-bms_charging_float_mode/state:.* switch_charging_float_mode\
jk_bms_2462abc9d910:jk-bms/binary_sensor/jk-bms_online_status/state:.* sensor_online_status\
jk_bms_2462abc9d910:jk-bms/binary_sensor/jk-bms_balancing/state:.* sensor_balancing\
jk_bms_2462abc9d910:jk-bms/binary_sensor/jk-bms_charging/state:.* sensor_charging\
jk_bms_2462abc9d910:jk-bms/binary_sensor/jk-bms_discharging/state:.* sensor_discharging\
jk_bms_2462abc9d910:jk-bms/binary_sensor/jk-bms_heating/state:.* sensor_heating\
jk_bms_2462abc9d910:jk-bms/status:.* status\
jk_bms_2462abc9d910:jk-bms/debug:.* debug\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_voltage_undervoltage_protection/state:.* cell_voltage_undervoltage_protection\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_voltage_undervoltage_recovery/state:.* cell_voltage_undervoltage_recovery\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_voltage_overvoltage_protection/state:.* cell_voltage_overvoltage_protection\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_voltage_overvoltage_recovery/state:.* cell_voltage_overvoltage_recovery\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_balance_trigger_voltage/state:.* balance_trigger_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_power_off_voltage/state:.* power_off_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_max_charge_current/state:.* max_charge_current\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_max_discharge_current/state:.* max_discharge_current\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_max_balance_current/state:.* max_balance_current\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_count/state:.* cell_count\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_total_battery_capacity/state:.* total_battery_capacity\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_balance_starting_voltage/state:.* balance_starting_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_smart_sleep_voltage/state:.* smart_sleep_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_soc100_voltage/state:.* soc100_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_soc0_voltage/state:.* soc0_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_request_charge_voltage/state:.* cell_request_charge_voltage\
jk_bms_2462abc9d910:jk-bms/number/jk-bms_cell_request_float_voltage/state:.* cell_request_float_voltage
attr MQTT2_JK_BMS room MQTT2_DEVICE
attr MQTT2_JK_BMS stateFormat {'Status: '.ReadingsVal($name,'status','').'<br/>\
SOC: '.ReadingsNum($name,'SOC','').'%<br/>\
charging cycles: '.ReadingsNum($name,'charging_cycles','').'<br/>\
power: '.ReadingsNum($name,'power','').' W<br/>\
current: '.ReadingsNum($name,'current','').' A<br/>\
Ø cell voltage: '.ReadingsNum($name,'average_cell_voltage','').' V<br/>\
Δ cell voltage: '.round(ReadingsNum($name,'delta_cell_voltage','')*1000,0).' mV<br/>\
max cell voltage: '.ReadingsNum($name,'max_cell_voltage','').' V<br/>\
min cell voltage: '.ReadingsNum($name,'min_cell_voltage','').' V<br/>\
battery voltage: '.ReadingsNum($name,'total_voltage',''). 'V<br/>'\
.ReadingsVal($name,'IPaddress','').'<br/>\
<span style="vertical-align: +0px;; font-size: 85%;;">'.ReadingsVal($name,'Zeitstempel','').'</span>'}
attr MQTT2_JK_BMS userReadings Zeitstempel {substr(ReadingsTimestamp($name,'total_voltage',''),0,19)}, \
IPaddress \
{"<a href=\"http://192.168.xx.xx\" style=\"color: green;; text-decoration: underline;;\" target=\"_blank\" rel=\"noopener noreferrer\">http://192.168.xx.xx</a>"}

Summary:

There is a git project for a wired connection for the "new JK inverter BMS" -> https://github.com/txubelaxu/esphome-jk-bms
This deals with the RS485 interface and you need an additional RS485 converter for your ESP32.

As an ignorant person, I initially only dealt with the git project linked by Gisbert -> https://github.com/syssi/esphome-jk-bms
This one is mainly thought out for a Bluetooth connection for the new BMS, but works wired for older BMS´ses (it seems to me?)

Which i finally decided on .... and the git https://github.com/syssi/esphome-jk-bms
was up again.

I'll have to monitor the stability for a few weeks now, but it looks pretty good to start with. All values from the BMS flow to fhem via MQTT2 (internal server).

First, follow Gisbert's link to flash -> https://smarthomeyourself.de/wiki/esphome/esphome-mit-python-ueber-die-kommandozeile-flashen/
Please note that the Python install only worked for me via Windows app installation. I had never tried it before, annoying, but that was the only way.

Then more repos have to be installed. Forgotten which ones. The error messages during the first compilation show what is missing.

Then you have to switch on DEBUG mode in the yaml file to find the MAC address of the BMS (MAC of your BMS will be shown in the Debug messages when logged into your ESP32 dashboard). Then reflash with the MAC address found and put in the yaml. Yes, complicated undertaking ... maybe there is a better way.

then activate autocreate in fhem´s MQTT2 server (or whatever Server you use) ... and the games can begin. Please see yaml and fhem DEF RAW above

holle75

... vielleicht ist ja der RS485 Konverter von weiter oben genau das Teil was man braucht um kabelgebundenen zu fahren. Aber von/wohin das Ding konvertiert weiß irgendwie niemand genau. Auch wo man das anschließen soll weiß ich nicht.

holle75

.... ein

attr MQTT2_FHEM_Server ignoreRegexp milight/0x[0-9a-fA-F]{1,4}/.*/[0-8]|shellies/[^/]+/command|cmnd/[^/]+/|homeassistant/.*/config|tasmota/discovery/

in eurem MQTT2 Server (fhem intern) hilft die Last auf dem fhem device zu reduzieren... und reading RETAIN mal anschauen, was sich da alles reingeschlichen hat.

holle75

@Gisbert, sorry, ich finde mal wieder keine Info zu den Basics .... secrets.yaml ... wohin damit in fhem? Bis jetzt hab ich alles direkt ins Device yaml eingetragen. Aber so ließe sich das allgemein für mehr Devices vereinfachen.

Und wie binde ich es ein? Also muss man im Device.yaml noch irgendwas beachten? Oder nur bei jeweiligen "passwert" die Referenz eintragen? zb

!secret my_broker