-
-
Save vladyspavlov/d7819b255a81ea45659e63a1a92a66b2 to your computer and use it in GitHub Desktop.
| substitutions: | |
| name: "Bms" | |
| invertor_id: "invertor" | |
| invertor_name: "Invertor" | |
| battery_coefficient: '2' # battery voltage / 12 | |
| multiply_10: '5' # 10 / battery_coefficient | |
| updates: 5s | |
| esphome: | |
| name: battery-bms-invertor | |
| friendly_name: battery-bms-invertor | |
| esp32: | |
| board: esp32dev | |
| framework: | |
| type: arduino | |
| external_components: | |
| - source: github://syssi/esphome-jk-bms@main | |
| # Enable logging | |
| logger: | |
| # Enable Home Assistant API | |
| api: | |
| encryption: | |
| key: "$$$" | |
| ota: | |
| password: "$$$" | |
| wifi: | |
| ssid: !secret wifi_ssid | |
| password: !secret wifi_password | |
| uart: | |
| - id: uart_0 | |
| baud_rate: 115200 | |
| rx_buffer_size: 384 | |
| tx_pin: GPIO16 | |
| rx_pin: GPIO17 | |
| - id: uart_1 | |
| baud_rate: 9600 | |
| tx_pin: GPIO1 | |
| rx_pin: GPIO3 | |
| stop_bits: 1 | |
| debug: | |
| direction: BOTH | |
| dummy_receiver: false | |
| modbus: | |
| - id: modbus1 | |
| uart_id: uart_1 | |
| send_wait_time: 200ms | |
| modbus_controller: | |
| - id: smx | |
| address: 0x01 | |
| modbus_id: modbus1 | |
| command_throttle: 200ms | |
| setup_priority: -10 | |
| update_interval: ${updates} | |
| time: | |
| - platform: sntp | |
| globals: | |
| - id: ${invertor_id}_battery_reco_global | |
| type: int | |
| - id: ${invertor_id}_current_load_charging_mode_global | |
| type: int | |
| - id: ${invertor_id}_pv_power_total_veille_global | |
| type: float | |
| restore_value: yes | |
| - id: ${invertor_id}_charging_power_total_veille_global | |
| type: float | |
| restore_value: yes | |
| jk_modbus: | |
| - id: modbus0 | |
| uart_id: uart_0 | |
| rx_timeout: 50ms | |
| jk_bms: | |
| - id: bms0 | |
| jk_modbus_id: modbus0 | |
| update_interval: 1s | |
| binary_sensor: | |
| # - platform: status | |
| # name: "Inverter Bms ESP Status" | |
| - 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" | |
| sensor: | |
| - platform: uptime | |
| id: bms_invertor_uptime_sec | |
| # - platform: wifi_signal | |
| # name: WIFI puissance | |
| # update_interval: ${updates} | |
| - 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" | |
| ##### Grid Information ##### | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_grid_voltage | |
| name: ${invertor_name} grid voltage | |
| address: 0x213 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_grid_current | |
| name: ${invertor_name} grid current | |
| address: 0x214 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "A" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_grid_frequency | |
| name: ${invertor_name} grid frequency | |
| address: 0x215 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "Hz" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| filters: | |
| - multiply: 0.01 | |
| ###### Battery Information ##### | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_soc | |
| name: ${invertor_name} battery soc | |
| address: 0x100 | |
| unit_of_measurement: "%" | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| icon: mdi:percent | |
| skip_updates: 1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_voltage | |
| name: ${invertor_name} battery voltage | |
| address: 0x0101 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:sine-wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_charging_current | |
| name: ${invertor_name} charging current | |
| address: 0x0102 | |
| register_type: holding | |
| value_type: S_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| filters: | |
| - multiply: 0.1 | |
| ####### Output info ###### | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_load_voltage | |
| name: ${invertor_name} load voltage | |
| address: 0x216 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:voltage-ac | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_load_current | |
| name: ${invertor_name} load current | |
| address: 0x219 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "A" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_load_active_power | |
| name: ${invertor_name} load active power | |
| address: 0x21B | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "W" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_load_apparent_power | |
| name: ${invertor_name} load apparent power | |
| address: 0x21C | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "W" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_load_ratio | |
| name: ${invertor_name} load ratio | |
| address: 0x21F | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| unit_of_measurement: "%" | |
| skip_updates: 1 | |
| icon: mdi:wave | |
| ###### Temperatures ###### | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_temperature_dc | |
| name: ${invertor_name} temperature DC | |
| address: 0x220 | |
| register_type: holding | |
| value_type: S_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "C" | |
| skip_updates: 1 | |
| icon: mdi:thermometer | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_temperature_ac | |
| name: ${invertor_name} temperature AC | |
| address: 0x221 | |
| register_type: holding | |
| value_type: S_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "C" | |
| skip_updates: 1 | |
| icon: mdi:thermometer | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_name}_temperature_tr | |
| name: ${invertor_name} temperature TR | |
| address: 0x222 | |
| register_type: holding | |
| value_type: S_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "C" | |
| skip_updates: 1 | |
| icon: mdi:thermometer | |
| filters: | |
| - multiply: 0.1 | |
| ##### Charger ###### | |
| #################### System Informations ################## | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_max_voltage_supported | |
| name: ${invertor_name} max voltage supported | |
| address: 0x000A | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:sine-wave | |
| bitmask: 0xFF00 #(Bits 15-8) | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_rated_charging_current | |
| name: ${invertor_name} rated charging current | |
| address: 0x000A | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 0 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| bitmask: 0x00FF #(Bits 7-0) | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_rated_discharging_current | |
| name: ${invertor_name} rated discharging current | |
| address: 0x000B | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 0 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| bitmask: 0xFF00 #(Bits 15-8) | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_software_version | |
| name: ${invertor_name} software version | |
| register_type: holding | |
| address: 0x014 | |
| value_type: U_DWORD | |
| #response_size: 4 | |
| register_count: 2 | |
| skip_updates: 1 | |
| #raw_encode: NONE | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_hardware_version | |
| name: ${invertor_name} hardware version | |
| register_type: holding | |
| address: 0x016 | |
| #response_size: 4 | |
| value_type: U_DWORD | |
| #response_size: 4 | |
| register_count: 2 | |
| #raw_encode: NONE | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_product_serial_number | |
| name: ${invertor_name} product serial number | |
| register_type: holding | |
| address: 0x018 | |
| value_type: U_DWORD | |
| #response_size: 4 | |
| register_count: 2 | |
| #response_size: 4 | |
| #raw_encode: NONE | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_modbus_address | |
| name: ${invertor_name} modbus address | |
| register_type: holding | |
| address: 0x01A | |
| value_type: U_WORD | |
| bitmask: 0xFF #(Bits 7-0) | |
| skip_updates: 1 | |
| icon: mdi:numeric | |
| ################ Controller dynamic information# ############################## | |
| - platform: template | |
| id: ${invertor_id}_charging_power | |
| name: ${invertor_name} charging power | |
| accuracy_decimals: 1 | |
| icon: mdi:power | |
| unit_of_measurement: "W" | |
| update_interval: 2s | |
| lambda: |- | |
| return id(${invertor_id}_charging_current).state*id(${invertor_id}_battery_voltage).state; | |
| # - platform: template | |
| # id: ${invertor_id}_pv_battery_ratio | |
| # name: ${invertor_name} PV battery ratio | |
| # accuracy_decimals: 1 | |
| # unit_of_measurement: "%" | |
| # icon: mdi:percent | |
| # update_interval: 2s | |
| # lambda: |- | |
| # if (id(${invertor_id}_solar_panel_power).state != 0.0) { | |
| # return (id(${invertor_id}_charging_power).state/id(${invertor_id}_solar_panel_power).state)*100.0; | |
| # } | |
| # else{ | |
| # return 0; | |
| # } | |
| - platform: total_daily_energy | |
| id: ${invertor_id}_charging_power_total_du_jour | |
| name: ${invertor_name} charging Power total du jour | |
| power_id: ${invertor_id}_charging_power | |
| unit_of_measurement: "kWh" | |
| accuracy_decimals: 2 | |
| method: trapezoid | |
| filters: | |
| # Multiplication factor from W to kW is 0.001 | |
| - multiply: 0.001 | |
| icon: mdi:counter | |
| - platform: template | |
| id: ${invertor_id}_template_charging_power_total_veille | |
| name: ${invertor_name} charging power votal veille | |
| unit_of_measurement: "kWh" | |
| accuracy_decimals: 2 | |
| icon: mdi:power | |
| update_interval: ${updates} | |
| lambda: |- | |
| return (id(${invertor_id}_template_charging_power_total_veille).state = id(${invertor_id}_charging_power_total_veille_global)); | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_load_dc_voltage | |
| name: ${invertor_name} load dc voltage | |
| address: 0x104 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:sine-wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_load_dc_current | |
| name: ${invertor_name} load dc current | |
| address: 0x105 | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| filters: | |
| - multiply: 0.01 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_load_dc_power | |
| name: ${invertor_name} load dc power | |
| address: 0x106 | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:power | |
| unit_of_measurement: "W" | |
| # ############################## Solar Panel Informations ################## | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: ${invertor_id}_solar_panel_voltage | |
| # name: ${invertor_name} solar panel voltage | |
| # address: 0x107 | |
| # register_type: holding | |
| # value_type: U_WORD | |
| # accuracy_decimals: 1 | |
| # unit_of_measurement: "V" | |
| # skip_updates: 1 | |
| # icon: mdi:sine-wave | |
| # filters: | |
| # - multiply: 0.1 | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: ${invertor_id}_solar_panel_current | |
| # name: ${invertor_name} solar panel current | |
| # address: 0x108 | |
| # register_type: holding | |
| # value_type: U_WORD | |
| # skip_updates: 1 | |
| # accuracy_decimals: 1 | |
| # icon: mdi:current-dc | |
| # unit_of_measurement: "A" | |
| # filters: | |
| # - multiply: 0.01 | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: ${invertor_id}_solar_panel_power | |
| # name: ${invertor_name} solar panel power | |
| # address: 0x109 | |
| # register_type: holding | |
| # value_type: U_WORD | |
| # skip_updates: 1 | |
| # accuracy_decimals: 1 | |
| # icon: mdi:power | |
| # unit_of_measurement: "W" | |
| # - platform: total_daily_energy | |
| # id: ${invertor_id}_pv_power_total_du_jour | |
| # name: ${invertor_name} PV power total du jour | |
| # power_id: ${invertor_id}_solar_panel_power | |
| # unit_of_measurement: "kWh" | |
| # accuracy_decimals: 2 | |
| # method: trapezoid | |
| # filters: | |
| # # Multiplication factor from W to kW is 0.001 | |
| # - multiply: 0.001 | |
| # icon: mdi:counter | |
| # - platform: template | |
| # id: ${invertor_id}_template_pv_power_total_veille | |
| # name: ${invertor_name} PV power total veille | |
| # unit_of_measurement: "kWh" | |
| # accuracy_decimals: 2 | |
| # icon: mdi:power | |
| # update_interval: ${updates} | |
| # lambda: |- | |
| # return (id(${invertor_id}_template_pv_power_total_veille).state = id(${invertor_id}_pv_power_total_veille_global)); | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_load_dc_charging_status | |
| name: ${invertor_name} load dc charging status | |
| address: 0x010A | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| skip_updates: 1 | |
| bitmask: 1 | |
| icon: mdi:account-hard-hat | |
| ############################## Battery statistics ############################ | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_minimum_voltage_current_day | |
| name: ${invertor_name} battery minimum voltage current day | |
| address: 0x010B | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:sine-wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_maximumvoltage_current_day | |
| name: ${invertor_name} battery maximum voltage current day | |
| address: 0x010C | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 1 | |
| unit_of_measurement: "V" | |
| skip_updates: 1 | |
| icon: mdi:sine-wave | |
| filters: | |
| - multiply: 0.1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_maximum_charging_current_day | |
| name: ${invertor_name} battery maximum charging current day | |
| address: 0x010D | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| filters: | |
| - multiply: 0.01 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_maximum_discharging_current_day | |
| name: ${invertor_name} battery maximum discharging current day | |
| address: 0x010E | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:current-dc | |
| unit_of_measurement: "A" | |
| filters: | |
| - multiply: 0.01 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_maximum_charging_power_current_day | |
| name: ${invertor_name} battery maximum charging power current day | |
| address: 0x010F | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:power | |
| unit_of_measurement: "W" | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_maximum_discharging_power_current_day | |
| name: ${invertor_name} battery maximum discharging power current day | |
| address: 0x0110 | |
| register_type: holding | |
| value_type: U_WORD | |
| skip_updates: 1 | |
| accuracy_decimals: 1 | |
| icon: mdi:power | |
| unit_of_measurement: "W" | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_power_generation_current_day | |
| # # name: ${invertor_name} power generation current day | |
| # # address: 0x0113 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 2 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "kWh" | |
| # # filters: | |
| # # - multiply: 0.001 | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_power_consumption_current_day | |
| # # name: ${invertor_name} power consumption current day | |
| # # address: 0x0114 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 2 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "kWh" | |
| # # filters: | |
| # # - multiply: 0.001 | |
| # #################### Historical data information ################## | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_total_number_operating_day | |
| # # name: ${invertor_name} total number operating day | |
| # # address: 0x0115 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # icon: mdi:calendar-today | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_total_number_battery_overdischarge | |
| # # name: ${invertor_name} total number battery overdischarge | |
| # # address: 0x0116 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # icon: mdi:flash-alert | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_total_number_battery_fullcharge | |
| # # name: ${invertor_name} total number battery fullcharge | |
| # # address: 0x0117 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # icon: mdi:battery-charging-high | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_total_charging_ah_battery | |
| # # name: ${invertor_name} total charging Ah battery | |
| # # address: 0x0118 | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "AH" | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_total_discharging_ah_battery | |
| # # name: ${invertor_name} total discharging Ah battery | |
| # # address: 0x011A | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "AH" | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_power_generation_total | |
| # # name: ${invertor_name} power generation total | |
| # # address: 0x011C | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 2 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "kWh" | |
| # # filters: | |
| # # - multiply: 0.001 | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_power_consumption_total | |
| # # name: ${invertor_name} power consumption total | |
| # # address: 0x011E | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 2 | |
| # # icon: mdi:power | |
| # # unit_of_measurement: "kWh" | |
| # # filters: | |
| # # - multiply: 0.001 | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_warnings_and_errors_hi | |
| # # name: ${invertor_name} warnings and errors hi | |
| # # icon: mdi:alert-circle | |
| # # address: 0x0121 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # lambda: |- | |
| # # //ESP_LOGD("Register 0x0121","Lambda incoming value=%d - data array size is %d",int(x),data.size()); | |
| # # id(${invertor_id}_warnings_and_errors_hi_template).publish_state(int(x)); | |
| # # return x; | |
| # # - platform: template | |
| # # id: ${invertor_id}_warnings_and_errors_hi_template | |
| # # #name: ${invertor_name}_warnings_and_errors_hi_template | |
| # # icon: mdi:alert-circle | |
| # # accuracy_decimals: 0 | |
| # # #update_interval: ${updates} | |
| # # on_value: | |
| # # then: | |
| # # - script.execute: | |
| # # id: ${invertor_id}_warnings_and_errors_hi_script | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_warnings_and_errors_low | |
| # # name: ${invertor_name} warnings and errors low | |
| # # icon: mdi:alert-circle | |
| # # address: 0x0122 | |
| # # register_type: holding | |
| # # value_type: U_WORD | |
| # # skip_updates: 1 | |
| # # lambda: |- | |
| # # //ESP_LOGD("Register 0x0122","Lambda incoming value=%d - data array size is %d",int(x),data.size()); | |
| # # id(${invertor_id}_warnings_and_errors_low_template).publish_state(int(x)); | |
| # # return x; | |
| # # - platform: template | |
| # # id: ${invertor_id}_warnings_and_errors_low_template | |
| # # #name: ${invertor_name}_warnings_and_errors_low_template | |
| # # icon: mdi:alert-circle | |
| # # accuracy_decimals: 0 | |
| # # #update_interval: ${updates} | |
| # # on_value: | |
| # # then: | |
| # # - script.execute: | |
| # # id: ${invertor_id}_warnings_and_errors_low_script | |
| # ################## Load informations #################### | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_street_light_status | |
| # # name: ${invertor_name} street light | |
| # # icon: mdi:outdoor-lamp | |
| # # bitmask: 0x8000 | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # address: 0x0120 | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: ${invertor_id}_street_brightness_level | |
| # # name: ${invertor_name} street brightness level | |
| # # icon: mdi:outdoor-lamp | |
| # # bitmask: 0x7F00 | |
| # # register_type: holding | |
| # # value_type: U_DWORD | |
| # # skip_updates: 1 | |
| # # accuracy_decimals: 0 | |
| # # address: 0x0120 | |
| # ########################### Battery parameters ################### | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: ${invertor_id}_charging_current_limit | |
| # name: ${invertor_name} charging current limit | |
| # address: 0xE001 | |
| # register_type: holding | |
| # value_type: U_WORD | |
| # unit_of_measurement: 'A' | |
| # icon: mdi:current-dc | |
| # accuracy_decimals: 0 | |
| # filters: | |
| # - multiply: 0.01 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_battery_capacity | |
| name: ${invertor_name} battery capacity | |
| address: 0xE002 | |
| register_type: holding | |
| value_type: U_WORD | |
| unit_of_measurement: 'Ah' | |
| icon: mdi:car-battery | |
| accuracy_decimals: 0 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_temperature_compensation_factor | |
| name: ${invertor_name} temperature compensation factor | |
| address: 0xE014 | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| unit_of_measurement: "mV/°C/2V" | |
| icon: mdi:thermometer | |
| skip_updates: 1 | |
| filters: | |
| - multiply: -1 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_load_working_mode | |
| name: ${invertor_name} load working mode | |
| address: 0xE01D | |
| register_type: holding | |
| value_type: U_WORD | |
| accuracy_decimals: 0 | |
| icon: mdi:account-hard-hat | |
| skip_updates: 1 | |
| switch: | |
| - platform: jk_bms | |
| charging: | |
| name: "${name} charging" | |
| discharging: | |
| name: "${name} discharging" | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_power_switch | |
| name: ${invertor_name} power | |
| address: 0xDF00 | |
| register_type: holding | |
| use_write_multiple: True | |
| bitmask: 1 | |
| # icon: mdi:wave | |
| number: | |
| ############## Battery Related Parameters ############## | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE005 | |
| id: ${invertor_id}_overcharge_voltage | |
| name: ${invertor_name} overcharge voltage | |
| value_type: U_WORD | |
| unit_of_measurement: 'V' | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| icon: mdi:sine-wave | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE006 | |
| id: ${invertor_id}_charging_voltage_limit | |
| name: ${invertor_name} charging voltage limit | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE007 | |
| id: ${invertor_id}_equalizing_charge_voltage | |
| name: ${invertor_name} equalizing charge voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE008 | |
| id: ${invertor_id}_boost_voltage | |
| name: ${invertor_name} boost voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE009 | |
| id: ${invertor_id}_float_voltage | |
| name: ${invertor_name} float voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE00A | |
| id: ${invertor_id}_boost_charging_recovery_voltage | |
| name: ${invertor_name} boost charging recovery voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE00B | |
| id: ${invertor_id}_over_discharge_recovery_voltage | |
| name: ${invertor_name} over discharge recovery voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE00C | |
| id: ${invertor_id}_under_voltage_warning | |
| name: ${invertor_name} under voltage warning | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE00D | |
| id: ${invertor_id}_over_discharge_voltage | |
| name: ${invertor_name} over discharge voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| address: 0xE00E | |
| id: ${invertor_id}_discharge_limit_voltage | |
| name: ${invertor_name} discharge limit voltage | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_overdischarge_time_delay | |
| name: ${invertor_name} overdischarge time delay | |
| address: 0xE010 | |
| value_type: U_WORD | |
| unit_of_measurement: "s" | |
| icon: mdi:timer-sand | |
| min_value: 0 | |
| max_value: 120 | |
| step: 1 | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_equalizing_charging_time | |
| name: ${invertor_name} equalizing charging time | |
| address: 0xE011 | |
| value_type: U_WORD | |
| unit_of_measurement: "min" | |
| icon: mdi:timer-sand | |
| min_value: 0 | |
| max_value: 600 | |
| step: 10 | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_boost_charging_time | |
| name: ${invertor_name} boost charging time | |
| address: 0xE012 | |
| value_type: U_WORD | |
| unit_of_measurement: "min" | |
| icon: mdi:timer-sand | |
| min_value: 10 | |
| max_value: 600 | |
| step: 10 | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_equalizing_charging_interval | |
| name: ${invertor_name} equalizing charging interval | |
| address: 0xE013 | |
| value_type: U_WORD | |
| unit_of_measurement: "day" | |
| icon: mdi:timer-sand | |
| min_value: 0 | |
| max_value: 255 | |
| step: 1 | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_equalizing_charge_timeout_time | |
| name: ${invertor_name} equalizing charging interval | |
| address: 0xE013 | |
| value_type: U_WORD | |
| unit_of_measurement: "day" | |
| icon: mdi:timer-sand | |
| min_value: 0 | |
| max_value: 255 | |
| step: 1 | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_mains_switching_voltage | |
| name: ${invertor_name} mains switching voltage | |
| address: 0xE01B | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| - platform: modbus_controller | |
| id: ${invertor_id}_inverter_switching_voltage | |
| name: ${invertor_name} inverter switching voltage | |
| address: 0xE022 | |
| unit_of_measurement: 'V' | |
| icon: mdi:sine-wave | |
| min_value: 18 | |
| max_value: 31 | |
| step: 0.1 | |
| multiply: ${multiply_10} | |
| mode: 'box' | |
| ############ Inverter parameters ########## | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_mains_charge_current_limit | |
| name: ${invertor_name} max charge current limit | |
| address: 0xE205 | |
| value_type: U_WORD | |
| unit_of_measurement: 'A' | |
| icon: mdi:current-dc | |
| mode: 'box' | |
| min_value: 0 | |
| max_value: 80 | |
| step: 5 | |
| multiply: 10 | |
| - platform: modbus_controller | |
| modbus_controller_id: smx | |
| id: ${invertor_id}_max_charge_current | |
| name: ${invertor_name} max charge current | |
| address: 0xE20A | |
| value_type: U_WORD | |
| unit_of_measurement: 'A' | |
| icon: mdi:current-dc | |
| mode: 'box' | |
| min_value: 0 | |
| max_value: 80 | |
| step: 5 | |
| multiply: 10 | |
| - platform: modbus_controller | |
| id: ${invertor_id}_battery_capacity_number | |
| name: ${invertor_name}_battery_capacity_number | |
| address: 0xE002 | |
| value_type: U_WORD | |
| unit_of_measurement: 'Ah' | |
| icon: mdi:car-battery | |
| min_value: 50 | |
| max_value: 1000 | |
| step: 10 | |
| mode: 'box' | |
| 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: modbus_controller | |
| modbus_controller_id: smx | |
| name: ${invertor_name} charge state | |
| address: 0x010B | |
| register_type: holding | |
| raw_encode: HEXBYTES | |
| lambda: |- | |
| uint16_t value = modbus_controller::word_from_hex_str(x, 0); | |
| switch (value) { | |
| case 0: return std::string("Not start"); | |
| case 1: return std::string("Const current"); | |
| case 2: return std::string("Const voltage"); | |
| case 3: return std::string("Reserved 3"); | |
| case 4: return std::string("Float charge"); | |
| case 5: return std::string("Reserved 5"); | |
| case 6: return std::string("Li battery acitvate"); | |
| case 7: return std::string("Reserved 7"); | |
| } | |
| return std::string("Unknown"); | |
| # ########## EASUN ###### | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: product_type | |
| # name: ${invertor_name} product type | |
| # bitmask: 0 | |
| # register_type: holding | |
| # address: 0x00B | |
| # raw_encode: HEXBYTES | |
| # lambda: |- | |
| # uint16_t value = modbus_controller::word_from_hex_str(x, 0); | |
| # switch (value) { | |
| # case 0: return - platform: modbus_controller | |
| # case 1: return std::string("Inverter"); | |
| # default: return std::string("Unknown"); | |
| # } | |
| # return x; | |
| # # - platform: modbus_controller | |
| # # modbus_controller_id: smx | |
| # # id: charging_mode | |
| # # name: ${invertor_name} charging mode | |
| # # icon: mdi:list-status | |
| # # #bitmask: 0 | |
| # # register_type: holding | |
| # # address: 0x0120 | |
| # # raw_encode: HEXBYTES | |
| # # lambda: |- | |
| # # uint16_t value = modbus_controller::word_from_hex_str(x, 0); | |
| # # switch (value) { | |
| # # case 0: return std::string("Charging desactivated"); | |
| # # case 1: return std::string("Charging activated"); | |
| # # case 2: return std::string("MPPT charge mode"); | |
| # # case 3: return std::string("Equalizing charge mode"); | |
| # # case 4: return std::string("Boost charge mode"); | |
| # # case 5: return std::string("Float charge mode"); | |
| # # case 6: return std::string("Current limiting"); | |
| # # default: return std::string("Unknown"); | |
| # # } | |
| # # return x; | |
| # - platform: modbus_controller | |
| # modbus_controller_id: smx | |
| # id: product_model | |
| # name: ${invertor_name} product model | |
| # register_type: holding | |
| # address: 0x00C | |
| # response_size: 16 | |
| # raw_encode: NONE | |
| # - platform: template | |
| # id: warnings_and_errors_hi_text | |
| # name: ${invertor_name} warnings and errors hi text | |
| # icon: mdi:alert-circle | |
| # - platform: template | |
| # id: ${invertor_id}_warnings_and_errors_low_text | |
| # name: ${invertor_name} warnings and errors low text | |
| # icon: mdi:alert-circle | |
| # - platform: template | |
| # id: charger_status_text | |
| # name: ${invertor_name} battery type text | |
| # icon: mdi:car-battery | |
| # update_interval: ${updates} | |
| # lambda: |- | |
| # if (isnan(id(${invertor_id}_battery_type).state)) { | |
| # return {"KO"}; | |
| # } | |
| # else { | |
| # static const char *battery_list[] = {"User defined","Open (FLD)", "Sealed (SLD)", "Gel" , "Lithium"}; | |
| # return {battery_list[int(id(${invertor_id}_battery_type).state)]}; | |
| # } | |
| # - platform: template | |
| # name: ${invertor_name} uptime total # Temps total depuis le démarrage de la carte | |
| # lambda: |- | |
| # int seconds = (id(bms_invertor_uptime_sec).state); | |
| # int days = seconds / (24 * 3600); | |
| # seconds = seconds % (24 * 3600); | |
| # int hours = seconds / 3600; | |
| # seconds = seconds % 3600; | |
| # int minutes = seconds / 60; | |
| # seconds = seconds % 60; | |
| # if ( days ) { | |
| # return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s ").c_str() }; | |
| # } else if ( hours ) { | |
| # return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s ").c_str() }; | |
| # } else if ( minutes ) { | |
| # return { (String(minutes) +"m "+ String(seconds) +"s ").c_str() }; | |
| # } else { | |
| # return { (String(seconds) +"s ").c_str() }; | |
| # } | |
| # icon: mdi:clock-start | |
| # update_interval: 113s | |
| script: | |
| # # - id: ${invertor_id}_warnings_and_errors_hi_script | |
| # # then: | |
| # # - lambda: |- | |
| # # bool first = true; | |
| # # const uint16_t mask = (id(${invertor_id}_warnings_and_errors_hi_template).state); | |
| # # std::string errors_list = ""; | |
| # # static const char *const ERRORS_HI[16] = { | |
| # # "Reserved", // Byte 0.0, warning | |
| # # "Reserved", // Byte 0.1, alarm | |
| # # "Reserved", // Byte 0.2, alarm | |
| # # "Reserved", // Byte 0.3, alarm | |
| # # "Reserved", // Byte 0.4, alarm | |
| # # "Reserved", // Byte 0.5, alarm | |
| # # "Main power supply" , // Byte 0.6, alarm | |
| # # "No battery detected", // Byte 0.7, alarm | |
| # # "Battery high temperature protection => prohibit charging", // Byte 1.0, alarm | |
| # # "Battery low temperature protection => prohibit charging", // Byte 1.1, alarm | |
| # # "Overcharge protection=>no charging", // Byte 1.2, alarm | |
| # # "Battery low temperature protection > stopping charging", // Byte 1.3, alarm | |
| # # "Battery reversly connected", // Byte 1.4, alarm | |
| # # "Capacitor overvoltage", // Byte 1.5, alarm | |
| # # "Induction probe damaged (street light)", // Byte 1.6, alarm | |
| # # "Load open circuit (street light)", // Byte 1.7, alarm | |
| # # }; | |
| # # if (mask) { | |
| # # for (int i = 0; i < 16; i++) { | |
| # # if (mask & (1 << i)) { | |
| # # if (first) { | |
| # # first = false; | |
| # # } | |
| # # else { | |
| # # errors_list.append(";"); | |
| # # } | |
| # # errors_list.append(ERRORS_HI[i]); | |
| # # } | |
| # # } | |
| # # } | |
| # # id(warnings_and_errors_hi_text).publish_state(errors_list); | |
| # # - id: ${invertor_id}_warnings_and_errors_low_script | |
| # # then: | |
| # # - lambda: |- | |
| # # bool first = true; | |
| # # const uint16_t mask = (id(${invertor_id}_warnings_and_errors_low_template).state); | |
| # # std::string errors_list = ""; | |
| # # static const char *const ERRORS_LOW[16] = { | |
| # # "Battery overdischarge", // Byte 0.0, warning | |
| # # "Battery overvoltage", // Byte 0.1, alarm | |
| # # "Battery undervoltage", // Byte 0.2, alarm | |
| # # "Load short-circuit", // Byte 0.3, alarm | |
| # # "Load overpower", // Byte 0.4, alarm | |
| # # "Controller temperature too high", // Byte 0.5, alarm | |
| # # "Battery high temperature protection => prohibit charging" , // Byte 0.6, alarm | |
| # # "Photovoltaic input overpower", // Byte 0.7, alarm | |
| # # "Reserved", // Byte 1.0, alarm | |
| # # "Photovoltaic input overvoltage", // Byte 1.1, alarm | |
| # # "Reserved", // Byte 1.2, alarm | |
| # # "Photovoltaic working point overvoltage", // Byte 1.3, alarm | |
| # # "Solar panel reversly connected", // Byte 1.4, alarm | |
| # # "Reserved", // Byte 1.5, alarm | |
| # # "Reserved", // Byte 1.6, alarm | |
| # # "Reserved", // Byte 1.7, alarm | |
| # # }; | |
| # # if (mask) { | |
| # # for (int i = 0; i < 16; i++) { | |
| # # if (mask & (1 << i)) { | |
| # # if (first) { | |
| # # first = false; | |
| # # } | |
| # # else { | |
| # # errors_list.append(";"); | |
| # # } | |
| # # errors_list.append(ERRORS_LOW[i]); | |
| # # } | |
| # # } | |
| # # } | |
| # # id(${invertor_id}_warnings_and_errors_low_text).publish_state(errors_list); | |
| - id: turn_on_dc_load_script | |
| then: | |
| - globals.set: | |
| id: ${invertor_id}_current_load_charging_mode_global | |
| value: !lambda return ( id(${invertor_id}_current_load_charging_mode_global) = int( id(${invertor_id}_load_working_mode).state) ); | |
| - delay: 200ms | |
| - lambda: |- | |
| esphome::modbus_controller::ModbusController *controller = id(smx); | |
| std::vector<uint16_t> register_settings(1); | |
| register_settings[0] = uint16_t(15); //go in manual mode <=> write 15 in 0xE01D | |
| //ESP_LOGD("script","value to be written in E01D = %d",register_settings[0]); | |
| esphome::modbus_controller::ModbusCommandItem register_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0xE01D, register_settings.size() , | |
| register_settings); | |
| delay(200); | |
| controller->queue_command(register_command); | |
| delay(200); | |
| - delay: 3s | |
| - lambda: |- | |
| esphome::modbus_controller::ModbusController *controller = id(smx); | |
| std::vector<uint16_t> register_settings(1); | |
| register_settings[0] = uint16_t(1); //turn on dc load <=> write 1 in 0x010A | |
| ESP_LOGD("script turn on regx010A","value to be written in x010A = %d",register_settings[0]); | |
| esphome::modbus_controller::ModbusCommandItem register_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0x010A, register_settings.size() , | |
| register_settings); | |
| delay(200); | |
| controller->queue_command(register_command); | |
| delay(200); | |
| - id: turn_off_dc_load_script | |
| then: | |
| - lambda: |- | |
| esphome::modbus_controller::ModbusController *controller = id(smx); | |
| std::vector<uint16_t> register_settings(1); | |
| register_settings[0] = uint16_t(0); //turn off dc load <=> write 1 in 0x010A | |
| ESP_LOGD("script turn off regx010A","value to be written in 010A = %d",register_settings[0]); | |
| esphome::modbus_controller::ModbusCommandItem register_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0x010A, register_settings.size() , | |
| register_settings); | |
| delay(200); | |
| controller->queue_command(register_command); | |
| delay(200); | |
| - lambda: |- | |
| esphome::modbus_controller::ModbusController *controller = id(smx); | |
| std::vector<uint16_t> register_settings(1); | |
| register_settings[0] = uint16_t(id(${invertor_id}_current_load_charging_mode_global)); //return in previous mode <=> write in 0xE01D | |
| //ESP_LOGD("script","value to be written in E01D = %d",register_settings[0]); | |
| esphome::modbus_controller::ModbusCommandItem register_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0xE01D, register_settings.size() , | |
| register_settings); | |
| delay(200); | |
| controller->queue_command(register_command); | |
| delay(200); | |
| - id: write_E003_register_script | |
| # parameters: | |
| # current_controller: "esphome::modbus_controller::ModbusController *" | |
| then: | |
| - lambda: |- | |
| esphome::modbus_controller::ModbusController *controller = id(smx); | |
| //esphome::modbus_controller::ModbusController *controller = current_controller; | |
| std::vector<uint16_t> battery_settings(1); | |
| battery_settings[0] = uint16_t( 3072*${battery_coefficient} + id(${invertor_id}_battery_reco_global)); | |
| //ESP_LOGD("script","value to be written in E003 = %d",battery_settings[0]); | |
| esphome::modbus_controller::ModbusCommandItem battery_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0xE003, battery_settings.size() , | |
| battery_settings); | |
| delay(200); | |
| controller->queue_command(battery_command); | |
| delay(200); |
Друже підкажи будь ласка в мене ESP 32 lite та MUST PH18 - 5248pro , прошив по твоему зразку ... тільки змінив піни на tx_pin: 17
rx_pin: 16 пробував через USB та RJ-45 , (Duplicate modbus command found: type=0x3 address=15217 count=5
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=20109 count=1
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=20111 count=1
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=20118 count=2
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25205 count=12
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25226 count=1
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25233 count=3
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25237 count=6
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25247 count=8
19:57:03 [W] [modbus_controller:185]
Duplicate modbus command found: type=0x3 address=25277 count=1
19:57:03 [W] [component:237]
Component modbus_controller took a long time for an operation (90 ms).
19:57:03 [W] [component:238]
Components should block for at most 30 ms.
19:57:08 [W] [modbus_controller:185] ) Через USB рідний Солар Монітор - робить.... Мабуть щось опускаю .... Велика Дяка за хоч яку думку ....
That’s a pity. I’ve been trying different options for a while and thought I finally found something that would work for my inverter. Thanks for letting me know anyway!