My yaml is a very long and can not be uploaded as file to here.
Is for completely remote monitoring my PVE and I try to test it.
substitutions:
name: fve
device_description: "Monitor and control FVE"
updates: 30s
epever_rx: GPIO18
epever_tx: GPIO19
inv1_rx: GPIO16
inv1_tx: GPIO17
inv2_rx: GPIO25
inv2_tx: GPIO26
nextion_rx: GPIO32
nextion_tx: GPIO33
bms0: "${name} bms0"
bms1: "${name} bms1"
external_components_source_1: github://syssi/esphome-jk-bms@main
external_components_source_2: github://syssi/esphome-pipsolar@2424mse1
bms0_mac_address: C8:47:8C:E4:51:FA
bms1_mac_address: C8:47:8C:E4:52:9D
bms0_protocol_version: JK02
bms1_protocol_version: JK02
external_components:
- source: ${external_components_source_1}
refresh: 0s
- source: ${external_components_source_2}
refresh: 0s
esphome:
name: ${name}
platformio_options:
friendly_name: fve
build_flags:
- -DCONFIG_ARDUINO_LOOP_STACK_SIZE=32768
# TIME do EPEVER
on_boot:
priority: -100
then:
- lambda: |-
// get local time and sync to controller
time_t now = ::time(nullptr);
struct tm *time_info = ::localtime(&now);
int seconds = time_info->tm_sec;
int minutes = time_info->tm_min;
int hour = time_info->tm_hour;
int day = time_info->tm_mday;
int month = time_info->tm_mon + 1;
int year = time_info->tm_year % 100;
esphome::modbus_controller::ModbusController *controller = id(epever);
// if there is no internet connection localtime returns year 70
if (year != 70) {
// create the payload
std::vector<uint16_t> rtc_data = {uint16_t((minutes << 8) | seconds), uint16_t((day << 8) | hour),
uint16_t((year << 8) | month)};
// Create a modbus command item with the time information as the payload
esphome::modbus_controller::ModbusCommandItem set_rtc_command =
esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0x9013, 3, rtc_data);
// Submit the command to the send queue
epever->queue_command(set_rtc_command);
ESP_LOGI("ModbusLambda", "EPSOLAR RTC set to %02d:%02d:%02d %02d.%02d.%04d", hour, minutes, seconds, day, month,
year + 2000);
}
esp32:
board: esp32dev
framework:
type: arduino
logger:
level: INFO
api:
reboot_timeout: 0s
esp32_ble_tracker:
ble_client:
- mac_address: ${bms0_mac_address}
id: client0
- mac_address: ${bms1_mac_address}
id: client1
jk_bms_ble:
- ble_client_id: client0
protocol_version: ${bms0_protocol_version}
throttle: 10s
id: bms0
- ble_client_id: client1
protocol_version: ${bms1_protocol_version}
throttle: 10s
id: bms1
ota:
web_server:
port: 80
#wifi:
# ssid: !secret wifi_ssid_0
# password: !secret wifi_password
#captive_portal:
time:
- platform: sntp
id: sntp_time
# před půlnocí přičte denní energii k totální energii
on_time:
- seconds: 59
minutes: 59
hours: 23
then:
lambda: |-
id(inverter1_total_line_energy) += id(inverter1_line_energy);
id(inverter1_total_inverter_energy) += id(inverter1_line_energy);
id(inverter1_total_pv_energy) += id(inverter1_pv_energy);
id(inverter1_total_battery_charging_energy) += id(inverter1_battery_charging_energy);
id(inverter1_total_battery_discharging_energy) += id(inverter1_battery_discharging_energy);
id(inverter2_total_line_energy) += id(inverter2_line_energy);
id(inverter2_total_inverter_energy) += id(inverter2_line_energy);
id(inverter2_total_pv_energy) += id(inverter2_pv_energy);
id(inverter2_total_battery_charging_energy) += id(inverter2_battery_charging_energy);
id(inverter2_total_battery_discharging_energy) += id(inverter2_battery_discharging_energy);
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO22
clk_mode: GPIO0_IN
phy_addr: 0
uart:
- id: mod_bus
tx_pin: ${epever_tx}
rx_pin: ${epever_rx}
baud_rate: 115200
stop_bits: 1
- id: inv1_uart
tx_pin: ${inv1_tx}
rx_pin: ${inv1_rx}
baud_rate: 2400
- id: inv2_uart
tx_pin: ${inv2_tx}
rx_pin: ${inv2_rx}
baud_rate: 2400
- id: nextion_uart
tx_pin: ${nextion_tx}
rx_pin: ${nextion_rx}
baud_rate: 115200
modbus:
#flow_control_pin: 23
uart_id: mod_bus
send_wait_time: 200ms
id: mod_bus_epever
modbus_controller:
- id: epever
address: 0x1
modbus_id: mod_bus_epever
command_throttle: 200ms
setup_priority: -10
update_interval: ${updates}
pipsolar:
- uart_id: inv1_uart
id: inverter1
- uart_id: inv2_uart
id: inverter2
globals:
- id: inverter1_total_line_energy
type: float
restore_value: True
- id: inverter1_total_inverter_energy
type: float
restore_value: True
- id: inverter1_total_pv_energy
type: float
restore_value: True
- id: inverter1_total_battery_charging_energy
type: float
restore_value: True
- id: inverter1_total_battery_discharging_energy
type: float
restore_value: True
- id: inverter2_total_line_energy
type: float
restore_value: True
- id: inverter2_total_inverter_energy
type: float
restore_value: True
- id: inverter2_total_pv_energy
type: float
restore_value: True
- id: inverter2_total_battery_charging_energy
type: float
restore_value: True
- id: inverter2_total_battery_discharging_energy
type: float
restore_value: True
sensor:
# EPEVER
- platform: template
accuracy_decimals: 0
name: "Generated Charge today"
id: generated_charge_today
unit_of_measurement: "Ah"
- platform: modbus_controller
modbus_controller_id: epever
id: array_rated_voltage
name: "array_rated_voltage"
address: 0x3000
skip_updates: 60
unit_of_measurement: "V"
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: array_rated_current
name: "array_rated_current"
address: 0x3001
unit_of_measurement: "A"
register_type: read
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: array_rated_power
name: "array_rated_power"
address: 0x3002
register_count: 2
unit_of_measurement: "W"
register_type: read
value_type: U_DWORD_R
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: battery_rated_voltage
name: "battery_rated_voltage"
address: 0x3004
unit_of_measurement: "V"
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: battery_rated_current
name: "battery_rated_current"
address: 0x3005
unit_of_measurement: "A"
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: battery_rated_power
name: "battery_rated_power"
address: 0x3006
unit_of_measurement: "W"
register_type: read
value_type: U_DWORD_R
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: charging_mode
name: "charging_mode"
address: 0x3008
unit_of_measurement: ""
register_type: read
value_type: U_WORD
accuracy_decimals: 0
- platform: modbus_controller
modbus_controller_id: epever
id: pv_input_voltage
name: "PV array input voltage"
address: 0x3100
unit_of_measurement: "V" ## for any other unit the value is returned in minutes
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: pv_input_current
name: "PV array input current"
address: 0x3101
unit_of_measurement: "A" ## for any other unit the value is returned in minutes
register_type: read
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: pv_input_power
name: "PV array input power"
address: 0x3102
unit_of_measurement: "W" ## for any other unit the value is returned in minutes
register_type: read
value_type: U_DWORD_R
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: charging_voltage
name: "Charging voltage"
address: 0x3104
unit_of_measurement: "V"
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: charging_current
name: "Charging current"
address: 0x3105
unit_of_measurement: "A"
register_type: read
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: charging_power
name: "Charging power"
address: 0x3106
unit_of_measurement: "W"
register_type: read
value_type: U_DWORD_R
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: device_temperature
name: "Device temperature"
address: 0x3111
unit_of_measurement: °C
register_type: read
value_type: S_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: power_components_temperature
name: "Power components temperature"
address: 0x3112
unit_of_measurement: °C
register_type: read
value_type: S_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: epever
id: Charger_status
name: "Charger status"
address: 0x3201
register_type: read
value_type: U_WORD
accuracy_decimals: 0
- platform: modbus_controller
modbus_controller_id: epever
id: generated_energy_total
name: "Generated energy total"
address: 0x3312
register_type: read
value_type: U_DWORD_R
accuracy_decimals: 1
filters:
- multiply: 0.01
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
delta_cell_voltage:
name: "${bms0} delta cell voltage"
average_cell_voltage:
name: "${bms0} average cell voltage"
total_voltage:
name: "${bms0} total voltage"
current:
name: "${bms0} current"
power:
name: "${bms0} power"
temperature_sensor_1:
name: "${bms0} temperature sensor 1"
temperature_sensor_2:
name: "${bms0} temperature sensor 2"
power_tube_temperature:
name: "${bms0} power tube temperature"
state_of_charge:
name: "${bms0} state of charge"
capacity_remaining:
name: "${bms0} capacity remaining"
charging_cycles:
name: "${bms0} charging cycles"
cell_voltage_1:
name: "${bms0} cell voltage 1"
cell_voltage_2:
name: "${bms0} cell voltage 2"
cell_voltage_3:
name: "${bms0} cell voltage 3"
cell_voltage_4:
name: "${bms0} cell voltage 4"
cell_voltage_5:
name: "${bms0} cell voltage 5"
cell_voltage_6:
name: "${bms0} cell voltage 6"
cell_voltage_7:
name: "${bms0} cell voltage 7"
cell_voltage_8:
name: "${bms0} cell voltage 8"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
delta_cell_voltage:
name: "${bms1} delta cell voltage"
average_cell_voltage:
name: "${bms1} average cell voltage"
total_voltage:
name: "${bms1} total voltage"
current:
name: "${bms1} current"
power:
name: "${bms1} power"
temperature_sensor_1:
name: "${bms1} temperature sensor 1"
temperature_sensor_2:
name: "${bms1} temperature sensor 2"
power_tube_temperature:
name: "${bms1} power tube temperature"
state_of_charge:
name: "${bms1} state of charge"
capacity_remaining:
name: "${bms1} capacity remaining"
charging_cycles:
name: "${bms1} charging cycles"
cell_voltage_1:
name: "${bms1} cell voltage 1"
cell_voltage_2:
name: "${bms1} cell voltage 2"
cell_voltage_3:
name: "${bms1} cell voltage 3"
cell_voltage_4:
name: "${bms1} cell voltage 4"
cell_voltage_5:
name: "${bms1} cell voltage 5"
cell_voltage_6:
name: "${bms1} cell voltage 6"
cell_voltage_7:
name: "${bms1} cell voltage 7"
cell_voltage_8:
name: "${bms1} cell voltage 8"
# EASUN
- platform: pipsolar
pipsolar_id: inverter1
grid_rating_voltage:
id: inverter1_grid_rating_voltage
name: Inverter 1 Grid Rating Voltage
ac_output_rating_frequency:
id: inverter1_ac_output_rating_frequency
name: Inverter 1 AC Output Rating Freq
grid_rating_current:
id: inverter1_grid_rating_current
name: Inverter 1 Grid Rating Current
ac_output_apparent_power:
id: inverter1_ac_output_apparent_power
name: Inverter 1 AC Output Apparent Power
ac_output_active_power:
id: inverter1_ac_output_active_power
name: Inverter 1 AC Output Active Power
grid_voltage:
id: inverter1_grid_voltage
name: Inverter 1 Grid Voltage
grid_frequency:
id: inverter1_grid_frequency
name: Inverter 1 Grid Freq
ac_output_voltage:
id: inverter1_ac_output_voltage
name: Inverter 1 AC Output Voltage
ac_output_frequency:
id: inverter1_ac_output_frequency
name: Inverter 1 AC Output Freq
output_load_percent:
id: inverter1_output_load_percent
name: Inverter 1 Output Load Percent
bus_voltage:
id: inverter1_bus_voltage
name: Inverter 1 Bus Voltage
battery_voltage:
id: inverter1_battery_voltage
name: Inverter 1 Battery Voltage
battery_charging_current:
id: inverter1_charging_current
name: Inverter 1 Charging Current
battery_capacity_percent:
id: inverter1_battery_capacity_percent
name: Inverter 1 Battery Cap Percent
inverter_heat_sink_temperature:
id: inverter1_inverter_heat_sink_temperature
name: Inverter 1 Inverter Heat Sink Temp
pv_input_current_for_battery:
id: inverter1_pv_input_current_for_battery
name: Inverter 1 PV Input Current
pv_input_voltage:
id: inverter1_pv_input_voltage
name: Inverter 1 PV Input Voltage
battery_voltage_scc:
id: inverter1_battery_voltage_scc
name: Inverter 1 Battery Voltage SCC
battery_discharge_current:
id: inverter1_battery_discharge_current
name: Inverter 1 Battery Discharge Current
pv_charging_power:
id: inverter1_pv_charging_power
name: Inverter 1 PV Charging Power
# MPP
- platform: pipsolar
pipsolar_id: inverter2
grid_rating_voltage:
id: inverter2_grid_rating_voltage
name: Inverter 2 Grid Rating Voltage
ac_output_rating_frequency:
id: inverter2_ac_output_rating_frequency
name: Inverter 2 AC Output Rating Freq
grid_rating_current:
id: inverter2_grid_rating_current
name: Inverter 2 Grid Rating Current
ac_output_apparent_power:
id: inverter2_ac_output_apparent_power
name: Inverter 2 AC Output Apparent Power
ac_output_active_power:
id: inverter2_ac_output_active_power
name: Inverter 2 AC Output Active Power
grid_voltage:
id: inverter2_grid_voltage
name: Inverter 2 Grid Voltage
grid_frequency:
id: inverter2_grid_frequency
name: Inverter 2 Grid Freq
ac_output_voltage:
id: inverter2_ac_output_voltage
name: Inverter 2 AC Output Voltage
ac_output_frequency:
id: inverter2_ac_output_frequency
name: Inverter 2 AC Output Freq
output_load_percent:
id: inverter2_output_load_percent
name: Inverter 2 Output Load Percent
bus_voltage:
id: inverter2_bus_voltage
name: Inverter 2 Bus Voltage
battery_voltage:
id: inverter2_battery_voltage
name: Inverter 2 Battery Voltage
battery_charging_current:
id: inverter2_charging_current
name: Inverter 2 Charging Current
battery_capacity_percent:
id: inverter2_battery_capacity_percent
name: Inverter 2 Battery Cap Percent
inverter_heat_sink_temperature:
id: inverter2_inverter_heat_sink_temperature
name: Inverter 2 Inverter Heat Sink Temp
pv_input_current_for_battery:
id: inverter2_pv_input_current_for_battery
name: Inverter 2 PV Input Current
pv_input_voltage:
id: inverter2_pv_input_voltage
name: Inverter 2 PV Input Voltage
battery_voltage_scc:
id: inverter2_battery_voltage_scc
name: Inverter 2 Battery Voltage SCC
battery_discharge_current:
id: inverter2_battery_discharge_current
name: Inverter 2 Battery Discharge Current
pv_charging_power:
id: inverter2_pv_charging_power
name: Inverter 2 PV Charging Power
# EASUN energies
- platform: template
name: Inverter 1 Line Power
id: inverter1_line_power
unit_of_measurement: W
lambda: |-
if(id(inverter1_device_mode)=="L"){
return id(inverter1_ac_output_active_power);
} else return 0;
- platform: template
name: Inverter 1 Inverter Power
id: inverter1_inverter_power
unit_of_measurement: W
lambda: |-
if(id(inverter1_device_mode)=="B"){
return id(inverter1_ac_output_active_power);
} else return 0;
- platform: total_daily_energy
name: "Inverter 1 Line Energy"
id: inverter1_line_energy
power_id: inverter1_line_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 1 Inverter Energy"
id: inverter1_inverter_energy
power_id: inverter1_inverter_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 1 PV Energy"
id: inverter1_pv_energy
power_id: inverter1_pv_charging_power
unit_of_measurement: Wh
- platform: template
name: Inverter 1 Battery Charging Power
id: inverter1_battery_charging_power
unit_of_measurement: W
lambda: |-
float power = id(inverter1_battery_voltage) * id(inverter1_charging_current);
return power;
update_interval: 5s
- platform: template
name: Inverter 1 Battery Discharging Power
id: inverter1_battery_discharging_power
unit_of_measurement: W
lambda: |-
float power = id(inverter1_battery_voltage) * id(inverter1_battery_discharge_current);
return power;
update_interval: 5s
- platform: total_daily_energy
name: "Inverter 1 Batt Charging Energy"
id: inverter1_battery_charging_energy
power_id: inverter1_battery_charging_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 1 Batt Discharging Energy"
id: inverter1_battery_discharging_energy
power_id: inverter1_battery_discharging_power
unit_of_measurement: Wh
# MPP energies
- platform: template
name: Inverter 2 Line Power
id: inverter2_line_power
unit_of_measurement: W
lambda: |-
if(id(inverter2_device_mode)=="L"){
return id(inverter2_ac_output_active_power);
} else return 0;
- platform: template
name: Inverter 2 Inverter Power
id: inverter2_inverter_power
unit_of_measurement: W
lambda: |-
if(id(inverter2_device_mode)=="B"){
return id(inverter2_ac_output_active_power);
} else return 0;
- platform: total_daily_energy
name: "Inverter 2 Line Energy"
id: inverter2_line_energy
power_id: inverter2_line_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 2 Inverter Energy"
id: inverter2_inverter_energy
power_id: inverter2_inverter_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 2 PV Energy"
id: inverter2_pv_energy
power_id: inverter2_pv_charging_power
unit_of_measurement: Wh
- platform: template
name: Inverter 2 Battery Charging Power
id: inverter2_battery_charging_power
unit_of_measurement: W
lambda: |-
float power = id(inverter2_battery_voltage) * id(inverter2_charging_current);
return power;
update_interval: 5s
- platform: template
name: Inverter 2 Battery Discharging Power
id: inverter2_battery_discharging_power
unit_of_measurement: W
lambda: |-
float power = id(inverter2_battery_voltage) * id(inverter2_battery_discharge_current);
return power;
update_interval: 5s
- platform: total_daily_energy
name: "Inverter 2 Batt Charging Energy"
id: inverter2_battery_charging_energy
power_id: inverter2_battery_charging_power
unit_of_measurement: Wh
- platform: total_daily_energy
name: "Inverter 2 Batt Discharging Energy"
id: inverter2_battery_discharging_energy
power_id: inverter2_battery_discharging_power
unit_of_measurement: Wh
number:
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balance_trigger_voltage:
name: "${bms0} balance trigger voltage"
balance_starting_voltage:
name: "${bms0} balance starting voltage"
power_off_voltage:
name: "${bms0} power off voltage"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
balance_trigger_voltage:
name: "${bms1} balance trigger voltage"
balance_starting_voltage:
name: "${bms1} balance starting voltage"
power_off_voltage:
name: "${bms1} power off voltage"
binary_sensor:
# EPEVER
- platform: modbus_controller
modbus_controller_id: epever
id: charging_input_volt_failure
name: "Charging Input Volt Failure"
register_type: read
address: 0x3201
bitmask: 0xC000
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balancing:
name: "${bms0} balancing"
charging:
name: "${bms0} charging"
discharging:
name: "${bms0} discharging"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
balancing:
name: "${bms1} balancing"
charging:
name: "${bms1} charging"
discharging:
name: "${bms1} discharging"
# RESET ENERGY TOTAL METERS EASUN
- platform: nextion
page_id: 3
component_id: 8
name: reset_inverter1_line_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter1_total_line_energy) = 0;
- platform: nextion
page_id: 3
component_id: 19
name: reset_inverter1_inverter_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter1_total_inverter_energy) = 0;
- platform: nextion
page_id: 3
component_id: 9
name: reset_inverter1_pv_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter1_total_pv_energy) = 0;
- platform: nextion
page_id: 3
component_id: 14
name: reset_inverter1_battery_charging_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter1_total_battery_charging_energy) = 0;
- platform: nextion
page_id: 3
component_id: 15
name: reset_inverter1_battery_discharging_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter1_total_battery_discharging_energy) = 0;
# RESET ENERGY TOTAL METERS MPP
- platform: nextion
page_id: 32
component_id: 8
name: reset_inverter2_line_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter2_total_line_energy) = 0;
- platform: nextion
page_id: 32
component_id: 19
name: reset_inverter2_inverter_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter2_total_inverter_energy) = 0;
- platform: nextion
page_id: 32
component_id: 9
name: reset_inverter2_pv_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter2_total_pv_energy) = 0;
- platform: nextion
page_id: 32
component_id: 14
name: reset_inverter2_battery_charging_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter2_total_battery_charging_energy) = 0;
- platform: nextion
page_id: 32
component_id: 15
name: reset_inverter2_battery_discharging_energy
internal: true
on_click:
- min_length: 5000ms
max_length: 10000ms
then:
lambda: |-
id(inverter2_total_battery_discharging_energy) = 0;
switch:
# EPEVER
- platform: modbus_controller
modbus_controller_id: epever
id: manual_control_load
register_type: coil
address: 2
name: "manual control the load"
bitmask: 1
- platform: modbus_controller
modbus_controller_id: epever
id: default_control_the_load
register_type: coil
address: 3
name: "default control the load"
bitmask: 1
- platform: modbus_controller
modbus_controller_id: epever
id: enable_load_test
register_type: coil
address: 5
name: "enable load test mode"
bitmask: 1
- platform: modbus_controller
modbus_controller_id: epever
id: force_load
register_type: coil
address: 6
name: "Force Load on/off"
bitmask: 1
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
charging:
name: "${bms0} charging"
discharging:
name: "${bms0} discharging"
balancer:
name: "${bms0} balancer"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
charging:
name: "${bms1} charging"
discharging:
name: "${bms1} discharging"
balancer:
name: "${bms1} balancer"
- platform: ble_client
ble_client_id: client0
name: "${bms0} enable bluetooth connection"
- platform: ble_client
ble_client_id: client1
name: "${bms1} enable bluetooth connection"
text_sensor:
# EPEVER
- platform: modbus_controller
modbus_controller_id: epever
name: "rtc_clock"
id: rtc_clock
internal: true
register_type: holding
address: 0x9013
register_count: 3
raw_encode: HEXBYTES
response_size: 6
on_value:
then:
- lambda: |-
ESP_LOGV("main", "decoding rtc hex encoded raw data: %s", x.c_str());
uint8_t h=0,m=0,s=0,d=0,month_=0,y = 0 ;
m = esphome::modbus_controller::byte_from_hex_str(x,0);
s = esphome::modbus_controller::byte_from_hex_str(x,1);
d = esphome::modbus_controller::byte_from_hex_str(x,2);
h = esphome::modbus_controller::byte_from_hex_str(x,3);
y = esphome::modbus_controller::byte_from_hex_str(x,4);
month_ = esphome::modbus_controller::byte_from_hex_str(x,5);
// Now check if the rtc time of the controller is ok and correct it
time_t now = ::time(nullptr);
struct tm *time_info = ::localtime(&now);
int seconds = time_info->tm_sec;
int minutes = time_info->tm_min;
int hour = time_info->tm_hour;
int day = time_info->tm_mday;
int month = time_info->tm_mon + 1;
int year = time_info->tm_year % 100;
// correct time if needed (ignore seconds)
if (d != day || month_ != month || y != year || h != hour || m != minutes) {
// create the payload
std::vector<uint16_t> rtc_data = {uint16_t((minutes << 8) | seconds), uint16_t((day << 8) | hour),
uint16_t((year << 8) | month)};
// Create a modbus command item with the time information as the payload
esphome::modbus_controller::ModbusCommandItem set_rtc_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(epever, 0x9013, 3, rtc_data);
// Submit the command to the send queue
epever->queue_command(set_rtc_command);
ESP_LOGI("ModbusLambda", "EPSOLAR RTC set to %02d:%02d:%02d %02d.%02d.%04d", hour, minutes, seconds, day, month, year + 2000);
}
char buffer[20];
// format time as YYYY-mm-dd hh:mm:ss
sprintf(buffer,"%04d-%02d-%02d %02d:%02d:%02d",y+2000,month_,d,h,m,s);
id(template_rtc).publish_state(buffer);
- platform: template
name: "RTC Time Sensor"
id: template_rtc
- platform: modbus_controller
modbus_controller_id: epever
name: "rtc clock test 2"
id: rtc_clock_test2
internal: true
register_type: holding
address: 0x9013
register_count: 3
raw_encode: HEXBYTES
response_size: 6
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
errors:
name: "${bms0} errors"
total_runtime_formatted:
name: "${bms0} total runtime formatted"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
errors:
name: "${bms1} errors"
total_runtime_formatted:
name: "${bms1} total runtime formatted"
# EASUN
- platform: pipsolar
pipsolar_id: inverter1
device_mode:
id: inverter1_device_mode
name: Inverter 1 Device Mode
# MPP
- platform: pipsolar
pipsolar_id: inverter2
device_mode:
id: inverter2_device_mode
name: Inverter 2 Device Mode
button:
# JKBMS
- platform: jk_bms_ble
jk_bms_ble_id: bms0
retrieve_settings:
name: "${bms0} retrieve settings"
retrieve_device_info:
name: "${bms0} retrieve device info"
- platform: jk_bms_ble
jk_bms_ble_id: bms1
retrieve_settings:
name: "${bms1} retrieve settings"
retrieve_device_info:
name: "${bms1} retrieve device info"
- platform: restart
name: "ESP_Restart"
output:
# EASUN
- platform: pipsolar
pipsolar_id: inverter1
battery_recharge_voltage:
id: inverter1_battery_recharge_voltage
possible_values: [22.0, 22.5, 23.0, 23.5, 24.0, 24.5, 25.0, 25.5]
battery_redischarge_voltage:
id: inverter1_battery_redischarge_voltage
possible_values: [24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0]
battery_under_voltage:
id: inverter1_battery_under_voltage
possible_values: [25.0, 25.1, 25.2, 25.3, 25.4, 25.5, 25.6, 25.7, 25.8, 25.9,
26.0, 26.1, 26.2, 26.3, 26.4, 26.5, 26.6, 26.7, 26.8, 26.9,
27.0, 27.1, 27.2, 27.3, 27.4, 27.5, 27.6, 27.7, 27.8, 27.9,
28.0, 28.1, 28.2, 28.3, 27.8, 28.5, 28.6, 28.7, 28.8, 28.9,
29.0, 29.1, 29.2, 29.3, 29.4, 29.5, 29.6, 29.7, 29.8, 29.9,
30.0, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9,
31.0, 31.1, 31.2, 31.3, 31.4, 31.5]
battery_float_voltage:
id: inverter1_battery_float_voltage
possible_values: [24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0]
battery_bulk_voltage:
id: inverter1_battery_bulk_voltage_out
possible_values: [24.0, 24.1, 24.2]
current_max_ac_charging_current:
id: inverter1_current_max_ac_charging_current
possible_values: [2, 10, 20, 30, 40, 50, 60]
current_max_charging_current:
id: inverter1_current_max_charging_current
possible_values: [10, 20, 30, 40, 50, 60]
charger_source_priority:
id: inverter1_charger_source_priority
output_source_priority:
id: inverter1_output_source_priority
battery_type:
id: inverter1_battery_type
# MPP
- platform: pipsolar
pipsolar_id: inverter2
battery_recharge_voltage:
id: inverter2_battery_recharge_voltage
possible_values: [22.0, 22.5, 23.0, 23.5, 24.0, 24.5, 25.0, 25.5]
battery_redischarge_voltage:
id: inverter2_battery_redischarge_voltage
possible_values: [24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0]
battery_under_voltage:
id: inverter2_battery_under_voltage
possible_values: [25.0, 25.1, 25.2, 25.3, 25.4, 25.5, 25.6, 25.7, 25.8, 25.9,
26.0, 26.1, 26.2, 26.3, 26.4, 26.5, 26.6, 26.7, 26.8, 26.9,
27.0, 27.1, 27.2, 27.3, 27.4, 27.5, 27.6, 27.7, 27.8, 27.9,
28.0, 28.1, 28.2, 28.3, 27.8, 28.5, 28.6, 28.7, 28.8, 28.9,
29.0, 29.1, 29.2, 29.3, 29.4, 29.5, 29.6, 29.7, 29.8, 29.9,
30.0, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9,
31.0, 31.1, 31.2, 31.3, 31.4, 31.5]
battery_float_voltage:
id: inverter2_battery_float_voltage
possible_values: [24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0]
battery_bulk_voltage:
id: inverter2_battery_bulk_voltage_out
possible_values: [24.0, 24.1, 24.2]
current_max_ac_charging_current:
id: inverter2_current_max_ac_charging_current
possible_values: [2, 10, 20, 30, 40, 50, 60]
current_max_charging_current:
id: inverter2_current_max_charging_current
possible_values: [10, 20, 30, 40, 50, 60]
charger_source_priority:
id: inverter2_charger_source_priority
output_source_priority:
id: inverter2_output_source_priority
battery_type:
id: inverter2_battery_type
display:
- platform: nextion
id: nextion1
uart_id: nextion_uart
on_page:
then:
lambda: |-
switch (x) {
case 0x01: // Page 1
id(nextion1).set_component_value("grid_voltage", id(inverter1_grid_voltage).state );
id(nextion1).set_component_value("grid_freq", id(inverter1_grid_frequency).state );
id(nextion1).set_component_value("activ_power", id(inverter1_ac_output_active_power).state );
id(nextion1).set_component_text("inv_txt_mode", id(inverter1_device_mode));
id(nextion1).set_component_value("batt_voltage", id(inverter1_battery_voltage).state );
id(nextion1).set_component_value("batt_cap", id(inverter1_battery_capacity_percent).state );
id(nextion1).set_component_value("batt_bar", id(inverter1_battery_capacity_percent).state );
id(nextion1).set_component_value("batt_ch_curr", id(inverter1_charging_current).state );
id(nextion1).set_component_value("batt_dis_curr", id(inverter1_battery_discharge_current).state );
id(nextion1).set_component_value("pv_curr_batt", id(inverter1_pv_input_current_for_battery).state );
id(nextion1).set_component_value("pv_voltage", id(inverter1_pv_input_voltage).state );
break;
case 0x03: // Page 3
id(nextion1).set_component_value("line_energy", id(inverter1_total_line_energy).state );
id(nextion1).set_component_value("inv_energy", id(inverter1_total_inverter_energy).state );
id(nextion1).set_component_value("pv_energy", id(inverter1_total_pv_energy).state );
id(nextion1).set_component_value("batt_ch_energy", id(inverter1_total_battery_charging_energy));
id(nextion1).set_component_value("batt_di_energy", id(inverter1_total_battery_discharging_energy).state );
break;
case 0x05: // Page 5
id(nextion1).set_component_value("grid_voltage", id(inverter1_grid_voltage).state );
id(nextion1).set_component_value("grid_freq", id(inverter1_grid_frequency).state );
id(nextion1).set_component_value("out_voltage", id(inverter1_ac_output_voltage).state );
id(nextion1).set_component_value("out_freq", id(inverter1_ac_output_frequency).state );
id(nextion1).set_component_value("apar_power", id(inverter1_ac_output_apparent_power).state );
id(nextion1).set_component_value("activ_power", id(inverter1_ac_output_active_power).state );
id(nextion1).set_component_value("load", id(inverter1_output_load_percent).state );
id(nextion1).set_component_value("bus_voltage", id(inverter1_bus_voltage).state );
id(nextion1).set_component_value("batt_voltage", id(inverter1_battery_voltage).state );
id(nextion1).set_component_value("batt_ch_curr", id(inverter1_charging_current).state );
id(nextion1).set_component_value("batt_cap", id(inverter1_battery_capacity_percent).state );
id(nextion1).set_component_value("inv_temp", id(inverter1_inverter_heat_sink_temperature).state );
id(nextion1).set_component_value("pv_curr_batt", id(inverter1_pv_input_current_for_battery).state );
id(nextion1).set_component_value("pv_voltage", id(inverter1_pv_input_voltage).state );
id(nextion1).set_component_value("batt_dis_curr", id(inverter1_battery_discharge_current).state );
id(nextion1).set_component_text("inv_txt_mode", id(inverter1_device_mode));
break;
case 0x1F: // Page 31
id(nextion1).set_component_value("grid_voltage", id(inverter2_grid_voltage).state );
id(nextion1).set_component_value("grid_freq", id(inverter2_grid_frequency).state );
id(nextion1).set_component_value("activ_power", id(inverter2_ac_output_active_power).state );
id(nextion1).set_component_text("inv_txt_mode", id(inverter2_device_mode));
id(nextion1).set_component_value("batt_voltage", id(inverter2_battery_voltage).state );
id(nextion1).set_component_value("batt_cap", id(inverter2_battery_capacity_percent).state );
id(nextion1).set_component_value("batt_bar", id(inverter2_battery_capacity_percent).state );
id(nextion1).set_component_value("batt_ch_curr", id(inverter2_charging_current).state );
id(nextion1).set_component_value("batt_dis_curr", id(inverter2_battery_discharge_current).state );
id(nextion1).set_component_value("pv_curr_batt", id(inverter2_pv_input_current_for_battery).state );
id(nextion1).set_component_value("pv_voltage", id(inverter2_pv_input_voltage).state );
break;
case 0x20: // Page 32
id(nextion1).set_component_value("line_energy", id(inverter2_total_line_energy).state );
id(nextion1).set_component_value("inv_energy", id(inverter2_total_inverter_energy).state );
id(nextion1).set_component_value("pv_energy", id(inverter2_total_pv_energy).state );
id(nextion1).set_component_value("batt_ch_energy", id(inverter2_total_battery_charging_energy));
id(nextion1).set_component_value("batt_di_energy", id(inverter2_total_battery_discharging_energy).state );
break;
case 0x22: // Page 34
id(nextion1).set_component_value("grid_voltage", id(inverter2_grid_voltage).state );
id(nextion1).set_component_value("grid_freq", id(inverter2_grid_frequency).state );
id(nextion1).set_component_value("out_voltage", id(inverter2_ac_output_voltage).state );
id(nextion1).set_component_value("out_freq", id(inverter2_ac_output_frequency).state );
id(nextion1).set_component_value("apar_power", id(inverter2_ac_output_apparent_power).state );
id(nextion1).set_component_value("activ_power", id(inverter2_ac_output_active_power).state );
id(nextion1).set_component_value("load", id(inverter2_output_load_percent).state );
id(nextion1).set_component_value("bus_voltage", id(inverter2_bus_voltage).state );
id(nextion1).set_component_value("batt_voltage", id(inverter2_battery_voltage).state );
id(nextion1).set_component_value("batt_ch_curr", id(inverter2_charging_current).state );
id(nextion1).set_component_value("batt_cap", id(inverter2_battery_capacity_percent).state );
id(nextion1).set_component_value("inv_temp", id(inverter2_inverter_heat_sink_temperature).state );
id(nextion1).set_component_value("pv_curr_batt", id(inverter2_pv_input_current_for_battery).state );
id(nextion1).set_component_value("pv_voltage", id(inverter2_pv_input_voltage).state );
id(nextion1).set_component_value("batt_dis_curr", id(inverter2_battery_discharge_current).state );
id(nextion1).set_component_text("inv_txt_mode", id(inverter2_device_mode));
break;
}