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

You have not followed instuctions under “Automation Entity ID”. Please read it again and use the correct name for the automation you already defined.

Facing some issue when i try to run the automation.

Error executing script. Service not found for call_service at pos 1: Unable to find service pyscript.pv_excess_control

Can you help?

i placed the py file in custom_components/pyscript folder and also restarted.

Anyone has a smart solution if data is provided by a Tibber Pulse?

power => only positive values if more energy from grid needed than from solar is provided
power production => only positive values if more energy returned than consumed

Edit: Maybe this should be enough and use it as load power?

  - platform: template
    sensors:
      load_power:
        friendly_name: Load Power
        unit_of_measurement: "W"
        value_template: '{{ states("sensor.power") |float - states("sensor.power_production") | float }}'

Here is my optimized version for me:

alias: Turn on/off PV Switch Automation
description: ""
trigger:
  - platform: state
    entity_id:
      - schedule.force_pv_switch
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: ABC
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
    enabled: true
  - if:
      - condition: state
        entity_id: schedule.force_pv_switch
        state: "on"
    then:
      - service: automation.turn_off
        data: {}
        target:
          entity_id: automation.pv_switch
      - if:
          - condition: state
            entity_id: switch.1
            state: "off"
        then:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.1
    else:
      - service: automation.turn_on
        data: {}
        target:
          entity_id: automation.pv_switch
mode: single

If schedule is on, deactivate the PV excess automation and start it directly. If schedule is off, activate PV excess automation again.

Hello at all, thanks for this blueprint.

I am currently planning my pv system and trying to figure out if I need an expensive energy mgmt system.
Most of my appliances can be done through the blueprint (car charging, buffer heating)

What is unclear to me is how to setup the dishwasher and washing machine. These are non smart devices. From what I understood my idea is as follows:

  1. Install Shelly to Dishwasher (Standard: On)
  2. Start Dishwasher as usual
  3. Logic starts
    3a. if pv excess is here keep on
    3b. If no pv excess is here turn off shelly and keep off until excess is here

Hint: This works because the dishwasher or washing machine just resume their started programs after a power loss.

So now the problem. How do I make sure the blueprint allows me to always start the machines and only when it starts with the work apply the logic.

From my understanding it needs to monitor the usual standby drain through the shelly energy meter. Once the machine starts draining more than the set standby drain the logic 3a/3b has to start.

Can this be achieved using the blueprint? If yes how do I have to configure it?

Hello community!

I’ve successfully been running Home Assistant (currently on 2023.9.2) in a Virtualbox VM for about 6 months.

Following the acquisition of an EV I’m very interested to maximise the utilisation of my connected rooftop PV system, and this Blueprint fits perfectly into that Use Case.

Following installation the Python script runs OK and the Automation is correctly dynamically changing the current of my wallbox in function of Excess PV Production.

But… after a while the script stops running in the background, so when I plug in the EV the next day when the sun is shining it doesn’t automatically starts the modulated charging.
This is without disabling the Automation.

If I restart Home Assistant, then the script starts running again, and the dynamic charging of my EV is correctly modulating again.

What could cause this? Is it common…?
What can I check to see if my installation and instance are correct??

Thanks all!

Hi, at first, many thanks to @InventoCasa for this nice project.
I played around with your script the last couple of days to implement an automation for my dishwasher and washing machine.
Thx to this, I found some bugs in my data implementation of pv informations (i have 2 inverters installed). Im generally new in this topic and not a pro in HA (but using it since 3-4 years).
For your information, I have 2 inverters (one hybrid) but at the moment no active battery in my setup.

After realising, which data I need for this automation I had to install a new “Helper” to combine the “current active power” of my two inverters.
I also installed via HACS the “Power Flow Card Plus” (GitHub - flixlix/power-flow-card-plus: A power distribution card inspired by the official Energy Distribution card for Home Assistant) to have a better view on my “current” Watts. And I think, I found a Problem with my inverter Data and your automation.
So I have no Information for “Export Power” (current Watts sending to the grit) and “Load Power” (current total Watts consumed by my household) and also I missing some “Import Power” (current Wats imported from the grit; just for completeness).
But I have a combined one of “Export Power” and “Import Power”, in your Automation called “Combined Import/Export Power”. You noticed the following:

“Sensor which contains both, your current import power from the grid (positive values) and your current export power to the grid in watts (negative values).”.

So I think here is my Problem.
My “Combined Import/Export Power”-Entity is inverted to your description. My “current import power from the grid in watts” is the negative one and if the value is positive, it shows “export power to the grid in watts”.
Can you offer a slide button to invert the values?
The “Power Flow Card Plus” I mentioned above is offering such an option for the combined value and then I can see correct Informations in my custom “Power Flow Card”.

Or am I missing such an Option or can find a “Helper” to get an inverted entity for your automation?

Many thanks to you :slight_smile:

Make a template helper of something like :

{{states('sensor.what_ever_your_combined_entity_is')|int(0) * -1}}

That will invert it. You can now do this in the UI with a preview if you are on 2023.9.x

Hey @chris345433

how did you implement your dishwasher/washing machine?

Before I invest some time getting this blueprint running (seems to be really good), I’d like to better understand the behavior. Could someone with experience what’s happening in these two situations:

  1. It’s late afternoon, the pv excess for the appliance is sufficient but will not be anymore in 30min (and the appliance will run for 2hrs). Does the script start the appliance or is it smart enough to realize that the pv excess will not be sufficient soon and not start it
  2. In the winter, based on the typical load there will not be sufficient pv excess for the appliances. Is there a way to still maximize pv consumption?

Hi folks! Been using this for a month now and I’m wondering about how it’s supposed to work, as it does not behave quite as i expected. I have 3 devices:
Water heater, 2kw, with power monitor, highest priority
Bathroom floor heating, 700w, no power monitor
Heat pump, consumtion turns on and off and varies 0-2kw for varying times, I’ve set the script to 8A as a guess, but also tried 5A and did not notice any significant difference. This has no monitoring and is the lowest priority.

In the morning they are turned on according to priority as expected, and back off again in reverse order.which is fine on good days. But the script will never turn off the two lower priority devices to make room for the higher priority as i expected, so on cloudy/overcast days it can run both low priority devices the whole day with the highest priority device never getting power despite production being more than high enough. This will make the script completely useless when winter comes, as the water heater is the only one I actually need to run on solar.

Is this how the script is supposed to work, or is it an issue with lacking power monitoring on the lower priority devices?

Thanks!

P.S.
I’ve noticed the original developer does not seem to be around the github, anyone know what’s up with that?

I would like to suggest adding a bitcoin miner as power sink in case is not worth selling the PV excess production. Secondhand old miners are cheap. I am unsure if these machines can be remotely controlled to adjust its power consumption.

1 Like

I’ve seen that suggested before, not seen an actual setup yet. Also not sure it’s a viable idea, in my case I’d need to burn the better part of 15kw 3-phase to make it useful and regulate cunsumtion from less than 1kw to 15kw in real time as clouds drift in front of the sun. I did offer a guy to rent space for a test setup here, but he did not respond to that despite how much he seemed to think one could make on it.

Hello all

I am having a similar problem to @eight10man in this post. .

I have an automation based on the stat of charge of my car: if below 50% it disables the excess solar automation to make sure my car is charge to at least 50%, and then any extra comes from excess solar.

However when the automation is disabled and re-enabled, the script stops running - similar to what @redbak describes here

Only way I have found to solve this is a restart of HA.

Any ideas what might be causing this?

My automation does nothing, what am i missing?

Executed: 21 October 2023 at 12:29:26
Result:

params:
  domain: pyscript
  service: pv_excess_control
  service_data:
    automation_id: '1697887624599'
    appliance_priority: 1
    export_power: sensor.power_meter_exported
    pv_power: sensor.input_power_with_efficiency_loss
    load_power: sensor.template_total_acumulated_power
    home_battery_level: sensor.battery_state_of_capacity
    min_home_battery_level: 100
    dynamic_current_appliance: false
    appliance_phases: 1
    min_current: 6
    max_current: 16
    appliance_switch: switch.shelly4pm_1_andar_switch_3
    appliance_switch_interval: 5
    appliance_current_set_entity: null
    actual_power: sensor.shelly4pm_1_andar_switch_3_power
    defined_current: 6
    appliance_on_only: false
    grid_voltage: 230
    import_export_power: sensor.power_meter_active_power
    home_battery_capacity: 5
    solar_production_forecast: sensor.energy_production_today_remaining
    appliance_once_only: false
  target: {}
running_script: false
limit: 10

Hello!

I’m new here and have no idea what Home Assistant and python concerns, so I ask for your indulgence if I do not notice something obvious. I tried to install PV / Solar Excess Optimizer exactly as instructed, but fail at the following point:

pv_excess_control.yaml throws me 9 same errors in Studio Code Server:

String does not match the pattern of "DEPRECATED^".

in lines 48, 59, 73, 88, 102, 147, 201, 202, 260

some googling revealed that parts of the code are considered deprecated. i tried to simply delete the lines, but as expected, no success.

Could someone direct me on how to proceed to make this work? If any other data is needed, I will endeavor to provide it.

Thanks in advance for the help!

I`m looking for some help to setup Dynamic current control to user 95% from PV production with a inverter heat pump.

For heat pump is possible to :
-switch on /off ,
-to reduce with 50% power of the device /Eco mode ,
-to change flow temperature 25-60C
-to chose another temperature curve
-to change from heating to hot water
-to read temperature from boiler
-to change hot water temperature 25-60C from boiler
-to read flow and return temperature

or over mod bus to change frequency of compressor

I’m in the same boat - the automation seems to be doing nothing, after what appears to be a proper configuration and clicking “Run” to send the data to the script.

How does one debug this script?

You should see a lot like this every 10 seconds, in your logbook.
2023-11-13 20_35_51-Window

Why are you trying to change the code? This works perfectly as per the instructions. I struggled with studio code server and ended up using file editor.

When you install the InventoCasa Blueprint it will create 2 folders.

  1. The first folder is /config/blueprints/automation/InventoCasa/ in this folder you should have a file called “pv_excess_control.yaml”
  2. The second folder is /config/pyscript in this folder you will have a file called “pv_excess_control.py”