PV / Solar Excess Optimizer: Auto-control appliances (wallbox, dish washer, heatpump, ...) based on excess solar power

Hello, I also have the problem that the charging current of the wallbox increases (appropriate so far), but when the PV surplus decreases, the charging is switched off immediately before the charging current is reduced. I have all current sensors in W. How did you round off the current?

I use these parameters for the automation blueprint:

alias: Go-eCharger
description: Automate EV-Charging
use_blueprint:
  path: homeassistant/pv_excess_control.yaml
  input:
    automation_id: automation.go_echarger
    pv_power: sensor.inverter_active_power
    import_export_power: sensor.power_meter_active_power_reversed
    appliance_switch: switch.goecharger_004416_allow_charging
    dynamic_current_appliance: true
    actual_power: sensor.power_ev_charger
    appliance_current_set_entity: input_number.new_charge_current
    appliance_priority: 1

When input_number.new_charge_current changes, it triggers another automation that changes the target current of the charger.

alias: Adjust Charge Current
description: Anpassung des Ladestroms nach Ɯberschuss
trigger:
  - platform: state
    entity_id:
      - input_number.new_charge_current
condition:
  - condition: state
    entity_id: switch.goecharger_004416_allow_charging
    state: "on"
  - condition: state
    entity_id: sensor.goecharger_004416_car_status
    state: charging
action:
  - service: goecharger.set_max_current
    data:
      charger_name: "004416"
      max_current: sensor.new_charge_current_int
mode: single

sensor.new_charge_current_int is a template sensor:

{{states('input_number.new_charge_current')|float|int}}
1 Like

Hi Jurgen,
Is there an integration specific for the go-e charger? I have the Fronius Wattpilot (which is a re-branded go-e), which doesnā€™t have an official integration (only a non-official one on HACS).

No official integration, there are two custom integrations for Go-eChargers. I have a five year old charger (V2?) and use ā€œgo-eChargerā€ custom integration. There is another one that uses MQTT messaging.

1 Like

thereā€™s also the fan entity which can be set by percentage - this is how i integrated my hot water tank whose 1200W heating coil gets limited via esphome (where there is the same named component for controlling things with an analog output signal).

just set up some constant loads with this blueprint, curious how it will workā€¦ :hugs:

yes, if the solar excess is sufficient to start a appliance, the one with the highest priority, for which the solar excess is sufficient, will start.
But often lower prioritized appliances need lower power. And if the solar excess is increasing slowly, the lower prioritized will start first. Right now, it will not be switched off to start the higher prioritized one, even if the solar excess would allow that.
I am locally testing a variant, which enables this feature. I will create a pull request, soon.

Hi,
the entitiy is set to the current in A the appliance shall consume. The entitiy needs a service set_value(). Therefore number or input_number would work.

1 Like

you can execute the automation once if your washing machine is ā€œready to goā€, e. g. by a switch. This sends the needed parameters to the script and it will start the washing as soon as the solar excess is sufficient. And you can deactivate the automation, if the washing machine finished to remove it from the script automation.

Hi,
if you disable your automation and later enable it again, you do not need to run the automation again. (by the way: you can run the automation not only by hand, you can trigger it automatically e.g. to update the priority)

Hi,
I had the same issue. Iā€™ve programmed a feature, that, if an appliance has a priority > 500, it will be started if there is solar excess, even if it is partially sufficient. This can also be modified, that depending on the priority, it will be started, if solar excess is 50% sufficient.
I created a pull request. Maybe it is better to keep the actual behavior for priority <1000 and extend the priority range to max 2000 to do not change the behavior of running implementions?

Best,
Maik

1 Like

Hi
Just installed this blueprint, to use the excess solar power to charge my Tesla.
I have a solar system with a 10kWh battery and a 12kWh Deye Inverter.

My inverter does not supply the grid export power, but instead it gives me grid total power (positive = import, negative = export). So I made my own sensor that calculates the grid export as negative value of grid total power or 0 if it I import from grid.

My problem is that the automation does not seem to adjust the charging current in the Tesla, even though I see large export to grid. Or if there is no excess solar power it just drains my home battery.

The automation is configured like this:

alias: Charge Tesla on Excess Solar
description: ""
use_blueprint:
  path: pv_excess_control.yaml
  input:
    automation_id: charge_tesla_on_excess
    pv_power: sensor.total_pv_power
    export_power: sensor.grid_export_power
    home_battery_level: sensor.sun12k_battery_capacity
    min_home_battery_level: 95
    home_battery_capacity: 10
    solar_production_forecast: sensor.energy_production_today_remaining
    appliance_switch: switch.model_3_charger
    appliance_switch_interval: 2
    min_current: 3
    appliance_phases: 3
    defined_current: 3
    actual_power: sensor.model_3_charger_power

I can see that the pyscript generates a log every 10 second, so I guess the script is running. It just does not do anything.

I hope someone can guide me in the right direction on how to debug this.

Best
Jens

Iā€™m using the option of a combined import/export power sensor:

alias: Go-eCharger
description: Automate EV-Charging
use_blueprint:
  path: homeassistant/pv_excess_control.yaml
  input:
    automation_id: automation.go_echarger
    pv_power: sensor.inverter_active_power
    import_export_power: sensor.power_meter_active_power_reversed
    appliance_switch: switch.goecharger_004416_allow_charging
    dynamic_current_appliance: true
    actual_power: sensor.power_ev_charger
    appliance_current_set_entity: input_number.new_charge_current
    appliance_priority: 1

and because the integration wants it positive for import i reverse my sensor by using a template sensor:

{{states('sensor.power_meter_active_power')|float*(-1)}}

Thanks, I can try that, but the blueprint specifically states that If you have at home battery then you should not use this :worried:

Sorry, as i donā€™t have a battery, i wasā€™nt aware of this.

Thanks a lot @Maik7, your solution is very elegant and will be a game changer for me and I guess many other persons.
I hope your pull request will be processed soon :slight_smile:
I canā€™t wait to test it, so I guess I can just copy and paste your code from the github

@Maik7 thanks for helping improving this script!
I had some time to take a quick look at your PR and I have an idea how to solve this a bit better (see comments on github). Let me know what you think (also on GitHub)

Everybody else, itā€™s nice to see that this blueprint/script is used by many people. Iā€™ll try my best to further refine the script based on all the feedback I received. Unfortunately, it is still not clear when I can start doing this, but Iā€™ll try to find some time within the upcoming months.

1 Like

yes you @Reunion974 can, but it is definitively not the final version. @InventoCasa had some good comments but the devil is in the detail.

1 Like

can you set the log level to debug and post some logs? And trigger your automation, that the script logs the received data, too.
Just call this service:

service: logger.set_level
data: {custom_components.pyscript.file.pv_excess_control: debug}

And maybe you need to change the automation_id to match the alias. I had an issue in the beginning and I needed that fix, but maybe i mixed something up
automation_id: charge_tesla_on_excess_solar

Ok thanks,
I found that there was a problem with my configuration of the blueprint. For some reason I had no entity in the load power field.

After fixing that I get these logs

2024-05-23 08:39:44.691 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Export History: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2024-05-23 08:39:44.692 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] PV Excess (PV Power - Load Power) History: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1438, 1349, 1485, 1721, 1832]
2024-05-23 08:39:44.696 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.model_3_charger (Prio 1)] Home battery charge is sufficient (61.0/95.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 1776 W
2024-05-23 08:39:44.698 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.model_3_charger (Prio 1)] Average Excess power not high enough to switch on appliance.
2024-05-23 08:39:44.700 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.model_3_charger (Prio 1)] Appliance is already switched off.

I will test more in the afternoon once the car is back in my garage and plugged in to the charger.

1 Like

Hello,
Is it possible to live modify the priority ?

I can imagine 3 ways to do it, but not sure if itā€™s possible:

  • define the priority as an input_number
  • define the priority as a template based on an input_number
  • modify the field priority inside the automation entity (pessimistic on this one)

And then we would just need to trigger the automation to validate the change.

Anyone already did that ?
Thanks a lot !!

yes, that is possible. Unfortunately you can not define the input_number in the blueprint dialogue (I am new at home assistant, but I did not find a way to define in a blueprint a parameter, which can be a constant number or an input_number) , but you can edit automation.yaml and change the constant value for appliance_priority like this:

appliance_priority: "{{states('input_number.ebike_pve_priority') | int (1) }}"

exactly.
But I just found out, that there is a bug in the script, which caused the parameters not to be updated. I created a pull request with the fix.

yes, I am using this. But I just got aware, that the parameters were not updated :frowning:

1 Like

Fantastic!
I hope your 2 pull request will be processed soon, It will make this integration really powerfull!! :slight_smile:

1 Like