syssi / esphome-pipsolar

ESPHome component to monitor and control a pipsolar inverter via RS232
Apache License 2.0
78 stars 35 forks source link

pipsolar + jk_bms #104

Closed piotr-ino closed 5 months ago

piotr-ino commented 5 months ago

Hi. Syssi, can you combine both repositories into 1 file. Thank you

syssi commented 5 months ago

This is how it's look like if you merge both YAMLs:

The inverter / RS232 module must be attached to GPIO16/GPIO17. The JK-BMS (GPS port) must be attached to GPIO13/GPIO14.

substitutions:
  name: pipsolar-and-jkbms
  external_components_source: github://syssi/esphome-jk-bms@main
  tx_pin: GPIO16
  rx_pin: GPIO17
  tx_pin2: GPIO13
  rx_pin2: GPIO14

esphome:
  name: ${name}

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

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

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

ota:

logger:
  baud_rate: 0
  level: INFO

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
mqtt:
  broker: !secret mqtt_host
  username: !secret mqtt_username
  password: !secret mqtt_password
  id: mqtt_client

# api:

uart:
  - id: uart_0
    baud_rate: 2400
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}
#    debug:
#      direction: BOTH
#      dummy_receiver: false
#      after:
#        delimiter: "\r"
#      sequence:
#        - lambda: UARTDebug::log_string(direction, bytes);
  - id: uart_1
    baud_rate: 115200
    rx_buffer_size: 384
    tx_pin: ${tx_pin2}
    rx_pin: ${rx_pin2}

jk_modbus:
  - id: modbus0
    uart_id: uart_1
    rx_timeout: 50ms

jk_bms:
  - id: bms0
    jk_modbus_id: modbus0
    update_interval: 5s

pipsolar:
  uart_id: uart_0
  id: inverter0

sensor:
  - 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"
    # ...

  - platform: pipsolar
    pipsolar_id: inverter0
    # QPIRI
#    grid_rating_voltage:
#      name: "${name} grid_rating_voltage"
#    grid_rating_current:
#      name: "${name} grid_rating_current"
#    ac_output_rating_voltage:
#      name: "${name} ac_output_rating_voltage"
#    ac_output_rating_frequency:
#      name: "${name} ac_output_rating_frequency"
#    ac_output_rating_current:
#      name: "${name} ac_output_rating_current"
#    ac_output_rating_apparent_power:
#      name: "${name} ac_output_rating_apparent_power"
#    ac_output_rating_active_power:
#      name: "${name} ac_output_rating_active_power"
#    battery_rating_voltage:
#      name: "${name} battery_rating_voltage"
#    battery_recharge_voltage:
#      name: "${name} battery_recharge_voltage"
#    battery_under_voltage:
#      name: "${name} battery_under_voltage"
#    battery_bulk_voltage:
#      name: "${name} battery_bulk_voltage"
#    battery_float_voltage:
#      name: "${name} battery_float_voltage"
#    battery_type:
#      name: "${name} battery_type"
#    current_max_ac_charging_current:
#      name: "${name} current_max_ac_charging_current"
#    current_max_charging_current:
#      name: "${name} current_max_charging_current"
#    input_voltage_range:
#      name: "${name} input_voltage_range"
#    output_source_priority:
#      name: "${name} output_source_priority"
#    charger_source_priority:
#      name: "${name} charger_source_priority"
#    parallel_max_num:
#      name: "${name} parallel_max_num"
#    machine_type:
#      name: "${name} machine_type"
#    topology:
#      name: "${name} topology"
#    output_mode:
#      name: "${name} output_mode"
#    battery_redischarge_voltage:
#      name: "${name} battery_redischarge_voltage"
#    pv_ok_condition_for_parallel:
#      name: "${name} pv_ok_condition_for_parallel"
#    pv_power_balance:
#      name: "${name} pv_power_balance"

    # QPIGS
    grid_voltage:
      name: "${name} grid_voltage"
    grid_frequency:
      name: "${name} grid_frequency"
    ac_output_voltage:
      name: "${name} ac_output_voltage"
    ac_output_frequency:
      name: "${name} ac_output_frequency"
    ac_output_apparent_power:
      name: "${name} ac_output_apparent_power"
    ac_output_active_power:
      name: "${name} ac_output_active_power"
    output_load_percent:
      name: "${name} output_load_percent"
    bus_voltage:
      name: "${name} bus_voltage"
    battery_voltage:
      name: "${name} battery_voltage"
    battery_charging_current:
      name: "${name} battery_charging_current"
    battery_capacity_percent:
      name: "${name} battery_capacity_percent"
    inverter_heat_sink_temperature:
      name: "${name} inverter_heat_sink_temperature"
    pv_input_current_for_battery:
      name: "${name} pv_input_current_for_battery"
    pv_input_voltage:
      name: "${name} pv_input_voltage"
    battery_voltage_scc:
      name: "${name} battery_voltage_scc"
    battery_discharge_current:
      name: "${name} battery_discharge_current"
    battery_voltage_offset_for_fans_on:
      name: "${name} battery_voltage_offset_for_fans_on"
#    eeprom_version:
#      name: "${name} eeprom_version"
    pv_charging_power:
      name: "${name} pv_charging_power"

text_sensor:
  - 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"

  - platform: pipsolar
    pipsolar_id: inverter0
    device_mode:
      name: "${name} device_mode"
#    last_qpigs:
#      name: "${name} last_qpigs"
#    last_qpiri:
#      name: "${name} last_qpiri"
#    last_qmod:
#      name: "${name} last_qmod"
#    last_qflag:
#      name: "${name} last_qflag"

binary_sensor:
  - platform: jk_bms
    balancing:
      name: "${name} balancing"
    balancing_switch:
      name: "${name} balancing switch"
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"
    dedicated_charger_switch:
      name: "${name} dedicated charger switch"
    online_status:
      name: "${name} online status"

  - platform: pipsolar
    pipsolar_id: inverter0
    add_sbu_priority_version:
      name: "${name} add_sbu_priority_version"
    configuration_status:
      name: "${name} configuration_status"
#    scc_firmware_version:
#      name: "${name} scc_firmware_version"
    load_status:
      name: "${name} load_status"
    battery_voltage_to_steady_while_charging:
      name: "${name} battery_voltage_to_steady_while_charging"
    charging_status:
      name: "${name} charging_status"
    scc_charging_status:
      name: "${name} scc_charging_status"
    ac_charging_status:
      name: "${name} ac_charging_status"
    charging_to_floating_mode:
      name: "${name} charging_to_floating_mode"
    switch_on:
      name: "${name} switch_on"
#    dustproof_installed:
#      name: "${name} dustproof_installed"
    silence_buzzer_open_buzzer:
      name: "${name} silence_buzzer_open_buzzer"
    overload_bypass_function:
      name: "${name} overload_bypass_function"
    lcd_escape_to_default:
      name: "${name} lcd_escape_to_default"
    overload_restart_function:
      name: "${name} overload_restart_function"
    over_temperature_restart_function:
      name: "${name} over_temperature_restart_function"
#    backlight_on:
#      name: "${name} backlight_on"

switch:
  - platform: jk_bms
    charging:
      name: "${name} charging"
    discharging:
      name: "${name} discharging"

  - platform: pipsolar
    pipsolar_id: inverter0
    output_source_priority_utility:
      name: "${name} output_source_priority_utility"
    output_source_priority_solar:
      name: "${name} output_source_priority_solar"
    output_source_priority_battery:
      name: "${name} output_source_priority_battery"
    input_voltage_range:
      name: "${name} input_voltage_range"
    pv_ok_condition_for_parallel:
      name: "${name} pv_ok_condition_for_parallel"
    pv_power_balance:
      name: "${name} pv_power_balance"

output:
  - platform: pipsolar
    pipsolar_id: inverter0
    battery_recharge_voltage:
      id: inverter0_battery_recharge_voltage_out