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

@aziwa

Several things could happen here, e.g.

  • The Tesla’s battery is already full and while the charging current may still be set to a high value, the script will detect that the actual power consumption is 0 and therefore recognize that turning the car charging off will not have any effect on the total load power of your house, resulting in the dehumidifier being switched off

  • It could also be a bug, which could’ve been fixed in one of the latest updates of the script. If your version is older than ~2 weeks I suggest to update to the latest version.

  • To be certain, you could send me some debug logs. Either an excerpt of your home assistant logfile from the relevant time range were the suspected bug happened or your complete logfile together with the information about the problematic time frame. You can send me this also via private message, if the number of log messages is too much for pasting the contents here.

Small question
I need this load must be loaded once time daily, also if not enought power (cause need to refill water tank).
Do you think is possible setup also time frame something like from 11:00 to 14:00 (peak).

Something like is setup with sunnpy portal (SMA)Senza titolo

I suggest to not use Volt, Amp and Phases, when you can easy setup Watt and sensors give you Watt.
Then you can avoid this errors:
defined_power = inst.defined_current * PvExcessControl.grid_voltage * inst.phases
when triphase is not anymore Watt = Amp x Volt but Watt = Amp x Volt x 1.73 (simple, real formula is more complex, that why take Watts)

Hello, someone can help me, I keep getting this information in the logs

Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.pyscript.file.pv_excess_control.on_time
Source: custom_components/pyscript/eval.py:1901
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 09:54:02 (4 occurrences)
Last logged: 09:56:00

num=unavailable is not a valid number between 0 and 1000000: could not convert string to float: 'unavailable'
Could not update Export/PV history!: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Could not get state from entity automation.solarbojler: name 'automation.solarbojler' is not defined
Ten błąd pochodzi z niestandardowej integracji.

Logger: custom_components.pyscript.file.pv_excess_control.on_time
Source: custom_components/pyscript/eval.py:1901
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 10:53:00 (3 occurrences)
Last logged: 11:12:00

Could not get state from entity automation.solarbojler: name 'automation.solarbojler' is not defined

says : No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax…

@razvanbanica read the instructions please.

Who can help me with this Blueprint. I‘ve a mini PV System without Batterie. I would like switch on by water heater in the kitchen when PV Power is Excessed. Today the sun is shining a the PV system is generating more power then I consume but the water heater switch (Homematic IP) does not Switche on. What did I wrong?

Hello, can someone share the charging power graph, from start of the charging to end of the charging ? Thx

@bbday thanks for the screenshot, probably makes sense to implement such a functionality. On the github repository, there is already a feature request for a min. runtime implementation. Can you add the screenshot from your inverter there? This will give me some ideas when I start to implement the feature.

@pks150781 can you post your debug log / an excerpt from your home assistant logfile?

Could you pls explain how to provide the debug logs?

This is one message I found in the Logs

That message is not related to your problem and will only appear during startup, when the array is not full yet.

Please provide an excerpt of the relevant time frame from your home assistant logfile. You can find instructions in the Home Assistant docs / googling “how to view home assistant logfile” etc.

Hi, I updated the script from github and now I see this error - it was working perfectly!

This error originated from a custom integration.

Logger: custom_components.pyscript.function
Source: custom_components/pyscript/function.py:430
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 09:45:04 (2 occurrences)
Last logged: 10:05:33

run_coro: got exception Traceback (most recent call last): File "/config/custom_components/pyscript/eval.py", line 695, in call raise TypeError( TypeError: pv_excess_control() missing 14 required positional arguments

Ignore that - I had a mismatched blueprint/python script!

For some reason the automation as not triggered for the last few days.

alias: Start Tumble Dryer Solar Excess
description: ""
use_blueprint:
  path: PV_Access/pv_excess_control.yaml
  input:
    automation_id: Start Tumble Dryer Solar Excess
    pv_power: sensor.solis_inverter_dc_power
    export_power: sensor.solis_grid_export_power
    load_power: sensor.solis_house_load_power
    min_home_battery_level: 80
    home_battery_capacity: 13.5
    appliance_on_only: true
    defined_current: 6
    home_battery_level: sensor.solis_battery_soc
    appliance_switch: switch.tumble_dryer_on_off
    actual_power: sensor.tumble_dryer
    appliance_once_only: false
    solar_production_forecast: sensor.remaining_solar_production

My battery is currently at 99% and my remaining solar production is around 7kWh…

I have three automations in prority 1 to 3 and none have triggered today.

I just deleted and recreated them and mannually ran the automations to register them with the script and all that shows in my logs after 30 mins is this:

2023-05-04 12:37:32.893 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.pv_excess_control] [switch.dish_washer_start (Prio 3)] Registered appliance.
2023-05-04 12:37:34.314 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.pv_excess_control] [switch.tumble_dryer_on_off (Prio 1)] Registered appliance.
2023-05-04 12:37:36.347 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.pv_excess_control] [switch.washing_machine_start (Prio 2)] Registered appliance.

We have to put our appliances into remote mode before they will respond to HA turning them on. Until we do that the switch does nothing. Is it possbile the script is turning on my applainces before they are ready?

What I’ve found is I have to do a reboot of HA to get this to work after running an updated blueprint. Anytime I do an update/refresh it just stops running. I can still see newly run blueprints in the debug but no other information. Would imagine its a bug within the code somewhere that isnt showing in debug logs.

@AaronIsFab I suspect something with pyscript itself, which is something I cannot “fix” but could probably find a workaround for, once the root cause is known.

Can you describe that further, what do you mean by “Anytime I do an update/refresh it just stops running”?

So if I update anything on the automation (Appliance On/Off switch interval as an example), save it, then run it to send it to the pyscript bit. I see the Registered appliance message in debug. Then its just literally nothing happens from there. No logbook entries, no debug messages in .log. I can see further “Appliance Registered” in .log if I run another automation but it never triggers the actual checking anymore.

Hello all,

currently the Blueprint does not turn on my boiler yet. In the debug log I see the following messages:

2023-05-05 11:46:37.168 DEBUG (MainThread) [custom_components.pyscript.eval] file.pv_excess_control.on_time: calling debug("[switch.boiler (Prio 1)] Home battery charge is sufficient (100/100.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: -14383 W", {})
2023-05-05 11:46:37.168 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.boiler (Prio 1)] Home battery charge is sufficient (100/100.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: -14383 W
2023-05-05 11:46:37.171 DEBUG (MainThread) [custom_components.pyscript.eval] file.pv_excess_control.on_time: calling debug("[switch.boiler (Prio 1)] Average Excess power not high enough to switch on appliance.", {})
2023-05-05 11:46:37.172 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.boiler (Prio 1)] Average Excess power not high enough to switch on appliance.
2023-05-05 11:46:37.175 DEBUG (MainThread) [custom_components.pyscript.eval] file.pv_excess_control.on_time: calling debug("[switch.boiler (Prio 1)] Appliance is already switched off.", {})
2023-05-05 11:46:37.175 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.boiler (Prio 1)] Appliance is already switched off.

Debug set “Average Excess power not high enough to switch on appliance.” But how the script knows when enough Power is available ?

This is my automation:

alias: PV_Uberschuss_Boiler
description: ""
use_blueprint:
  path: PV_Controll/pv_excess_control.yaml
  input:
    automation_id: PV_Uberschuss_Boiler
    pv_power: sensor.hm_15400_powerdc
    import_export_power: sensor.stromzahler_power_aktuell
    solar_production_forecast: sensor.solcast_forecast_remaining_today
    appliance_switch: switch.boiler
    appliance_switch_interval: 1

Unfortunately I have neither a battery nor the possibility to view the import and export load separately. Therefore I use the “import_export_power” (in W).

What am I doing wrong?

BR
Patrick

I think I am having the same problem as @AaronIsFab - I have an automation to disable/enable the blueprint (based on the location of my car).

When the automation is re-enabled, it does not start reliabily. seems sometimes it works, others it does not.

A reboot of HA fixes this.