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

just wondered if the logging is set up correctly here is my configuration.yaml file
Screenshot 2023-06-16 at 10.43.06

as im not seeing info in the log every time the script run

@spencerralph no, indentation is wrong, also the logger key must not be under the pyscript key. Please follow the instructions in the first post.

Whilst the indentation is not correct. So sorry Henrik & Spencer, about the position of the logger key. That was how I have it in my setup, on a steep learning curve on this one for sure.

Logging is now working: so here is the output: as you can see the log is indicating that there is not enough power any help would be great.

And here is are the figures from my invertor as these are what im using to trigger the automation.

Your export is in KW … that’s the problem. It is expecting watts - so 3920W not 3.92KW.

Covert all the power variables to W and it should work perfectly.

Spencer,

If you look at your image, the power is in kW, what the script wants is the entity id in W.

I dont have a hybrid inverter but have a growatt offgrid inverter, that has the sensors for both kW and W so you will have to look and pick the correct one, or you will have to create a helper to convert from kW to W

If you dont have the option in the inverter itseIf to choose the sensor that gives you W, then look at this link how you can convert it Convert kW tot Watt - Configuration - Home Assistant Community (home-assistant.io)

Looked and all my sensors are in KW, so the conversion may be the only why forward, One QQ would the Conversion method change all my sensors to Watts, i just wanted to change the ones i use for the script

Ok then you have to look at the option mentioned. No it will create new sensor’s for the script.

Just be careful when altering your config.yaml file.

So let’s look at the following.

  1. Does your /config/configuration.yaml file have this line?
sensor: !include sensors.yaml
  1. If you do see the above line then check if you have a file called.

sensors.yaml

  1. If the above file is there then at the bottom of the sensors.yaml file add the following.
### Making new sensor kW to W - Solar   
  - platform: template
    sensors:
      solar_in_watts:
        friendly_name: "Solar Power In Watt"
        unit_of_measurement: "W"
        value_template: "{{ states('sensor.nwctcjc06d_all_pv_wattage')|float * 1000 }}"
  1. Double check the indentations and if your value template sensor above is correct.
  2. Once you save it go to > Developer Tools > Click on CHECK CONFIGURATION you should not get any errors, if you do go back to the file and recheck, double check and correct.
  3. Restart HA
  4. Goto Settings > Devices & Services > Entities > in the search bar copy and paste this without the
    quotes “sensor.solar_in_watts” you will see the sensor has been created select it and you will now
    see that your kW is displayed in W
    8.This is the sensor sensor.solar_in_watts you will now use in the Script for PV Power.
  5. Create the other 2 sensors too for your Script

Good Luck

I have checked there is no Sensors section in my configuration.yaml file, should i add add the section then create a sensors.yaml file with the required sections in?

Yes once you add it, follow 4,5,6 to make sure its right.

one other QQ - adding the Sensor line in the configuration.yaml file will not effect the other sensors i have will it?

All we are doing here is making reference to a file, then having all our sensor in that one referenced file.

But if you are comfortable in editing your configuration.yaml file directly then you don’t need to create the reference or the file. Just add your new sensor to the configuration.yaml

Spencer,

If you look at the code and read that original post I linked, all we are doing is taking your kW sensor and making separate new sensor for our application, which will be in W. All your original kW sensors will remain the same. HTH

getting an error when running the Configuration test from Dev tools

Here is my sensor.yaml file
Screenshot 2023-06-18 at 12.02.44
I think its just a syntax issue but cant be sure the sensors I’m referencing are the correct entity names.

seems to be working now didn’t like the Capitals i had used.

You have to use it exactly as the sensor shows and dont change anything.

Good to see you have it all working. How is the PV script working?

still not firing, i have even tried pulling down the Amps required for the appliance down to 3 amps

Here is the log file

@spencerralph please read the logs, they state that your PV excess of ~1600W is not high enough to switch on the appliance.

Which means you have specified a typical current of more than 1600/240=6.6A (in case of an one-phase, non-dynamic appliance) for your appliance. If you changed that, you probably forgot to re-execute the automation.

i did take it down to 3amps however you may be right about re running script, so have now restarted HA. but cloud has stopped play, may have to wait until tomorrow for more testing.

Thanks for all your support.

Once i have it running the next this will be to look at a automation that will switch on the water heater over night and disable the automation for the PV excess then switches off the water heater and re enables the PV Excess.

Its all good learning experience…

Does the Script run in Hass 2023.6 with Python 3.11?
Or are there any issues?