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

So your log shows correct values…
Everything is fine now? :sunglasses:

I have not had time to really test it - first, the car’s batteries were already full; then there was not enough sunshine…
As I wrote, during the rather short period I did charge the car, I did not see any automatic change in the charging amps. Looking at the weather forecast this week, I don’t think I’ll get a chance of trying again for a while…

EDIT:
Seems to be working fine. Is there any way to make it a bit less sensible when there are intermittent clouds? Where I adjust the period after which it turns off the charger when there is not enough PV excess power?

Hey,
thanks for this nice way of optimizing!
There is no way to put directly conditions except on solar production excess…
So just to confirm : I have an electric heater that I want to start only if I have excess but if we are in winter and below X degrees… I need to either activate or not the automation based on that condition… Or a function triggered by the switch (dummy) of the automation who is verifying additional condition before allowing the real switch to be on…
I think the first is the more efficient…
Correct?

My second question : If i want to allow charging my car, even if i’m not producing enough? can I bypass that with a % of excess minimal?

thanks!

Hi everyone. I have done an automation for wallcharger (Easee) in order to charge my car with PV excess. I have got the automation run and I can see it in the logger. But, I can’t see the automation affects dynamic charger limit. The charger current changes but not follow the changes of the PV excess. Here is the yaml:

alias: INVENTOCASA - PV Excess Optimizer - Car Charge
description: ""
use_blueprint:
  path: InventoCasa/pv_excess_control.yaml
  input:
    automation_id: pv_excess_car_charging
    pv_power: sensor.solax_pv_power_total
    export_power: sensor.solax_grid_export
    load_power: sensor.solax_house_load
    home_battery_level: sensor.solax_battery_capacity
    min_home_battery_level: 50
    home_battery_capacity: 12
    appliance_switch: switch.easee_garage
    appliance_switch_interval: 1
    dynamic_current_appliance: true
    appliance_phases: 1
    defined_current: 10
    actual_power: sensor.easee_garage_power
    appliance_current_set_entity: sensor.easee_garage_dynamic_charger_limit
    appliance_priority: 1

EDIT: It works now, but changing of dynamic_charger_limit rarely happens. Is there some way to get excess check more often?

image
image

Heyhey
Im running pyscript 1.5.0 on my machine.
HACS tells me there is an update to v 1.6.1 available.
Did anyone test if the PV Excess controll still runs without issues on this version?

@Monster_D This did not work for me:

@aziwa I excluded pyscript from the logbook:

logbook:
  exclude:
    domains :
      - pyscript
1 Like

I’m running pyscript 1.6.1 and I’m not sadisfied. It is very slow and often charge tha car from the grid.

Similar issue here. It increases the charge limit sensibly, but when the sun disappears behind a cloud it does not seem to decrease, rather pulling 3-4kw from the grid until it switches off (despite having plenty of production to keep charging at a lower setting). Possibly a bug or error somewhere?

I like this blueprint and struggle to get it work properly. May be I have done some mistake in the settings? YAML looks like this after some changes:

alias: INVENTOCASA - PV Excess Optimizer - Car Charge
description: ""
use_blueprint:
  path: InventoCasa/pv_excess_control.yaml
  input:
    automation_id: pv_excess_car_charging
    pv_power: sensor.solax_pv_power_total
    export_power: sensor.solax_grid_export
    load_power: sensor.solax_house_load
    home_battery_level: sensor.solax_battery_capacity
    min_home_battery_level: 60
    home_battery_capacity: 12
    solar_production_forecast: sensor.solcast_pv_forecast_forecast_remaining_today
    appliance_switch: switch.easee_garage
    appliance_switch_interval: 1
    dynamic_current_appliance: true
    appliance_phases: 1
    defined_current: 7
    actual_power: sensor.easee_garage_power
    appliance_current_set_entity: sensor.easee_garage_dynamic_charger_limit
    appliance_priority: 1

Looks fine to me, in what way is it not working?

See the picture I have posted above. My car charge both from the PV and from the grid. I have expected the automation will decrease the charge current as soon PV power decrease.And vice versa. The behivour is not much logical så it could be wrong settings or I need to find some other solution.

Ah, I did not realize you where the same guy I replied to above. I have the same issue with it not decreasing the charge setting, so I can’t help. I do have a feeling it’s a bug somewhere and not a config issue (at least not in the blueprint), but I have not had the time to make a bug report yet.

And I found this messege: ‘blueprints/automation/InventoCasa/pv_excess_control.yaml’ could not be parsed, it was referenced from path ‘blueprints/automation/InventoCasa/pv_excess_control.yaml’.This file will be ignored. Error(s): - YAMLSemanticError: Multi-line double-quoted string needs to be sufficiently indented - YAMLSemanticError: Multi-line double-quoted string needs to be sufficiently indented

How to reduce pyscript_running entries in the database ?

Hello, my HA database weight increase a lot (30Gb) . So I started to look for a solution to decrease its size and I found this post:

Very interesting.
But when I check the database size with SQLite Web I get a lot of entries for pyscript_running.


I use pyscript only for PV solar excess optimizer.

I guess I’m not the only one in this case. How do you guys, manage to keep your database light?
Do you have any advices ?

EDIT:
I used this:

recorder:
  exclude:
    event_types:
      - pyscript_running

i get this error message


i have the file in this directory
/homeassistant/custom_components/pyscript/pv_excess_control.py

Hi.
you have to put the script to: /homeassistant/pyscript (not nested in the custom_component folder)

Hello,
I always see the following warning in Studio Code Server when editing any file (not pv_excess_control but any file).

Do all of you also get this warning?
did I do something wrong or is it normal?

image

Thank you :slight_smile:

Thanks Henrik for this useful blueprint, Hi to the community !

In have implemented it and it is somehow working but I have 3 issues/questions
I went through this forum, but didn’t find the answers.
1/ in logbook it records logs between every sec or 10s, which is huge. (see attached file). Is it normal? And how could I reduce this frequency?
2/ Even after implementing the workaround of @stefan73, when I enable an auto, the action is not triggered even if all conditions are met and I have always to execute it manually, otherwise that action is not triggered automatically
3/ Why is the auto not immediately evaluated/executed when I enable an auto? Apparently it takes a minimum of 1 minute to perform the action even if all conditions are met
Thanks for your answers
Renaud

I have the same message and no idea what to do with it or whether something is wrong.

1 Like

Hello everyone,

first of all: I used the blueprint/script for quite a while with one device for a month without any issues. Since I added two more devices (AC’s) I have the problem that the devices randomly don’t switch off when there’s not enough excess power.

Any ideas how to debug that?

Thanks for your help!

Here’s an excerpt from my latest log-entry:

2024-09-09 21:28:42.982 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, 2, 3]
2024-09-09 21:28:42.982 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, 0, 0, 0, -402, -422]
2024-09-09 21:28:42.984 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [input_boolean.jonas_ac_auto_22deg automation.uberschuss_ac_jonas (Prio 3)] Home battery charge is sufficient (52.6/95.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: -82 W
2024-09-09 21:28:42.985 WARNING (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [input_boolean.jonas_ac_auto_22deg automation.uberschuss_ac_jonas (Prio 3)] Appliance state (=None) is neither ON nor OFF. Assuming OFF state.
2024-09-09 21:28:42.985 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [input_boolean.jonas_ac_auto_22deg automation.uberschuss_ac_jonas (Prio 3)] Average Excess power not high enough to switch on appliance.
2024-09-09 21:28:42.986 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Exception in <file.pv_excess_control.on_time> line 16:
        domain = entity_id.split('.')[0]
                 ^
AttributeError: 'NoneType' object has no attribute 'split'