Monitoring BMS JBD přes Home Assistant

Automatizace, řízení, měření, logování a programování s využitím platformy Arduino.
PetrDubi
Příspěvky: 1355
Registrován: úte říj 12, 2021 10:43 am
Lokalita: Blízko Ústí nad Labem
Systémové napětí: 48V
Výkon panelů [Wp]: 7100
Kapacita baterie [kWh]: 13
Chci prodávat energii: NE
Chci/Mám dotaci: NE

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od PetrDubi »

U JBD jde po kabelu normálně ovládat nabíjení i vybíjení - stačí se podívat do těch ukázek na githubu. Kabel se připojuje místo Bluetooth modulu.

Problém u JK je v tom, že UART rozhraní je jenom pro čtení a neumožňuje zápis do BMS..
mobilní elektrárna 3x Uni-solar PVL-68, 3x MPP modul, vše řízené přes arduino
doma 3280 Wp JV, 3810 Wp JZ, Easun SMW 8k (rebrandovaný MAX 8 kW), aku 13kWh 16s LiFePO4
Thoma_CPU
Příspěvky: 74
Registrován: úte led 18, 2022 10:37 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od Thoma_CPU »

Beny píše:Díky za tohle vlákno chlapy.
Doma honím HA a ESP32 na odčítání spotřeby vody. Ale napojit BMS by mě tedy nenapadlo. Super počin.
Jde přes integraci v HA zapnout nabíjení baterie? Tady https://github.com/syssi/esphome-jk-bms jsem viděl v integraci přepínač.
Díky za info
Potvrzuji že přes Bluetooth to funguje na JBD jsou tam přepínače jako v aplikaci.
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Mám dotaz ohledně JK-BMS, jede to někomu společně s MPPT victron? Mám nyní JM-BMS připojenou samostatně k ESP-12 a Victron na další modul ESP-12. Říkal jsem si že bych tyto dva moduly nahradil jedním ESP32 na uaty použil oddělení aby se nehádali napěťové úrovně.
Pokoušel jsem se upravit program v esphome, ale zatím hází errory při překladu.
Je zde někdo, kdo už to má hotové, popřípadě kdo by poradil, co mám špatně?
Díky Pavel
glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

dej sem yaml, jestli mas vse na poslednich verzich, jake chyby to hlasi a uvidime
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Zde to je...

Kód: Vybrat vše

substitutions:
  name: victron
  # external_components: 
    - source: github://KinDR007/VictronMPPT-ESPHOME@main
  
   jk_bms1  
   - source: github://syssi/esphome-jk-bms@main
              
   
#esphome:
 # name: esphome-web-e90d74

esphome:
  name: victron-bms

esp32:
  board: esp32dev
  framework:
    type: arduino

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

# Enable logging
logger:
  # baud_rate: 0
 # esp8266_store_log_strings_in_flash: true

# Enable Home Assistant API
api:
  
#encryption:
    #key: "G+Y5jkrx/DPjxr/bhVTX3M2DE7u+I2a2kIo7MBjcrh0="

ota:
  password: "94fe1ae539bb973cac9f48506553bd0d"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-E90D74"
    password: "azv7YcK8G0nl"

#captive_portal:

#mqtt:
  #broker: 192.168.1.6 #core-mossquitto
  #port: 1883
  #username: mqtt-user #!secret mqtt_username
  #password: iotserver #!secret mqtt_password
  #id: mqtt_client

uart:
- id: uart_1
  tx_pin: GPIO32 #D6  #Not connected! The communication is read-only
  rx_pin: GPIO33 #D7 #Connect this this GPIO and GND to the MPPT charger
  baud_rate: 19200
  rx_buffer_size: 256
  
- id: uart_2
  baud_rate: 115200
  rx_buffer_size: 384
  tx_pin: GPIO3
  rx_pin: GPIO35
   

victron:
  uart_id: uart1
  id: victron0
  throttle: 10s

jk_modbus:
  id: modbus0
  uart_id: uart2  

jk_bms:
  id: bms0
  jk_modbus_id: modbus0



sensor:
  - platform: victron
    victron_id: victron0
    max_power_yesterday:
      name: "${name} max power yesterday"
    max_power_today:
      name: "${name} max power today"
    yield_total:
      name: "${name} yield total"
    yield_yesterday:
      name: "${name} yield yesterday"
    yield_today:
      name: "${name} yield today"
    panel_voltage:
      name: "${name} panel voltage"
    panel_power:
      name: "${name} panel power"
    battery_current:
      name: "${name} panel current"
    battery_voltage:
      name: "${name} battery voltage"
    day_number:
      name: "${name} day number"
    charging_mode_id:
      name: "${name} charging mode id"
    error_code:
      name: "${name} error code"
    tracking_mode_id:
      name: "${name} tracking mode id"
    load_current:
      name: "${name} load current"
  - platform: jk_bms  
    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"
    power_tube_temperature:
      name: "${name} power tube temperature"
    temperature_sensor_1:
      name: "${name} temperature sensor 1"
    temperature_sensor_2:
      name: "${name} temperature sensor 2"
    total_voltage:
      name: "${name} total voltage"
    current:
      name: "${name} current"
    power:
      name: "${name} power"
    charging_power:
      name: "${name} charging power"
    discharging_power:
      name: "${name} discharging power"
    capacity_remaining:
      name: "${name} capacity remaining"
    capacity_remaining_derived:
      name: "${name} capacity remaining derived"
    temperature_sensors:
      name: "${name} temperature sensors"
    charging_cycles:
      name: "${name} charging cycles"
    total_charging_cycle_capacity:
      name: "${name} total charging cycle capacity"
    battery_strings:
      name: "${name} battery strings"
    errors_bitmask:
      name: "${name} errors bitmask"
    operation_mode_bitmask:
      name: "${name} operation mode bitmask"
    total_voltage_overvoltage_protection:
      name: "${name} total voltage overvoltage protection"
    total_voltage_undervoltage_protection:
      name: "${name} total voltage undervoltage protection"
    cell_voltage_overvoltage_protection:
      name: "${name} cell voltage overvoltage protection"
    cell_voltage_overvoltage_recovery:
      name: "${name} cell voltage overvoltage recovery"
    cell_voltage_overvoltage_delay:
      name: "${name} cell voltage overvoltage delay"
    cell_voltage_undervoltage_protection:
      name: "${name} cell voltage undervoltage protection"
    cell_voltage_undervoltage_recovery:
      name: "${name} cell voltage undervoltage recovery"
    cell_voltage_undervoltage_delay:
      name: "${name} cell voltage undervoltage delay"
    cell_pressure_difference_protection:
      name: "${name} cell pressure difference protection"
    discharging_overcurrent_protection:
      name: "${name} discharging overcurrent protection"
    discharging_overcurrent_delay:
      name: "${name} discharging overcurrent delay"
    charging_overcurrent_protection:
      name: "${name} charging overcurrent protection"
    charging_overcurrent_delay:
      name: "${name} charging overcurrent delay"
    balance_starting_voltage:
      name: "${name} balance starting voltage"
    balance_opening_pressure_difference:
      name: "${name} balance opening pressure difference"
    power_tube_temperature_protection:
      name: "${name} power tube temperature protection"
    power_tube_temperature_recovery:
      name: "${name} power tube temperature recovery"
    temperature_sensor_temperature_protection:
      name: "${name} temperature sensor temperature protection"
    temperature_sensor_temperature_recovery:
      name: "${name} temperature sensor temperature recovery"
    temperature_sensor_temperature_difference_protection:
      name: "${name} temperature sensor temperature difference protection"
    charging_high_temperature_protection:
      name: "${name} charging high temperature protection"
    discharging_high_temperature_protection:
      name: "${name} discharging high temperature protection"
    charging_low_temperature_protection:
      name: "${name} charging low temperature protection"
    charging_low_temperature_recovery:
      name: "${name} charging low temperature recovery"
    discharging_low_temperature_protection:
      name: "${name} discharging low temperature protection"
    discharging_low_temperature_recovery:
      name: "${name} discharging low temperature recovery"
    total_battery_capacity_setting:
      name: "${name} total battery capacity setting"
    #current_calibration:
      #name: "${name} current calibration"
    #device_address:
      #name: "${name} device address"
    sleep_wait_time:
      name: "${name} sleep wait time"
    #alarm_low_volume:
      #name: "${name} alarm low volume"
    #manufacturing_date:
      #name: "${name} manufacturing date"
    total_runtime:
      name: "${name} total runtime"
#    start_current_calibration:
#      name: "${name} start current calibration"
    actual_battery_capacity:
      name: "${name} actual battery capacity"
#    protocol_version:
#      name: "${name} protocol version"      

text_sensor:
  - platform: victron
    victron_id: victron0
    charging_mode:
      name: "${name} charging mode"
    error:
      name: "${name} error"
    tracking_mode:
      name: "${name} tracking mode"
    firmware_version:
      name: "${name} firmware version"
    device_type:
      name: "${name} device type"
    serial_number:
      name: "${name} serial number"
  - platform: jk_bms 
    errors:
      name: "${name} errors"
    operation_mode:
      name: "${name} operation mode"
    battery_type:
      name: "${name} battery type"
    password:
      name: "${name} password"
    device_type:
      name: "${name} device type"
    software_version:
      name: "${name} software version"
    manufacturer:
      name: "${name} manufacturer"
    total_runtime_formatted:
      name: "${name} total runtime formatted"  

binary_sensor:
  - platform: victron
    victron_id: victron0
    load_state:
      name: "${name} load state"
    relay_state:
      name: "${name} relay state"
  - platform: jk_bms
    balancing:
      name: "${name} balancing"
    balancing_switch:
      name: "${name} balancing switch"
    charging:
      name: "${name} charging"
    charging_switch:
      name: "${name} charging switch"
    discharging:
      name: "${name} discharging"
    discharging_switch:
      name: "${name} discharging switch"
    dedicated_charger_switch:
      name: "${name} dedicated charger switch"
tohle to hlasi - source je podtrženo červeně.

INFO Reading configuration /config/esphome/esphome-web-e90d74.yaml...
ERROR Error while reading config: Invalid YAML syntax:

while parsing a block mapping
in "/config/esphome/esphome-web-e90d74.yaml", line 2, column 3:
name: victron
^
expected <block end>, but found '<block sequence start>'
in "/config/esphome/esphome-web-e90d74.yaml", line 4, column 5:
- source: github://KinDR007/Vict ...
^
PetrDubi
Příspěvky: 1355
Registrován: úte říj 12, 2021 10:43 am
Lokalita: Blízko Ústí nad Labem
Systémové napětí: 48V
Výkon panelů [Wp]: 7100
Kapacita baterie [kWh]: 13
Chci prodávat energii: NE
Chci/Mám dotaci: NE

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od PetrDubi »

Máš to tam celý nějaký zmatlaný, máš špatně odsazení řádků, external_components odkazuje na hodnotu která není definovaná, celý substitutions je divný (a nefunkční) a kdo ví co ještě.
mobilní elektrárna 3x Uni-solar PVL-68, 3x MPP modul, vše řízené přes arduino
doma 3280 Wp JV, 3810 Wp JZ, Easun SMW 8k (rebrandovaný MAX 8 kW), aku 13kWh 16s LiFePO4
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

No snažil jsem se dodržet odsazení řádků. Bohužel nejsem programátor, jsem pouze HW.
Dával jsem dohromady dvě funkční věci, nikde na netu jsem nenašel examle pro více zdrojů z githubu a použití více uartů (JK-BMS, Victron).
Díky
glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

tady mam treba dva uarty ze dvou JK BMS.3

Kód: Vybrat vše

substitutions:
  bms0: "BMS1"
  bms1: "BMS2"
  name: jk-bms
  external_components_source: github://syssi/esphome-jk-bms@1.3.0
  tx_pin_uart0: GPIO4
  rx_pin_uart0: GPIO36
  tx_pin_uart1: GPIO32
  rx_pin_uart1: GPIO34
  bms0_protocol_version: JK02
  bms1_protocol_version: JK02

esphome:
  name: bms
  platformio_options:
    build_flags: 
      - -DCONFIG_ARDUINO_LOOP_STACK_SIZE=32768
  project:
    name: "syssi.esphome-jk-bms"
    version: 1.3.0

esp32:
  board: esp32dev
  framework:
    type: arduino

external_components:
  - source: ${external_components_source}
    refresh: 0s
    
# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxx"

#enable ethernet
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

uart:
  - id: uart0
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin_uart0}
    rx_pin: ${rx_pin_uart0}
    
  - id: uart1
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin_uart1}
    rx_pin: ${rx_pin_uart1}

jk_modbus:
  - id: modbus0
    uart_id: uart0
  - id: modbus1
    uart_id: uart1

jk_bms:
  - id: bms0
    jk_modbus_id: modbus0
  - id: bms1
    jk_modbus_id: modbus1

binary_sensor:
  - platform: jk_bms
    jk_bms_id: bms0
    charging:
      name: "${bms0} - Charging"
    charging_switch:
      name: "${bms0} - Charging switch"
    discharging:
      name: "${bms0} - Discharging"
    discharging_switch:
      name: "${bms0} - Discharging switch"
    dedicated_charger_switch:
      name: "${bms0} - Dedicated charger switch"
  - platform: jk_bms
    jk_bms_id: bms1
    charging:
      name: "${bms1} - Charging"
    charging_switch:
      name: "${bms1} - Charging switch"
    discharging:
      name: "${bms1} - Discharging"
    discharging_switch:
      name: "${bms1} - Discharging switch"
    dedicated_charger_switch:
      name: "${bms1} - Dedicated charger switch"

    
sensor:
  - platform: jk_bms
    jk_bms_id: bms0
    delta_cell_voltage:
      name: "${bms0} - Cell diff"
    average_cell_voltage:
      name: "${bms0} - Cell avg"
    cell_voltage_1:
      name: "${bms0} - Cell 1"
    cell_voltage_2:
      name: "${bms0} - Cell 2"
    cell_voltage_3:
      name: "${bms0} - Cell 3"
    cell_voltage_4:
      name: "${bms0} - Cell 4"
    cell_voltage_5:
      name: "${bms0} - Cell 5"
    cell_voltage_6:
      name: "${bms0} - Cell 6"
    cell_voltage_7:
      name: "${bms0} - Cell 7"
    cell_voltage_8:
      name: "${bms0} - Cell 8"
    cell_voltage_9:
      name: "${bms0} - Cell 9"
    cell_voltage_10:
      name: "${bms0} - Cell 10"
    cell_voltage_11:
      name: "${bms0} - Cell 11"
    cell_voltage_12:
      name: "${bms0} - Cell 12"
    cell_voltage_13:
      name: "${bms0} - Cell 13"
    cell_voltage_14:
      name: "${bms0} - Cell 14"
    cell_voltage_15:
      name: "${bms0} - Cell 15"
    cell_voltage_16:
      name: "${bms0} - Cell 16"
    power_tube_temperature:
      name: "${bms0} - Temp power tube "
    temperature_sensor_1:
      name: "${bms0} - Temp 1"
    temperature_sensor_2:
      name: "${bms0} - Temp 2"
    total_voltage:
      name: "${bms0} - Battery voltage"
    current:
      name: "${bms0} - Battery current"
    power:
      name: "${bms0} - Power"
    charging_power:
      name: "${bms0} - Charging power"
    discharging_power:
      name: "${bms0} - Discharging power"
    capacity_remaining:
      name: "${bms0}  - Remaining capacity"
    capacity_remaining_derived:
      name: "${bms0} - Remaining capacity derived"
    total_charging_cycle_capacity:
      name: "${bms0} - Total charging cycle capacity"
    errors_bitmask:
      name: "${bms0} - Errors bitmask"
    operation_mode_bitmask:
      name: "${bms0} - Operation mode bitmask"
    alarm_low_volume:
      name: "${bms0} - Alarm low volume"
    total_runtime:
      name: "${bms0} - Total runtime"
    actual_battery_capacity:
      name: "${bms0} - Actual battery capacity"
      
  - platform: jk_bms
    jk_bms_id: bms1
    delta_cell_voltage:
      name: "${bms1} - Cell diff"
    average_cell_voltage:
      name: "${bms1} - Cell avg"
    cell_voltage_1:
      name: "${bms1} - Cell 1"
    cell_voltage_2:
      name: "${bms1} - Cell 2"
    cell_voltage_3:
      name: "${bms1} - Cell 3"
    cell_voltage_4:
      name: "${bms1} - Cell 4"
    cell_voltage_5:
      name: "${bms1} - Cell 5"
    cell_voltage_6:
      name: "${bms1} - Cell 6"
    cell_voltage_7:
      name: "${bms1} - Cell 7"
    cell_voltage_8:
      name: "${bms1} - Cell 8"
    cell_voltage_9:
      name: "${bms1} - Cell 9"
    cell_voltage_10:
      name: "${bms1} - Cell 10"
    cell_voltage_11:
      name: "${bms1} - Cell 11"
    cell_voltage_12:
      name: "${bms1} - Cell 12"
    cell_voltage_13:
      name: "${bms1} - Cell 13"
    cell_voltage_14:
      name: "${bms1} - Cell 14"
    cell_voltage_15:
      name: "${bms1} - Cell 15"
    cell_voltage_16:
      name: "${bms1} - Cell 16"
    power_tube_temperature:
      name: "${bms1} - Temp power tube "
    temperature_sensor_1:
      name: "${bms1} - Temp 1"
    temperature_sensor_2:
      name: "${bms1} - Temp 2"
    total_voltage:
      name: "${bms1} - Battery voltage"
    current:
      name: "${bms1} - Battery current"
    power:
      name: "${bms1} - Power"
    charging_power:
      name: "${bms1} - Charging power"
    discharging_power:
      name: "${bms1} - Discharging power"
    capacity_remaining:
      name: "${bms1}  - Remaining capacity"
    capacity_remaining_derived:
      name: "${bms1} - Remaining capacity derived"
    total_charging_cycle_capacity:
      name: "${bms1} - Total charging cycle capacity"
    errors_bitmask:
      name: "${bms1} - Errors bitmask"
    operation_mode_bitmask:
      name: "${bms1} - Operation mode bitmask"
    alarm_low_volume:
      name: "${bms1} - Alarm low volume"
    total_runtime:
      name: "${bms1} - Total runtime"
    actual_battery_capacity:
      name: "${bms1} - Actual battery capacity"
     
text_sensor:
  - platform: jk_bms
    jk_bms_id: bms0
    errors:
      name: "${bms0} - Errors"
    operation_mode:
      name: "${bms0} - Operation mode"
      
  - platform: jk_bms
    jk_bms_id: bms1
    errors:
      name: "${bms1} - Errors"
    operation_mode:
      name: "${bms1} - Operation mode"
     
Tohle pak jsou dve victron zarizeni na jedno esp32. Po ve.direct. Mppt a shunt. Ale pouzivam jinou knihovnu asi nez ty

Kód: Vybrat vše

substitutions:
  name: victron-mppt
  nameShunt: SmartShunt
  accuracy: "2"

esphome:
  name: "${name}"
  includes:
    - libs/vedirect/vedirect.h
    - libs/vedirect/vedirect.cpp
    - libs/vedirect/VeDirectFrameHandler.h
    - libs/vedirect/VeDirectFrameHandler.cpp
    
esp32:
  board: esp32-poe
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxx"

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12
  manual_ip:
    static_ip: 10.80.100.13
    gateway: 10.80.100.254
    subnet: 255.255.255.0

uart:
  - id: uart0
    tx_pin: 
      number: GPIO15  # Not used! The communication is read-only
      inverted: false
    rx_pin: 
      number: GPIO14
      inverted: false
    baud_rate: 19200
    rx_buffer_size: 256
  - id: uart1
    tx_pin: 
      number: GPIO13  # Not used! The communication is read-only
      inverted: false
    rx_pin: 
      number: GPIO16
      inverted: false
    baud_rate: 19200
    rx_buffer_size: 256

sensor:
  - platform: template  
    name: "${nameShunt} Battery Voltage"
    id: shbv
    accuracy_decimals: ${accuracy}
    unit_of_measurement: "V"
    device_class: voltage
    filters:
      - multiply: 0.001

  - platform: template
    name: "${nameShunt} Battery Current"
    id: shbc
    unit_of_measurement: "A"
    device_class: current
    accuracy_decimals: 1
    filters:
      - multiply: 0.001

  - platform: template
    name: "${nameShunt} Instanteneous Power"
    id: instantaneous_power
    accuracy_decimals: 1
    unit_of_measurement: "W"
    device_class: power
    
  - platform: template
    name: "${nameShunt} Consumed Amp Hours"
    id: consumed_amp_hours
    unit_of_measurement: Ah
    accuracy_decimals: ${accuracy}
    filters:
      - multiply: 0.001
  - platform: template
    name: "${nameShunt} Min Battery Voltage"
    id: min_battery_voltage
    accuracy_decimals: ${accuracy}
    unit_of_measurement: "V"
    device_class: voltage
    filters:
      - multiply: 0.001
      
  - platform: template
    name: "${nameShunt} Max Battery Voltage"
    id: max_battery_voltage
    accuracy_decimals: ${accuracy}
    unit_of_measurement: "V"
    device_class: voltage
    filters:
      - multiply: 0.001
      
  - platform: template
    name: "${nameShunt} Amount Of Charged"
    id: amount_of_charged
    filters:
      - multiply: 0.01
    unit_of_measurement: kWh
    accuracy_decimals: ${accuracy}
    device_class: energy
    state_class: total_increasing
    
  - platform: template
    name: "${nameShunt} BMV Alarm"
    id: bmv_alarm
    
  - platform: template
    name: "${nameShunt} Amount of discharged energy"
    id: discharged_energy
    filters:
      - multiply: 0.01
    unit_of_measurement: kWh
    accuracy_decimals: ${accuracy}
    device_class: energy
    state_class: total_increasing
    
  - platform: template
    id: state_of_charge
    name: "${nameShunt} SoC"
    unit_of_measurement: "%"
    device_class: battery
    filters:
      - multiply: 0.1

  - platform: uptime
    name: "${name} Uptime"
    id: victron_mppt_uptime_s
    update_interval: 60s
    
  - platform: template
    name: "${name} Input power - P1"
    id: input_power_p1
    unit_of_measurement: W
    device_class: power
    accuracy_decimals: 1
    update_interval: 30s
    filters:
      - sliding_window_moving_average:
          window_size: 120
          send_every: 15
  - platform: template
    name: "${name} Input power - P2"
    id: input_power_p2
    unit_of_measurement: W
    device_class: power
    accuracy_decimals: 1
    update_interval: 30s
    filters:
      - sliding_window_moving_average:
          window_size: 120
          send_every: 15
  - platform: template
    name: "${name} Input power - P3"
    id: input_power_p3
    unit_of_measurement: W
    device_class: power
    accuracy_decimals: 1
    update_interval: 30s
    filters:
      - sliding_window_moving_average:
          window_size: 120
          send_every: 15
          
          
  - platform: template
    id: victron_mppt_bv
    name: "${name} Battery voltage"
    unit_of_measurement: "V"
    accuracy_decimals: 3
    device_class: voltage
    filters:
      - multiply: 0.001
      
  - platform: template
    name: "${name} Panel voltage"
    id: victron_mppt_pv
    unit_of_measurement: "V"
    accuracy_decimals: 3
    device_class: voltage
    filters:
      - multiply: 0.001
      
  - platform: template
    name: "${name} Panel power"
    id: victron_mppt_panel_power
    unit_of_measurement: "W"
    device_class: power
    
  - platform: template
    name: "${name} Battery current"
    id: victron_mppt_bc
    unit_of_measurement: "A"
    accuracy_decimals: 3
    device_class: current
    filters:
      - multiply: 0.001    
   
  - platform: template
    name: "${name} Yield total"
    id: victron_mppt_yield_total
    filters:
      # Multiplication factor from W to kW is 0.001
      - multiply: 0.01
    unit_of_measurement: kWh
    accuracy_decimals: ${accuracy}
    device_class: energy
    state_class: total_increasing
    
  - platform: template
    name: "${name} Yield today"
    id: victron_mppt_yt
    filters:
      # Multiplication factor from W to kW is 0.001
      - multiply: 0.01
    unit_of_measurement: kWh
    accuracy_decimals: ${accuracy}
    device_class: energy
    state_class: total_increasing
    
  - platform: template
    name: "${name} Yield yesterday"
    id: victron_mppt_yield_yesterday
    filters:
      # Multiplication factor from W to kW is 0.001
      - multiply: 0.01
    unit_of_measurement: kWh
    accuracy_decimals: ${accuracy}
    device_class: energy
    state_class: total_increasing
    
  - platform: template
    id: victron_mppt_max_power_today
    name: "${name} max power today"
    unit_of_measurement: "W"
    device_class: power
    
  - platform: template
    id: victron_mppt_max_power_yesterday
    name: "${name} max power yesterday"
    unit_of_measurement: "W"
    device_class: power

text_sensor:
  - platform: template
    id: victron_mppt_error
    name: "${name} error"
    availability:
  - platform: template
    id: victron_mppt_tracking_mode
    name: "${name} tracking mode"
    availability:    
  - platform: template
    id: victron_mppt_charging_mode
    name: "${name} charging mode"
    availability:      

  - platform: template
    id: invertor1_last_error
    name: "${name} Invertor1 last error"
    update_interval: 60s
  - platform: template
    id: invertor2_last_error
    name: "${name} Invertor2 last error"
    update_interval: 60s
  - platform: template
    id: invertor3_last_error
    name: "${name} Invertor3 last error"
    update_interval: 60s
    
custom_component:
  - lambda: |-
      auto vedirect_mppt = new VEDirectComponent(id(uart0));
      vedirect_mppt->addSensor("V",id(victron_mppt_bv));
      vedirect_mppt->addSensor("I",id(victron_mppt_bc));
      vedirect_mppt->addSensor("PPV",id(victron_mppt_panel_power));
      vedirect_mppt->addSensor("VPV",id(victron_mppt_pv));
      vedirect_mppt->addSensor("H19",id(victron_mppt_yield_total));
      vedirect_mppt->addSensor("H20",id(victron_mppt_yt));
      vedirect_mppt->addSensor("H21",id(victron_mppt_max_power_today));
      vedirect_mppt->addSensor("H22",id(victron_mppt_yield_yesterday));
      vedirect_mppt->addSensor("H23",id(victron_mppt_max_power_yesterday));
      vedirect_mppt->addSensor("ERR",id(victron_mppt_error));
      vedirect_mppt->addSensor("MPPT",id(victron_mppt_tracking_mode));
      vedirect_mppt->addSensor("CS",id(victron_mppt_charging_mode));
      vedirect_mppt->muteAsyncMessage(true);
      vedirect_mppt->set_update_interval(30000);

      auto vedirect_sh = new VEDirectComponent(id(uart1));
      vedirect_sh->addSensor("V",id(shbv));
      vedirect_sh->addSensor("I",id(shbc));
      vedirect_sh->addSensor("P",id(instantaneous_power));
      vedirect_sh->addSensor("CE",id(consumed_amp_hours));
      vedirect_sh->addSensor("H7",id(min_battery_voltage));
      vedirect_sh->addSensor("H8",id(max_battery_voltage));
      vedirect_sh->addSensor("H17",id(discharged_energy));
      vedirect_sh->addSensor("H18",id(amount_of_charged));
      vedirect_sh->addSensor("AR",id(bmv_alarm));
      vedirect_sh->addSensor("SOC",id(state_of_charge));

      vedirect_sh->muteAsyncMessage(true);
      vedirect_sh->set_update_interval(30000);

      return {vedirect_mppt, vedirect_sh};

glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

a pozor na ty odsazeni. Tohle neni ani tak programovani ale definice co to pak ma za kod nagenerovat a struktura tech dat je dulezita.
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Ahoj,
Velice děkuji za zdrojáky. Ještě dotaz ohledně spojení do jednoho ESP32, myslíš že to bude fungovat?
Myšleno Victron a JK-BMS na jednom ESP32.
PetrDubi
Příspěvky: 1355
Registrován: úte říj 12, 2021 10:43 am
Lokalita: Blízko Ústí nad Labem
Systémové napětí: 48V
Výkon panelů [Wp]: 7100
Kapacita baterie [kWh]: 13
Chci prodávat energii: NE
Chci/Mám dotaci: NE

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od PetrDubi »

Hlavně si dej při sesazování pozor na to, že všechno v sekci substitution před dvojtečkou musí být jenom jednou a dál v kódu se dává ta část před dvojtečkou, aby dosadil to, co máš za dvojtečkou.
Takže tam nemůžeš mít třeba 2x name, ale musí tam být třeba name1 a name2, nemůžež mít 2x external_components_source: ale třeba external_components_source1: a external_components_source2: nebo external_components_source_victron: a external_components_source_bms: a potom musíš stejně pojmenovat jednotlivý položky v external_components (a to samé název, takže name v kódu).
mobilní elektrárna 3x Uni-solar PVL-68, 3x MPP modul, vše řízené přes arduino
doma 3280 Wp JV, 3810 Wp JZ, Easun SMW 8k (rebrandovaný MAX 8 kW), aku 13kWh 16s LiFePO4
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Díky za vysvětlení, přesně to jsem potřeboval vědět. Snad to dám nějak dohromady.
Pavel
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Zdravim, ještě bojuji se zdrojaky z githubu.

external_components:
- source1: ${external_components_source_1}
- source2: ${external_components_source_2}
refresh: 0s

Jak je mám zadefinovat?? Tohle to nebere.
glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

maj na webu priklad

https://esphome.io/components/external_components.html

takze nejak tak. Odsazeni si dolad, psal jsem to tu do editoru jenom

Kód: Vybrat vše

external_components:
   - source: ${external_components_source_1}
     refresh: 0s
   - source: ${external_components_source_2}
     refresh: 0s
xdjpcm
Příspěvky: 16
Registrován: čtv říj 06, 2022 2:11 pm

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od xdjpcm »

Díky, překompilovano, nahrano. Dam ještě zprávu, jak to rozjedu i na HW.
Díky všem za pomoc.
Uživatelský avatar
TomHC
Příspěvky: 1286
Registrován: pát lis 11, 2022 8:14 am
Lokalita: Hlohovec, SR
Systémové napětí: 48V
Výkon panelů [Wp]: 5520
Kapacita baterie [kWh]: 14
Chci prodávat energii: NE
Chci/Mám dotaci: NE
Bydliště: Hlohovec, SR

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od TomHC »

Ahojte, úspešne som do HA pridal JBD BMS cez EPShome (https://github.com/syssi/esphome-jbd-bms), rozmýšľam ako baterku zaintegrovať aj do Energy dashboardu. Ten vyžaduje dva senzory s device_class: energy a state_class: total_increasing , ja by som ich asi dal spočítavať z remaining_capacity a total_voltage. Len neviem či HA bude hodnoty nejako integrovať, alebo to musím zabezpečiť ja. Zatiaľ som našiel dve témy ktoré by to mohli pomôcť vyriešiť.

https://community.home-assistant.io/t/h ... ard/463059
https://community.home-assistant.io/t/h ... ery/221447

Máte to niekto rozbehané?
MUST PV1800 VHM 48V 5.5kW, 5.52kWp (12x TPL mono 460W, 2S2P východ, 2S4P juh), 16x 280 Ah LiFePO4 (14.3 kWh) BMS JBD-AP21S001-L21S-200A-B, SW: Home Assistant na Synology DS923+ ku tomu ESPHome, Tasmota, MariaDB, InfluxDB, Telegraf, Grafana, Zigbee2MQTT..., HW: ESPlan (ESP32 + LAN 8720 + RS485 + UART). Nejaké moje projekty: MUST-ESPhome, ELTEK Flatpack2 ESPhome, ESP32-EMON, PZEM-017@WiFi, diyBMS-CurrentShunt-ESPhome
glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

ja to mam pres victron shunt. JK BMS je bohuzel hodne nepresna a podle me je to ztrata casu a nema cenu se s tim zabyvat.
Uživatelský avatar
TomHC
Příspěvky: 1286
Registrován: pát lis 11, 2022 8:14 am
Lokalita: Hlohovec, SR
Systémové napětí: 48V
Výkon panelů [Wp]: 5520
Kapacita baterie [kWh]: 14
Chci prodávat energii: NE
Chci/Mám dotaci: NE
Bydliště: Hlohovec, SR

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od TomHC »

glottis píše:ja to mam pres victron shunt. JK BMS je bohuzel hodne nepresna a podle me je to ztrata casu a nema cenu se s tim zabyvat.
Ja nemám JK ale JBD. Nevravím že to bude nutne lepšie, ale uvidíme. O SoC drifte JK a Daly sa tu popísalo dosť, ale o JBD nepíše nikto. Inak bola tu aj otázka, prečo ESP nenapájať z UART konektora - že možno nebude vedieť dodať potrebný prúd pre ESP. Našiel som foto JBD BMS 200A kde je vidieť step down menič s cievkou (680), takže možno ten step-down je na tých 12V čo je na uarte, a teda by mal ESP utiahnuť v pohode. Vyskúšam cez týždeň.
Přílohy
JDB-BMS-200A.jpg
MUST PV1800 VHM 48V 5.5kW, 5.52kWp (12x TPL mono 460W, 2S2P východ, 2S4P juh), 16x 280 Ah LiFePO4 (14.3 kWh) BMS JBD-AP21S001-L21S-200A-B, SW: Home Assistant na Synology DS923+ ku tomu ESPHome, Tasmota, MariaDB, InfluxDB, Telegraf, Grafana, Zigbee2MQTT..., HW: ESPlan (ESP32 + LAN 8720 + RS485 + UART). Nejaké moje projekty: MUST-ESPhome, ELTEK Flatpack2 ESPhome, ESP32-EMON, PZEM-017@WiFi, diyBMS-CurrentShunt-ESPhome
Uživatelský avatar
rottenkiwi
Příspěvky: 5451
Registrován: pát úno 13, 2015 2:24 pm
Lokalita: SO, SK
Bydliště: SO, SK

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od rottenkiwi »

Jake su tam FET-y na balancovanie a ake na aktivny prechod z baterky von ?
Ma to BMS aj pomale nabijanie kapacit v menici ak to odpoji baterku ?
Merali ste niekto aku presnu to ma integraciu vykonu, ak napr. BMS odobera 50 - 100 mA
pocas 20 dni a do baterky z MPPT ide max. 0.5 - 0.7 A cele dni ?

Kde to driftuje ? K mensim SOC a rozchadza sa napatie a SOC ? ALebo k vacsim SOC ?
DC-AC inverter REC Lion DC-AC ESP32 DIY inv. 15 GB za sekundu DIY MPPT Holder
Zjedz vsetko, co si kupil, v obchode a netreba ti tasku, auto ci chladnicku.
glottis
Příspěvky: 2071
Registrován: stř úno 02, 2022 10:30 am
Lokalita: okolí Mělníka
Systémové napětí: 48V
Výkon panelů [Wp]: 13000
Kapacita baterie [kWh]: 15

Re: Monitoring BMS JBD přes Home Assistant

Příspěvek od glottis »

TomHC píše:
glottis píše:ja to mam pres victron shunt. JK BMS je bohuzel hodne nepresna a podle me je to ztrata casu a nema cenu se s tim zabyvat.
Ja nemám JK ale JBD. Nevravím že to bude nutne lepšie, ale uvidíme. O SoC drifte JK a Daly sa tu popísalo dosť, ale o JBD nepíše nikto. Inak bola tu aj otázka, prečo ESP nenapájať z UART konektora - že možno nebude vedieť dodať potrebný prúd pre ESP. Našiel som foto JBD BMS 200A kde je vidieť step down menič s cievkou (680), takže možno ten step-down je na tých 12V čo je na uarte, a teda by mal ESP utiahnuť v pohode. Vyskúšam cez týždeň.
Jo promin, sem se prekouk ... jbd

Tu jsme tu mel taky a taky to nebyla zadna slava ale chovala se opravdu lip

  • Podobná témata
    Odpovědi
    Zobrazení
    Poslední příspěvek