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

so the automation is running and its turning off the water heater if i switch it on manually I’m assuming as the system is pulling from the grid. however it does not seem to be able to switch the water heater on when i have excess solar. Is there a way to monitor what the script is seeing, so I’m looking to see the values its using to make a choice of what its doing. is there a script log?

If you want the water heater to run all the time then you enable the switch once option, that is specifically for an appliance that should not be turned off once started even if solar is not present.

From what you have described it looks like there is not enough solar being generated to run your water heater as its calculating the minimum and maximum settings you have for the water heater. The other thing to remember is that calculations are not instant and takes 60 seconds to change. I have asked the same question for visual to see what is happening currently its not available.

What have you told it the pull is (in Amps) for the heater? I found that if I had it set to 16A it never turned on, so I’ve gone for 13A and it comes on when I am generating in excess of 3000W (which is fine because the immersion pulls 2900-3000W)

at present the system is exporting 4Kw, so there is plenty of power available. I have yet to see the script switch the heater on, only off if i switch it on Manually. thats why I’m looking to see what the criteria its using to make the choice’s its making. If I look at the entities that I’ve specified in the automation they seem to be correct.

This will also relate to the voltage setting of the appliance.

So your batteries are fully charged? What have you set your water heater voltage to? What is the minimum and maximum setting for the current? Do you have any other automation setup with this script?

I only have Amps on my blueprint - nothing for voltage.

Battery is fully charged, the amps are set to 11A with 240V

I have seen this error in the system log

Sorry wrong Picture here is the error

Here is my working YAML for comparison.

alias: Hot Water from PV
description: ""
use_blueprint:
  path: pv_excess_control.yaml
  input:
    pv_power: sensor.solax_pv_power_total
    export_power: sensor.solax_grid_export
    load_power: sensor.shelly_ct_channel_2_power
    home_battery_level: sensor.solax_battery_capacity
    min_home_battery_level: 98
    home_battery_capacity: 6
    solar_production_forecast: sensor.solcast_forecast_remaining_today
    appliance_switch: climate.tesla
    defined_current: 13
    appliance_once_only: false
    automation_id: automation.hot_water_from_pv
    actual_power: sensor.tesla_relay_power
    appliance_switch_interval: 10

@spencerralph One of the sensors you have passed to the script (export/pv/load power/battery level) is unavailable. Hence the error.

1 Like

…and my Automation Config to match your screenshot.

mode: single
trigger:
  - platform: homeassistant
    event: start
action:
  - service: pyscript.pv_excess_control
    data:
      automation_id: automation.hot_water_from_pv
      appliance_priority: 1
      export_power: sensor.solax_grid_export
      pv_power: sensor.solax_pv_power_total
      load_power: sensor.shelly_ct_channel_2_power
      home_battery_level: sensor.solax_battery_capacity
      min_home_battery_level: 98
      dynamic_current_appliance: false
      appliance_phases: 1
      min_current: 6
      max_current: 16
      appliance_switch: climate.tesla
      appliance_switch_interval: 10
      appliance_current_set_entity: null
      actual_power: sensor.tesla_relay_power
      defined_current: 13
      appliance_on_only: false
      grid_voltage: 230
      import_export_power: null
      home_battery_capacity: 6
      solar_production_forecast: sensor.solcast_forecast_remaining_today
      appliance_once_only: false
id: '1683804131974'
alias: Hot Water from PV
description: ''

Are all your sensors showing data in Developer Tools?

the sensors im using dont seem to be listed under statistics in the Developer tools page should they be, and how do i get them listed there?

Go here and select them one at a time …

Or try and find them by filtering the list :

All the sensors that I’m using are listed and show values?

Seem to have got ride of the system error, deleted the python script and recopied in, now the system is not turning off the switch once its been turned on until i see a load from elsewhere on in the house. While have to wait until tomorrow to see if it will switch on.
One more question the water heater is set to heat up the water over night on cheap electric, is there a way to put the automation on hold over night to make sure it does not switch off the heater?

@spencerralph the error is not problematic, and most likely will come back every time one of your sensors is unavailable, e.g. on startup of home assistant. However this does not bother the script much, if the sensor is unavailable once / from time to time only. It only becomes a problem when the sensor is unavailable for a long period. This also would result in the error message getting published at least once every minute in the log.

Regarding your question, yes, you can create another automation which disables the PV excess automation you created for your water heater after sunset, and activates it again after sunrise. Be aware of some problems this may cause with pyscript, as others have mentioned here in the thread. E.g. @redbak posted a workaround to this problem which worked for him.

I myself do not have any problems with temporarily de-activating some PV excess automations, but will make further investigations once I have more time available.

thanks for all your help …

Neil,
Sorry I was referring to the second setting on the blueprint in reference to Voltage (grid voltage), i.e 110 or 230 as the calculations for current and solar available to turn on or off the appliance with the lowest priority.

Thanks for sharing your automation. I see you are using a Shelly CT for load measurement, which device is this?. I have a Shelly EM to do just that a measure the grid supply, waiting on the electrician to change over to Pro 3EM.