I have no battery, but DSMR data from my smart meter. (My smart meter does not know about how much PV power I use, it only measures the delivered part of it to the grid obviously.)
It provides “delivered power” and “returned power”. (I get the PV Power from my inverter independedly.)
As I understand “Export Power” = “returned power” but what about the “Load power” I have to config?
Is it equal to “delivered power” or
“delivered power” + “PV Power” ?
Hi there,
got this setup and I believe everything is in order, but it appears to be not switching anything on.
alias: Solar light test
description: ""
use_blueprint:
path: pv_excess_control.yaml
input:
pv_power: sensor.solarman_generation_power
load_power: sensor.solarman_consumption_power
home_battery_level: sensor.solarman_battery_soc
home_battery_capacity: 7
min_home_battery_level: 30
automation_id: Light_test
appliance_switch: switch.sonoff_1000228174
export_power: sensor.exportzero
defined_current: 6
Where am I going wrong?
Many thanks
I did some extensions / fixes to the code. Actually I am looking for Inventocasa to pull changes and comment proposals. As he seems to be busy, you can try this fork if you dare - no warranties. It seems to work for me.
The changes comprise:
- Original code has problems to roubstly have a time_triggered instance of on_time() running. Often there was no instance, so users report “nothing working”.
- Works now with hybrid systems like Fenecon Home. System has a battery and a combined power sensor for import/export. Original code rejected working with this.
- Original code did not work with car chargers/wallboxes that do not report power - now we calculate the power based on the current set if there is no sensor
- Power on dynamic appliances like car chargers works now also if appliance does not immediately change power
- Car Chargers afaik only work with whole numbers for the current value
- Added a setting for a power margin avoid on/off sequences (e.g. wait for 200W more before turning on)
- Added a setting to for inverter limited PV systems
P.S.: For the original code as well as this one, I recommend to set the voltage to the upper limit of what you can expect (e.g. 240V). This avoids underestimating the power consumed by the appliance. Underestimations can lead to on/off/on/off sequences.
Hey @InventoCasa ,
great blueprint - thx for that one!
I’m using a Easse home Charger and was wondering what Entities have to use for the Dynamic controll There is no one with a number - only sensors. Can you help me with that one?
Disclaimer: I am not into Easee Chargers. There seems to be an integration with home assistant which is only delivering sensor data. Obviously this does not allow to steer the wallbox. You can just see what is happening. The Easee home charger seems to support OCPP. This is a widely used standard for interfacing chargers.
So you may do it like me with an Entratek/IOCharger wallbox. Install the OCPP integration of HACS. Then configure this integration.
Then you need to change the config of the wallbox. For OCPP the wallbox needs have a websocket endpoint. This practically means that you have to put the IP of the home assistant and port 9000 (default of the OCPP integration in HA).
With restarting everything you should be able to see your wallbox over the OCPP interface. You should also have an Entity to start/stop a charge and set the charge current. Try this out with manually setting values.
If it works try this script. If your wallbox does not deliver the power consumed over OCPP or it does that very slowly, you might want to try the extended code that I published above.
Good luck!
Hey Stefan 73,
Thx for answering I’ll give it try !!!
Hello, I have the following problem with the dynamic control of the Goe charger. As the protocol shows in the picture below, the wallbox is switched off when the excess power falls below the set level. There would still be the option of reducing the charging current to 6A, why doesn’t the program do that? Kind regards
Pls have a look 3 lines above your marking. The script has calculated an PV excess of 3972W. Setting the charger to 6A would still mean that 4.1-4.2kW would be consumed (assuming a 3 phase charger at 230-240V). This is about the excess power, so the script switches off. Seems to be logical to me.
If you see questionable behaviour, check how fast your charger reports power changes. This is very dependent on the charger model (e.g. my Charger from Entratek reports changes on the current imported after 15 minutes(!)). It is also a debatable idea to calcuate the average for PV access and not use the minimum. If you see issues in these areas, let us know; maybe we can work around this.
Yes, but the wallbox was at 9A and could have been reduced to 6A before switching off. If the Wallbox had done that, it wouldn’t have switched off because the PV excess would have been enough.
If the wallbox had been turned down, the PV surplus would have been 2000W higher
I’ve set up the automation:
alias: AC automat etaj
description: Control automat aer conditionat etaj
use_blueprint:
path: pv_excess_control.yaml
input:
automation_id: ac automat
pv_power: sensor.pv_total_w
import_export_power: sensor.power_meter_active_power_inverted
appliance_switch: switch.ac_etaj
min_current: 6
defined_current: 3.6
actual_power: sensor.ac_etaj_power
sensor.pv_total_w is 2471
sensor.power_meter_active_power_inverted is -2096
However the appliance swith does not turn on
What am I doing wrong?
Thank you so much!
I tried your fixes today, however there seems to be a problem if Export Power and Load Power are not provided, but instead a Combined Sensor is provided:
This error originated from a custom integration.
Logger: custom_components.pyscript.file.pv_excess_control.on_time
Source: custom_components/pyscript/eval.py:1941
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 09:48:10 (27 occurrences)
Last logged: 09:52:30
Could not update Export/PV history!: unsupported operand type(s) for -: 'float' and 'NoneType'
this was working fine in the old version.
Thank you very much for this awesome blueprint.
I am pretty sure that I have setup all correctly but the switch that should be triggered are not switched even if the threshold for my battery that I configured is reached. Is there any possibility how I can debug the automation.
I am not sure if I have the correct exceptions when the switch that I configured should switched to on.
I want to heat up a hot water boiler with it.
Edit: Looks like I found the error. Problem was the naming
Awesome blueprint, saves me a lot of time creating something which is for sure not as good as your work!
I set up all according to the documentation but the switch is not executed just like other users already reported last days.
In the HA log I can see following error:
This error originated from a custom integration.
Logger: custom_components.pyscript.file.pv_excess_control.on_time
Source: custom_components/pyscript/trigger.py:1268
Integration: Pyscript Python scripting
First occurred: March 1, 2024 at 23:50:21 (712 occurrences)
Last logged: 01:01:51
Exception in <file.pv_excess_control.on_time> line 246: first_item = next(iter(PvExcessControl.instances.values())) ^ RuntimeError: coroutine raised StopIteration
Any idea if it’s caused by an inconsistent configuration or what’s the root cause?
And second question: What is the purpose of the forcast? How is it influencing the logic?
Thanks in advance and keep up the great work!
@stefan73 can you have a look at this error from @githuber110 , it looks like it originates from the code change of your PR
I raised the ticket in a pyscript discussion first by mistake, and although I closed the ticket i got a response which may help:
the setup is OK, but
next()
raises an exception due to no values found. I’d suggest assigninglist(iter(PvExcessControl.instances.values()))
to a variable, checking its length, and if it is not zero - then take the first element.
Hello @InventoCasa, thank you for this amazing job!
There’s a question I really wonder but I could not find the answer in the documentation.
What kind of algorithm to you use to decide what device to turn on/off ?
Thank you
Am i`m wrong or can i Trigger a switch If multiple light Sensors differ between themselves and Trigger that Switch after a very short time to Control an actuator?
@InventoCasa & @githuber110
Looking at the error I assume something that I did not think of: What if the user does not set any automation id? - Then we have an empty dictionary but still launch the on_time trigger. This then tries to check the current automation id (None) against the dictionary (empty).
@githuber110 : did you configure an automation id in the user interface where you configure your automation? - The error should vanish once you do this.
@InventoCasa If this assumtion turns out to be true, we can avoid the problem by adding a check to line 228 for the id to be None.
@Reunion974 Let my try to give an answer - it is a bit simplified.
Check for home battery SoC:
If there is a prediction configured for the remaining solar production for today, check whether we can reach the desired SOC of the home battery still today. Only if this is the case, allow the subsequent PV excess automation to turn things on.
If there is no prediction, wait for the configured SOC to be reached.
PV excess regulation:
#1 The script calculates the difference between the PV production and what gets consumed in your house now (we skip the use of import/export sensor here). It does that all 10 sec.
#2 Every minute it checks wheter it checks:
#2a If there is a PV excess, then try to increase dynamic appliance already turned on. Check for other appliances that it can turn on. Consider the priority given to the appliance. Estimate how much these appliance changes would consume based on the settings provided by the automation.
#2b If there is a lack of PV power compared to consumption, try to turn things off - basically the reverse of 2a
I hope this helps.