WoMo, Victron und JBD-BMS per BLE auslesen

Hallo,
habe es heute mal geschafft aus 2 ESP Code’s mal einen zu machen.
Mit einem ESP32-C6-Devkitc-1 lese ich dem Victron - MPPT - Shunt und ein JBD-BMS aus.
Daten werde über MQTT an Symcon gesendet.
Das ganze habe ich mit ESPHOME auf einem Windows11 Rechner kompiliert.
Wie das geht, seht bitte auf : https://esphome.io/ nach.

Hier noch der Code (esphome_victron_jbd.yaml)der bei mir läuft :

substitutions:
  # Set the MAC addresses and encryption keys of your Victron devices here
  # The values here are examples and cannot work for your devices
  smart_shunt_mac_address: xx:xx:xx:xx:xx:xx
  smart_shunt_encryption_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  smart_solar_mac_address: xx:xx:xx:xx:xx:xx
  smart_solar_encryption_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  jbd_mac_address: xx:xx:xx:xx:xx:xx
  name: jbd-bms-ble

esphome:
  name: "victron-jbd-ble"

external_components:
  - source: github://Fabian-Schmidt/esphome-victron_ble
  - source: github://syssi/esphome-jbd-bms@main
  


esp32:
  board: esp32-c6-devkitc-1
  framework:
    type: esp-idf

ota:
  platform: esphome

web_server:
  port: 80

mqtt:
  broker: 192.168.1.1
  username: " "
  password: " "
  port: 1883

logger:
  level: DEBUG

esp32_ble_tracker:

wifi:
  networks:
  - ssid: home
    password: home
  - ssid: home2
    password: home2
  # Enable fallback hotspot if WiFi connection fails
  ap: {}

ble_client:
  - id: client0
    mac_address: ${jbd_mac_address}

jbd_bms_ble:
  - id: bms0
    ble_client_id: client0
    # Some Liontron BMS models require an update interval of less than 8s
    update_interval: 2s
    # Default password of the JBD-SP04S034 V1.3 which requires authentication
    # password: "123456"



victron_ble:
  - id: MySmartShunt
    mac_address: ${smart_shunt_mac_address}
    bindkey: ${smart_shunt_encryption_key}

    # Advanced users can use `on_*_message` action. The data is in the `message` variable.
    on_battery_monitor_message:
      - logger.log: "Message from Battery Monitor."
    on_solar_charger_message:
      - logger.log: "Message from Solar Charger."
    on_inverter_message:
      - logger.log: "Message from Inverter."
    on_dcdc_converter_message:
      - logger.log: "Message from DC/DC Converter."
    on_smart_lithium_message:
      - logger.log: "Message from Smart Lithium."
    on_inverter_rs_message:
      - logger.log: "Message from Inverter RS."
    on_smart_battery_protect_message:
      - logger.log: "Message from Smart Battery Protect."
    on_lynx_smart_bms_message:
      - logger.log: "Message from Lynx Smart BMS."
    on_multi_rs_message:
      - logger.log: "Message from Multi RS."
    on_ve_bus_message:
      - logger.log: "Message from VE.Bus."
    on_dc_energy_meter_message:
      - logger.log: "Message from DC Energy Meter."

  - id: MySmartSolar
    mac_address: ${smart_solar_mac_address}
    bindkey: ${smart_solar_encryption_key}

button:
  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    retrieve_hardware_version:
      name: "${name} retrieve hardware version"
    force_soc_reset:
      name: "${name} force soc reset"


sensor:
  # MySmartShunt
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Time remaining"
    type: TIME_TO_GO
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Battery voltage"
    type: BATTERY_VOLTAGE
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Starter Battery"
    # BAUX_VOLTAGE or MID_VOLTAGE or TEMPERATURE.
    # Depending on configuration of SmartShunt
    type: AUX_VOLTAGE
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Current"
    type: BATTERY_CURRENT
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Consumed Ah"
    type: CONSUMED_AH
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt State of charge"
    type: STATE_OF_CHARGE

  # MySmartSolar
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 Battery Voltage"
    type: BATTERY_VOLTAGE
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 Battery Current"
    type: BATTERY_CURRENT
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 Yield Today"
    type: YIELD_TODAY
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 PV Power"
    type: PV_POWER
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 Load Current"
    type: LOAD_CURRENT

    #jbd Batterie
  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    battery_strings:
      name: "${name} battery strings"
    current:
      name: "${name} current"
      id: bms0_current
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    state_of_charge:
      name: "${name} state of charge"
    nominal_capacity:
      name: "${name} nominal capacity"
      id: bms0_nominal_capacity
    charging_cycles:
      name: "${name} charging cycles"
    capacity_remaining:
      name: "${name} capacity remaining"
      id: bms0_capacity_remaining
    battery_cycle_capacity:
      name: "${name} battery cycle capacity"
    total_voltage:
      name: "${name} total voltage"
    average_cell_voltage:
      name: "${name} average cell voltage"
    delta_cell_voltage:
      name: "${name} delta cell voltage"
    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"
    temperature_1:
      name: "${name} temperature 1"
    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"
    operation_status_bitmask:
      name: "${name} operation status bitmask"
    errors_bitmask:
      name: "${name} errors bitmask"
    balancer_status_bitmask:
      name: "${name} balancer status bitmask"
    software_version:
      name: "${name} software version"
  # Average current sensor with exponential filtering
  - platform: copy
    source_id: bms0_current
    name: "${name} average current"
    id: bms0_average_current
    filters:
      - exponential_moving_average:
          alpha: 0.1
          send_every: 1
   
binary_sensor:
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Battery has Alarm"
    type: ALARM

  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 is in Fault state"
    type: DEVICE_STATE_FAULT
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 has Error"
    type: CHARGER_ERROR

  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    balancing:
      name: "${name} balancing"
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"
    online_status:
      name: "${name} online status"


text_sensor:
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Shunt Battery Alarm reason"
    type: ALARM_REASON

  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 state"
    type: DEVICE_STATE
  - platform: victron_ble
    victron_ble_id: MySmartSolar
    name: "MPPT1 Error reason"
    type: CHARGER_ERROR

  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    errors:
      name: "${name} errors"
    operation_status:
      name: "${name} operation status"
    device_model:
      name: "${name} device model"

select:
  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    read_eeprom_register:
      name: "${name} read eeprom register"
      id: read_eeprom_register0
      optionsmap:
        0xAA: "Error Counts"

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

  - platform: jbd_bms_ble
    jbd_bms_ble_id: bms0
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"

Es müssen natürlich die Daten an Eure Geräte , Wlan und MQTT angepasst werden .

lg Thomas