Hi
I am using Home Assistant and thought I would share what I have done so far (more incomming)
I have an adaptive charge for my batteries based on a prediction of solar and a simple algorithm based on historic performance
I then dynamically take the entire system off grid when charged. The system returns to on grid when the battery falls either too low or too high (for some export)
I have auto configured the EV Charge Station to revert to auto mode but will give overnight full current charging during cheap night electricity rates
I have a colour light strip that changes scene based on the solar system (battery SOC + Excess Power + absolute power draw)
The Charge Station will also slowly charge the car in the evening (after the main draw of cooking etc) if the car will not be fully charged overnight during the cheap rate (this is still testing so I wont post the code as it may change)
Then I display many many parameters of the batteries/solar/etc
Hopefully this is of use
Any other fun automations always welcome
Cheers
# modbus.yaml # configuration entry for a TCP connection # com.victronenergy.grid slave: 30 # com.victronenergy.system slave: 100 # com.victronenergy.battery slave: 225 # com.victronenergy.vebus slave: 227 # com.victronenergy.solarcharger.main.roof slave: 226 # com.victronenergy.solarcharger.bat.roof slave: 224 # com.victronenergy.EV.Chargestation: 40 type: tcp host: 192.168.86.246 port: 502 name: victron sensors: # System - name: "home_power_consumption" data_type: uint16 unit_of_measurement: "W" scan_interval: 5 slave: 100 address: 817 scale: 1 device_class: power - name: "grid_power_victron" data_type: int16 unit_of_measurement: "W" scan_interval: 5 slave: 100 address: 820 scale: 1 device_class: power - name: 'Multiplus Energy from Grid' unit_of_measurement: "kWh" slave: 30 address: 2603 data_type: uint16 scale: 0.01 precision: 1 scan_interval: 20 device_class: energy state_class: total_increasing - name: 'Multiplus Energy to Grid' unit_of_measurement: "kWh" slave: 30 address: 2606 data_type: uint16 scale: 0.01 precision: 1 scan_interval: 20 device_class: energy state_class: total_increasing # Battery - name: "Battery voltage" data_type: uint16 unit_of_measurement: "V" slave: 100 address: 840 scale: 0.1 device_class: voltage - name: "Battery Current Victron" data_type: int16 unit_of_measurement: "A" slave: 100 address: 841 device_class: current scale: 0.1 - name: "battery_power_victron" data_type: int16 unit_of_measurement: "W" slave: 100 address: 842 device_class: power scale: 1 - name: "Battery SoC" data_type: uint16 unit_of_measurement: "%" device_class: battery slave: 225 address: 266 scale: 0.1 - name: "Victron ESS Minimum SOC" data_type: uint16 slave: 100 address: 2901 scale: 0.1 unit_of_measurement: "%" - name: 'Maximum System Grid Feed In' unit_of_measurement: "W" data_type: uint16 slave: 100 address: 2706 scale: 0.01 device_class: power # command_on: 4000 # command_off: 40 # verify_state: false - name: 'Charge Power System' unit_of_measurement: "W" slave: 100 address: 860 data_type: int16 scale: 10.0 precision: 0 device_class: power - name: "pv_power_victron" data_type: uint16 unit_of_measurement: "W" scan_interval: 5 slave: 100 address: 850 device_class: power scale: 1 # MPPT Arrays - name: "PV Voltage - Main Roof" data_type: int16 unit_of_measurement: "V" slave: 226 address: 776 scale: 0.01 device_class: voltage - name: "PV Current - Main Roof" data_type: int16 unit_of_measurement: "A" slave: 226 address: 777 scale: 0.1 device_class: current - name: "PV Yield today - Main Roof" data_type: int16 unit_of_measurement: "kWh" slave: 226 address: 784 scale: 0.1 precision: 1 device_class: energy - name: "PV Max power today - Main Roof" data_type: int16 unit_of_measurement: "W" slave: 226 address: 785 scale: 1 device_class: power - name: "PV Yield yesterday - Main Roof" data_type: int16 unit_of_measurement: "kWh" slave: 226 address: 786 scale: 0.1 precision: 1 device_class: energy - name: "PV Max power yesterday - Main Roof" data_type: int16 unit_of_measurement: "W" slave: 226 address: 787 scale: 1 device_class: power - name: "pv_power_main_roof" data_type: int16 unit_of_measurement: "W" scan_interval: 5 slave: 226 address: 789 scale: 0.1 device_class: power - name: "PV Voltage - Bat Roof" data_type: int16 unit_of_measurement: "V" slave: 224 address: 776 scale: 0.01 device_class: voltage - name: "PV Current - Bat Roof" data_type: int16 unit_of_measurement: "A" slave: 224 address: 777 scale: 0.1 device_class: current - name: "PV Yield today - Bat Roof" data_type: int16 unit_of_measurement: "kWh" slave: 224 address: 784 scale: 0.1 precision: 1 device_class: energy - name: "PV Max power today - Bat Roof" data_type: int16 unit_of_measurement: "W" slave: 224 address: 785 scale: 1 device_class: power - name: "PV Yield yesterday - Bat Roof" data_type: int16 unit_of_measurement: "kWh" slave: 224 address: 786 scale: 0.1 precision: 1 device_class: energy - name: "PV Max power yesterday - Bat Roof" data_type: int16 unit_of_measurement: "W" slave: 224 address: 787 scale: 1 device_class: power - name: "pv_power_bat_roof" data_type: int16 unit_of_measurement: "W" scan_interval: 5 slave: 224 address: 789 scale: 0.1 device_class: power # EV Charge Station - name: "ev_charge_station_status" data_type: int16 scan_interval: 5 slave: 40 address: 3824 scale: 1 - name: "ev_charge_station_maximum_charge_current" data_type: int16 scan_interval: 5 slave: 40 address: 3814 scale: 1 device_class: current - name: "ev_charge_station_energy_consumed" data_type: int16 scan_interval: 5 slave: 40 address: 3816 scale: 1 device_class: energy - name: "ev_charge_station_total_power" data_type: int16 scan_interval: 5 slave: 40 address: 3821 scale: 1 device_class: power - name: "ev_charge_station_charge_current" data_type: int16 scan_interval: 5 slave: 40 address: 3823 scale: 1 device_class: current
- platform: template sensors: separated_top_floor_sockets_total_consumption: friendly_name: Separated Top Floor Sockets total Consumption unit_of_measurement: kWh value_template: >- { { ( states('sensor.shelly_shem_3_c45bbe7998ad_3_total_consumption') | float |round(1)) - ( states('sensor.shelly_shem_bcff4dfcdc57_1_total_consumption') | float| round(1))}} - platform: template sensors: separated_top_floor_sockets_power: friendly_name: Separated Top Floor Sockets Power unit_of_measurement: W value_template: >- { { ( states('sensor.shelly_shem_3_c45bbe7998ad_3_current_consumption') | float |round(1)) - ( states('sensor.shelly_shem_bcff4dfcdc57_1_current_consumption') | float| round(1))}} - platform: template sensors: target_soc: friendly_name: Target SOC for Night Charge unit_of_measurement: "%" value_template: >- {% set state = 2.5 * states('sensor.solcast_forecast_today') | float(0) %} {% set state = 150 - state | float(0) %} {% set y = (((state/5) | int) +1) * 5 %} { { ([35, y, 95] | sort)[1] }} - platform: template sensors: available_pv_power: friendly_name: Available PV Power unit_of_measurement: "W" value_template: >- {% if states('sensor.home_power_consumption')|float < 4500 %} { { ( states('sensor.pv_power_victron') | float |round(1)) - ( states('sensor.home_power_consumption') | float| round(1))}} {% else %} 0 {% endif %} - platform: template sensors: tesla_range_miles: friendly_name: Tesla Range Miles unit_of_measurement: mi value_template: > { { '{:.2}'.format( states('sensor.range')|float / 1.609) }} - platform: template sensors: evchargestationstatus: friendly_name: "EV Charge Station Status" value_template: >- {% if is_state('sensor.ev_charge_station_status', '0') %} Disconnected {% elif is_state('sensor.ev_charge_station_status', '1') %} Connected {% elif is_state('sensor.ev_charge_station_status', '2') %} Charging {% elif is_state('sensor.ev_charge_station_status', '3') %} Charged {% elif is_state('sensor.ev_charge_station_status', '4') %} Waiting for Sun {% elif is_state('sensor.ev_charge_station_status', '5') %} Waiting for RFID {% elif is_state('sensor.ev_charge_station_status', '6') %} Waiting for Start {% elif is_state('sensor.ev_charge_station_status', '7') %} Low SOC {% elif is_state('sensor.ev_charge_station_status', '8') %} Ground Fault {% elif is_state('sensor.ev_charge_station_status', '9') %} Welded Contacts {% elif is_state('sensor.ev_charge_station_status', '10') %} CP Input Shorted {% elif is_state('sensor.ev_charge_station_status', '11') %} Residual Current Detected {% elif is_state('sensor.ev_charge_station_status', '12') %} Under Voltage Detected {% elif is_state('sensor.ev_charge_station_status', '13') %} Overvoltage Detected {% elif is_state('sensor.ev_charge_station_status', '14') %} Overheating Detected {% endif %} #total energy to battery - platform: integration source: sensor.battery_input_energy name: total_battery_input_energy unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #total energy from battery - platform: integration source: sensor.battery_output_energy name: total_battery_output_energy unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #total energy to grid - platform: integration source: sensor.energy_to_grid name: total_energy_to_grid unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #total energy from grid - platform: integration source: sensor.energy_from_grid name: total_energy_from_grid unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #total pv power generated - platform: integration source: sensor.pv_power_victron name: total_pv_power_victron unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #total Home Power Consumption - platform: integration source: sensor.home_power_consumption name: total_home_power_consumption unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #Main Roof pv power generated - platform: integration source: sensor.pv_power_bat_roof name: total_pv_power_bat_roof unit_prefix: k method: left #or right or trapezoidal for methods round: 3 #Bat Roof pv power generated - platform: integration source: sensor.pv_power_main_roof name: total_pv_power_main_roof unit_prefix: k method: left #or right or trapezoidal for methods round: 3
- id: '1655900283601' alias: Peak/OffPeak description: '' trigger: - platform: state entity_id: - schedule.electricityoffpeak from: 'on' to: 'off' id: Peak Time - platform: state entity_id: - schedule.electricityoffpeak from: 'off' to: 'on' id: Off Peak Time condition: [] action: - choose: - conditions: - condition: trigger id: Peak Time sequence: - service: select.select_option data: option: Peak target: entity_id: select.electricity_tariff - conditions: - condition: trigger id: Off Peak Time sequence: - service: select.select_option data: option: Offpeak target: entity_id: select.electricity_tariff mode: single - id: 82144a232b3f4f799c6a4dabe0b6a1b4 alias: Set Victron ESS Night SOC From Prediction trigger: - platform: time_pattern minutes: /5 id: Time Pattern condition: - condition: time after: 00:30:00 before: 04:28:00 action: - choose: - conditions: - condition: trigger id: Time Pattern sequence: - service: modbus.write_register data_template: unit: 227 value: '{ { 3|int (0) }}' hub: victron address: 33 - delay: hours: 0 minutes: 0 seconds: 15 milliseconds: 0 - service: modbus.write_register data_template: unit: 100 value: '{ { states(''sensor.target_soc'')|int * 10 }}' hub: victron address: 2901 default: [] mode: single alias: PV Colour Automation description: '' trigger: - platform: numeric_state entity_id: sensor.available_pv_power for: hours: 0 minutes: 0 seconds: 10 attribute: '' above: '1000' id: High PV Power - platform: numeric_state entity_id: sensor.available_pv_power for: hours: 0 minutes: 0 seconds: 10 above: '250' below: '999' id: Medium PV Power - platform: numeric_state entity_id: sensor.available_pv_power id: Low PV Power for: hours: 0 minutes: 0 seconds: 10 below: '249' - platform: numeric_state entity_id: sensor.home_power_consumption id: Too Much Draw for: hours: 0 minutes: 0 seconds: 10 above: '10000' - platform: time at: 08:00:05 id: Monitoring Start Time - platform: numeric_state entity_id: sensor.battery_soc above: '80' id: High Battery SOC - platform: numeric_state entity_id: sensor.battery_soc id: Medium Battery SOC above: '40' below: '79' - platform: numeric_state entity_id: sensor.battery_soc id: Low Battery SOC below: '39' condition: - condition: time after: 08:00:00 before: '20:00:00' enabled: false - condition: sun after: sunrise before: sunset enabled: true action: - choose: - conditions: - condition: trigger id: High PV Power - condition: numeric_state entity_id: sensor.battery_soc above: '80' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: High PV Power - condition: numeric_state entity_id: sensor.battery_soc above: '40' below: '79' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: High PV Power - condition: numeric_state entity_id: sensor.battery_soc below: '39' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Too Much Draw sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: Monitoring Start Time sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Medium PV Power - condition: numeric_state entity_id: sensor.battery_soc above: '80' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: Medium PV Power - condition: numeric_state entity_id: sensor.battery_soc above: '40' below: '79' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Medium PV Power - condition: numeric_state entity_id: sensor.battery_soc below: '39' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: Low PV Power - condition: numeric_state entity_id: sensor.battery_soc above: '80' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Low PV Power - condition: numeric_state entity_id: sensor.battery_soc below: '79' above: '40' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: Low PV Power - condition: numeric_state entity_id: sensor.battery_soc below: '39' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: High Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '1000' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: High Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '250' below: '999' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: High Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power below: '249' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Medium Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '1000' sequence: - service: scene.turn_on target: entity_id: scene.high_pv metadata: {} - conditions: - condition: trigger id: Medium Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '250' below: '999' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Medium Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power below: '249' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: Low Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '1000' sequence: - service: scene.turn_on target: entity_id: scene.medium_pv metadata: {} - conditions: - condition: trigger id: Low Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power above: '250' below: '999' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} - conditions: - condition: trigger id: Low Battery SOC - condition: numeric_state entity_id: sensor.available_pv_power below: '249' sequence: - service: scene.turn_on target: entity_id: scene.low_pv metadata: {} default: [] mode: single - id: '1662281947060' alias: Set Victron ESS Day SOC at End of Charging description: '' trigger: - platform: time at: 04:30:00 id: Day Rate condition: [] action: - choose: - conditions: - condition: trigger id: Day Rate sequence: - service: modbus.write_register data_template: unit: 100 value: '{ { 10|int * 10 }}' hub: victron address: 2901 default: [] mode: single - id: '1665056384261' alias: Set Victron ESS Minimum SOC from input select trigger: - platform: state entity_id: input_select.victron_ess_minimum_soc action: - service: modbus.write_register data_template: unit: 100 value: '{ { states(''input_select.victron_ess_minimum_soc'')|int * 10 }}' hub: victron address: 2901 - id: '1665056384262' alias: Set Victron Inverter Mode from input select trigger: - platform: state entity_id: input_select.victron_mode action: - service: modbus.write_register data_template: unit: 227 value: '{ { states(''input_select.victron_mode'').rsplit()[0] | int(0) }}' hub: victron address: 33 - id: '1665825312111' alias: Auto Off Grid description: '' trigger: - platform: time_pattern minutes: /5 condition: - condition: state entity_id: schedule.off_grid_times state: 'on' action: - choose: - conditions: - condition: numeric_state entity_id: sensor.battery_soc above: 15 below: 95 sequence: - service: modbus.write_register data_template: unit: 227 value: '{ { 2|int (0) }}' hub: victron address: 33 - conditions: - condition: or conditions: - condition: numeric_state entity_id: sensor.battery_soc above: 95 - condition: numeric_state entity_id: sensor.battery_soc below: 15 sequence: - service: modbus.write_register data_template: unit: 227 value: '{ { 3|int (0) }}' hub: victron address: 33 mode: single - id: '1669664864596' alias: EV Charge Station Mode From Input Select description: '' trigger: - platform: state entity_id: - input_select.ev_charge_station_mode condition: [] action: - service: modbus.write_register data_template: unit: 40 value: '{ { states(''input_select.ev_charge_station_mode'').rsplit()[0] | int(0) }}' hub: victron address: 3815 mode: single - id: '1669665471596' alias: EV Charge Station Start/Stop from Input Select description: '' trigger: - platform: state entity_id: - input_select.ev_charge_start_stop condition: [] action: - service: modbus.write_register data_template: unit: 40 value: '{ { states(''input_select.ev_charge_start_stop'').rsplit()[0] | int(0) }}' hub: victron address: 3826 mode: single - id: '1669665531272' alias: EV Charge Station Current from Input Select description: '' trigger: - platform: state entity_id: - input_select.ev_charge_station_current_setting condition: [] action: - service: modbus.write_register data_template: unit: 40 value: '{ { states(''input_select.ev_charge_station_current_setting'')|int(0) }}' hub: victron address: 3825 mode: single - id: '1669669065522' alias: EV Charger Operation Based on Schedule description: Off Peak Charging at Max Current trigger: - platform: state entity_id: - schedule.ev_charge_time id: Turn On from: 'off' to: 'on' - platform: state entity_id: - schedule.ev_charge_time id: Turn Off from: 'on' to: 'off' condition: [] action: - choose: - conditions: - condition: trigger id: Turn On sequence: - service: modbus.write_register data: address: 3815 slave: 40 value: 0 hub: victron - delay: hours: 0 minutes: 0 seconds: 1 milliseconds: 0 - service: modbus.write_register data: address: 3825 slave: 40 value: 32 hub: victron - delay: hours: 0 minutes: 0 seconds: 1 milliseconds: 0 - service: modbus.write_register data: address: 3826 slave: 40 value: 1 hub: victron - conditions: - condition: trigger id: Turn Off sequence: - service: modbus.write_register data: address: 3825 slave: 40 value: 6 hub: victron - delay: hours: 0 minutes: 0 seconds: 1 milliseconds: 0 - service: modbus.write_register data: address: 3815 slave: 40 value: 1 hub: victron mode: single