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

Just wanted to express what a super nice blueprint this is - saved me 699€ in not investing in a sma sunny home manager!

Great work!

2 Likes

Hi @InventoCasa - sorry for late reply.

Been testing and definitely have the problem and am on the latest version of the blueprint.

If I de-activate the automation and then re-activate it using an automation, then it often (but not always?) no longer works.

I can no longer see any messages in the logbook about excess solar from the pyscript like i do when things work.

only way to fix seems to be to reboot HA

Any ideas?

I have exactly the Same issue as @aziwa
I created an Automation that runs my PV Automation (the Blueprint) when the Automation Turns on.
I think this makes it a bit better. Atleast it feels Like i need less ha restarts.
Maybe this helps, until there ist a solution to this issue.

P.S. sorry for my silly captilalization. Im on a German Mobilephone.

What’s the best way to integrate a heat pump which does not has an on-off switch?

For hot water, I can for example increase the target temperature when there is excess power available. However, high water temperatures mean higher heat loss during the day (cool down curves are unfortunately not linear …). Furthermore, increasing the target temperature now doesn’t mean the hot water generations starts now and I don’t have a prediction.

How are others solving that? I feel like the whole optimal operations of a heat pump is really complex

Are there any known issues woth HASS 2023.05?
Yesterday evening i Updated my Home Assistant to this Version.
Today no PV Controller device turned in.
(But I didnt have time / or i didnt feel Like checking whats wrong, today)

after installation I got this message :
Die Automatisierung “INVENTOCASA - PV Excess Optimizer” (automation.inventocasa_pv_excess_optimizer ) hat eine Aktion, die einen unbekannten Dienst aufruft: pyscript.pv_excess_control .
Apparently the automation can not find the python script. Any advice on what went wrong. Pyscript is installed and configered to allow all inputs.

1 Like

Have you got the pv_excess_control script installed in config/blueprints/automation folder?

affirmative, in the config/blueprints/automation folder is another subfolder homeassistant, in here the pc_excess_control script is installed.

Hi,

I’m new to Home Assistant and configuring my first install.
I’m wondering, can data from my smart meter be used?
It shows Voltage, Combined power delivery, usage from the net but not current PV power.
I can get my Tapo smart plug I use for testing to switch when I use an automation based on time but it doesn’t do anything when I use the blueprint.
I do see one potential problem.
HA does not save when I change the unit from kW to W on the sensor. It just changes back after rebooting and then it just won’t change at all.

Hi,

I solved every problem I had but now I noticed that when I use the switch on the dashboard the script goes off and doesn’t run again until I reboot. When I use the button on my Tapo the script keeps running and toggles the state on and off according to my Combined import/export.

Did you install the 2 scripts separately? How did you install the scripts?

I am having problems understanding what this integration is doing because it will detect that there is more DC generated than actually used. It tries to start my wallbox but a second after that he stops the wallbox

2023-05-30 09:23:43.754 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, 1607.0, 1610.0, 1496.0, 1562.0, 1654.0, 5843, 5815, 5897]
2023-05-30 09:23:43.755 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, 1607.0, 1610.0, 1496.0, 1563.0, 1654.0, 5843, 5816, 5897]
2023-05-30 09:23:43.760 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Home battery charge is sufficient (100.0/80.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 4154 W
2023-05-30 09:23:43.762 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Average Excess power is high enough to switch on appliance.
2023-05-30 09:23:43.763 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Cannot switch on appliance, because appliance switch interval is not reached (3/5).
2023-05-30 09:23:43.768 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Appliance is already switched off.
2023-05-30 09:24:43.756 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, 1607.0, 1610.0, 1496.0, 1562.0, 1654.0, 5843, 5815, 5897, 5926]
2023-05-30 09:24:43.757 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, 1607.0, 1610.0, 1496.0, 1563.0, 1654.0, 5843, 5816, 5897, 5926]
2023-05-30 09:24:43.765 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Home battery charge is sufficient (100.0/80.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 5027 W
2023-05-30 09:24:43.768 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Average Excess power is high enough to switch on appliance.
2023-05-30 09:24:43.768 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Cannot switch on appliance, because appliance switch interval is not reached (4/5).
2023-05-30 09:24:43.771 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Appliance is already switched off.
2023-05-30 09:25:43.754 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, 1607.0, 1610.0, 1496.0, 1562.0, 1654.0, 5843, 5815, 5897, 5926, 5924]
2023-05-30 09:25:43.755 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, 1607.0, 1610.0, 1496.0, 1563.0, 1654.0, 5843, 5816, 5897, 5926, 5924]
2023-05-30 09:25:43.759 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Home battery charge is sufficient (100.0/80.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 5881 W
2023-05-30 09:25:43.761 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Average Excess power is high enough to switch on appliance.
2023-05-30 09:25:43.763 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Switched on appliance.
2023-05-30 09:25:43.763 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusting power history by -4140.0.
2023-05-30 09:25:43.764 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, 1607.0, 1610.0, 1496.0, 1562.0, 1654.0, 5843, 5815, 5897, 5926, 5924]
2023-05-30 09:25:43.766 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusted 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, 1607.0, 1610.0, 1496.0, 1562.0, 1654.0, 1703.0, 1675.0, 1757.0, 1786.0, 1784.0]
2023-05-30 09:25:43.767 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] PV Excess (solar 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, 1607.0, 1610.0, 1496.0, 1563.0, 1654.0, 5843, 5816, 5897, 5926, 5924]
2023-05-30 09:25:43.768 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Adjusted PV Excess (solar 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, 1607.0, 1610.0, 1496.0, 1563.0, 1654.0, 1703.0, 1676.0, 1757.0, 1786.0, 1784.0]
2023-05-30 09:25:43.769 INFO (MainThread) [homeassistant.helpers.script.wallbox] wallbox: Running template script
2023-05-30 09:25:43.770 INFO (MainThread) [homeassistant.helpers.script.wallbox] wallbox: Executing step call service
2023-05-30 09:25:44.773 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.wallbox (Prio 1)] Appliance is already switched off.

I dont understand why he is doing that. All entities that are needed are configured and given correct values but I dont get why the integrations is doing what it is doing :slight_smile:

@markusmazurczak the reason is that you did not configure it correctly.

The script is not trying to switch the appliance off again, it is just retrieving the state. Which is off, right after it tried to turn the appliance switch on. Which means there is something wrong with your configuration. You can paste your configuration variables here. What did you pass for Appliance entity?

@aziwa Unfortunately I have no idea at the moment where this is coming from and why it occurs only with some users, also I do not encounter these problems myself (and I’m also switching the automations dynamically on/off).

Best chance we have is that everybody, who has this problem, tries to reproduce it and right after that send me the full home assistant logfile, including the PV excess automation configuration and the info, at what exact time the problem occured.

My config is

id: '1685362280575'
alias: Wallbox - Überschussladen
description: ''
use_blueprint:
  path: pv_excess_control.yaml
  input:
    automation_id: wallbox_uberschussladen
    pv_power: sensor.total_dc_power
    export_power: sensor.export_power
    home_battery_level: sensor.battery_level
    min_home_battery_level: 80
    home_battery_capacity: 9.5
    solar_production_forecast: sensor.combined_remaining_solarforecast_production_for_today
    appliance_switch: switch.wallbox
    appliance_switch_interval: 5
    dynamic_current_appliance: true
    appliance_current_set_entity: input_number.wallbox_input_current
    appliance_phases: 3
    actual_power: sensor.wallbox_power_consumption_in_watt
    load_power: sensor.load_power

I understood that appliance_switch has to be an entity which starts or stopps the wallbox and I am not able to configure the “standard” wallbox entity HA gives me. I have an easee wallbox and I cannot configure the easee-wallbox-entity for the appliance_switch.

To give the integration a switch entity I configured a template one:

- platform: template
  switches:
    wallbox:
      value_template: "{{ is_state('sensor.wall_e_status', 'charging') }}"
      turn_on:
        service: easee.action_command
        data:
          device_id: [MYID]
          action_command: start
      turn_off:
        service: easee.action_command
        data:
          device_id: [MYID]
          action_command: stop

At the moment I am writing that I am getting an intuition … It is possible that I have to change the value_template for the status because the integration has 5 or 6 different states?

The instructions state to add the automation ID as the entity and that this is available by clicking the three dots… That’s not possible when you first build an automation, it needs to be saved first.

The current settings screen shows my ID as: automation.excess_solar_optimiser_immersion_switch is this the expected format, or is it without automation.?

Thanks

Nick

When you create your automation, you would give it! a unique name, then copy that name and when you have filled all the relevant information you will hit the save button. A pop up window will appear when that happens you paste the unique name give it a description and hit the rename word at the bottom right of the window. It will automatically save it under the name. Please see below screen shots of one I just setup for the washing machine. Hope this helps your question, its a bit of a learning curve for me too.

automation_entity_id_washing_machine_solar_rename

1 Like

Got it working, it’s great! Thanks

Sounds good…can you please post here what you did to get it working for the benefit of others?

Hi Henrik,

I know this has been mentioned in a few post above.

If you make changes to an automation and they save and run it, the change seems to kill pyscript from running and automation does not run also there are no logs too. The only way to start pyscript and the logs is to restart HA. I noticed that even the cron 0.0.0.0 does not seem to work I simulated this see the below screen shots.

Normally running log.

After simulated change to an automation pyscript stops running and no log

2023-06-03 00_23_10-Logbook – Home Assistant

Cron 0.0.0.0 in pv_excess_control.py fails to restart pyscript or the logs

Only a restart would get pyscript and the logs working

Have you found a workaround for this without having to restart HA?