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

Hi,
right now it is turned on, if there is any excess power. Using a threshold, e.g. 50% of the needed power, can cause unwanted behavior, if you have more than one appliance with priority>1000. And with three appliances it can cause oscillations. Think of two appliances with 100W/Prio 1100 and 10W/Prio 1200, and 65 75 W excess Power and 50% threshold for both.
The 10 W will be switched on and then the 100W, causing -35W excess power. As a consequence the higher prioritized 10W appliance will be switched off, which is most likely unwanted. And with three appliances you can have oscillations.

Therefore we need a more complex logic, if you want allow percentages of grid power. Any suggestions?

Maybe it is sufficient to limit the absolute grid power (same threshold for all appliances)?

Best,
Maik

humm, interesting point. I understand.

And what about this:

Lets say that when we turn on a 1000W appliance with prio>1000
the threshold is 50% → the system will consider that this appliance use 500W
but we also add a tolerance for 500W additional power (from the grid) while that appliance is on.

So in your example:
I have 75W (you meant 75 not 65) excess.
The system will turn on both appliances 10W and 100W
→ We have -35W excess
→ the “tolerance” is increased by 5+50 (prio appliance’s power * threshold )
So the “virtual excess” = excess + tolerance → -35+55 = 20W
All calculations have to be done with this “virtual” excess.

Problem: if at some point the real exces is 0 but the virtual excess is 500, the system may turn on some low prio appliances that I’d prefer to see off.

Solution? : the “virtual excess” prio could be used in the calculation of the appliances with high prio only. The decisions for other appliances would still be based on normal excess value.

What do you think?

1 Like

Hi,

I think it is still the same conflict. How to count a higher prio appliance, which can be covered 90% by the solar power and 10% grid power? Allow further appliances to be switched on, even if they use 100% grid power? And what is, if the solar power increases slightly, that the higher prio appliance can be covered 100% by solar power? Is it the same, if the lower prio appliance has a prio < 1000?
The topic is much more complex, than it looks in the first moment.

E.g. think of 1000W solar power and the highest prioritized appliance is using 800W. How much grid power is allowed? Is it the same, if we deactivate this 800W appliance and solar power is reduced to 200W by a cloud?

Maybe we have to collect the different aims, why users are using this script.

  1. try to avoid using grid power.
  2. try to use all available solar power

The 1st is for solar installations, which can cover all or most of the needed energy. The former version of the script is exactly for that use-case (and the current still is by using priorities <= 1000).

The 2nd is for small solar installations (in Germany “balcony power plants” are very popular, with up to 800W power). An installation which can only cover a fraction of the needed energy. For this I added the new method for priority > 1000.

What is exactly the use case to allow grid power as a fraction of the currently used solar power? If we can define a use case for this, it might be easier to find a good algorithm for this.

Maybe adding other features will add more benefit?

I have a pull request to switch off lower prioritized appliances to enable switching on higher prioritized. I think this is improving the script significantly.

For appliances like washing machines the usage of the expected solar power of the next hour(s) could be beneficial.

What also can be done with the actual implementation: I am calculating the priority of an appliance dependent on further parameters:

  • My fish tank heater priority depends on the time it is switched off (in detail: when the switch was on, but the heater did only consume negligible power).
  • same for my fridge (right now I am using a fridge simulator, but soon I will activate it). It has button to force “switch on” for 1 hour (and it will be only be switched off, if the power consumption indicates, that the fridge is not cooling any longer).
  • If I connect my e-bike charger, the priority will be rather low. But I can define a due date, when the e-bike shall be fully charged. (by pressing a button, single press: today, double: tomorrow, triple …) The priority increases if the due date gets nearer. If the due date is today or tomorrow I am using the expected solar power till due date (minus the typical power consumption) to calculate, if the solar power should be sufficient to charge the e-bike without using grid power. If not, I increase the priority > 1000

And they will be switched on if necessary even if the script says “no”.

This means: even with the actual implementation it is possible, to realize complex automatons.

A completely agree with your analysis.

Your 2nd use case can apply to many different solar installation regardless of the size. Actualy any installation that do not produce enough to cover their needs or without a satisfying electricity selling price. I’l lgive you an example with my setup:

For the moment I can not sell my production, so everything that is not used is lost. Later I will be allowed to sell my exceed to the solar provider but the price will be quite low.
→ So it’s more interesting to use all my production than to sell it.

In my case, I have a 6kWc production but my swiming pool filter use 1600W. If I use the heat pump it’s +2000W. When I charge my car it’s 1.8 to 3.5kW.
→ So my production can not cover all my consumption and I should use almost every Watt produced

So your description of use case #2 is just fine. “try to use all available solar power”.

The possibility to dynamicaly modify the priority is certainly a part of the solution.
Like you, I tend to automaticaly swith the priority:

  • if the swiming pool is covered, the water is protected from sun → chlorine is not destructed by UV → the water need less filtration.
    So if cover ON → priority=200, if cover OFF → priority=400
    Later I’ll also implement something to make sure the pool is filtered enough each day, so the prio will increase if an objective is not reached. Similar to your due date but inside each 24h cycle.
  • if the car is empty I need to urgently charge it. The more the battery is filled, the lower the priority become.
    So I defined differents levels of priority that can be automaticaly set depending on the battery charge level. The highest level → grid charge, the level before → priority > 1000

That’s really funny because as you can see, we are in a very very similar situation even if our setups are completely different :smiley: → it means that many other persons will enjoy your solutions :slight_smile:

As you can see, in my case, your 2 pull request changed the game and now I really start enjoying this integration.
An improvement would be to have 2 settings for the priority > 1000 (why not 1000 and 2000 ?).

1 Like

Hi there, this is exactly what I was looking for…but - old problem…I am still new to this…
I cannot get it work…
Installed everything - blueprint an pythonscript…get no errors - so far, fine.
I created two automations, for washing machine and dryer, connected via two shelly plugs.
They simply dont get activated, but enough power is there (battery level is ok, load is ok…everything fine).
I dont know where to start with debugging.
Perhaps theres anybody who could help?
I set debug level in config.yaml, but I dont see special debug messages, just the normal “file_pv_excess_control_on_time has been triggered by time”

:frowning:

Hier mal aktuelle AuszĂźge aus dem Log:

2024-06-11 15:00:11.553 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=514.0
2024-06-11 15:00:11.564 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Home battery charge is sufficient (5115.0/20.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 0 W
2024-06-11 15:00:11.566 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Appliance is already switched on.
2024-06-11 15:00:11.568 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Application has run for 3.8 minutes
2024-06-11 15:00:11.578 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Home battery charge is sufficient (5115.0/20.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 0 W
2024-06-11 15:00:11.581 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Appliance is already switched on.
2024-06-11 15:00:11.583 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Application has run for 3.7 minutes
2024-06-11 15:00:11.586 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 (Prio 10)] Average Excess Power (0 W) is still greater than minimum excess power (-10 W) - Doing nothing.
2024-06-11 15:00:11.590 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 (Prio 10)] Average Excess Power (0 W) is still greater than minimum excess power (-10 W) - Doing nothing.
2024-06-11 15:00:21.552 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=514.0
2024-06-11 15:00:31.552 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=514.0
2024-06-11 15:00:41.546 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=437.0
2024-06-11 15:00:51.550 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=437.0
2024-06-11 15:01:01.550 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=437.0
2024-06-11 15:01:11.548 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=391.0
2024-06-11 15:01:11.559 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Home battery charge is sufficient (5115.0/20.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 0 W
2024-06-11 15:01:11.561 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Appliance is already switched on.
2024-06-11 15:01:11.564 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 automation.waschmaschine_pv (Prio 10)] Application has run for 4.8 minutes
2024-06-11 15:01:11.571 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Home battery charge is sufficient (5115.0/20.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 0 W
2024-06-11 15:01:11.573 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Appliance is already switched on.
2024-06-11 15:01:11.575 INFO (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 automation.trockner_pv (Prio 10)] Application has run for 4.7 minutes
2024-06-11 15:01:11.579 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.trockner_switch_0 (Prio 10)] Average Excess Power (0 W) is still greater than minimum excess power (-10 W) - Doing nothing.
2024-06-11 15:01:11.582 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [switch.waschmaschine_switch_0 (Prio 10)] Average Excess Power (0 W) is still greater than minimum excess power (-10 W) - Doing nothing.
2024-06-11 15:01:21.550 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=391.0
2024-06-11 15:01:31.552 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=391.0
2024-06-11 15:01:41.552 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=400.0
2024-06-11 15:01:51.550 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=400.0

Ok, now I saw, that the automation id was still not correct…made some changes and I got a little further, as shown above, in the log.
I changed the entity id and triggered the automations again, but I still get errors. And I dont know, how to fix the error messages. Thanks for some help.

Best regards,

Seems as if THIS is the only remaining error…any help? Thanks a lot!

2024-06-11 15:01:51.550 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Could not update Export/PV history!: Could not update Export/PV history PvExcessControl.export_power=sensor.sonnenbatterie_235801_production_output | PvExcessControl.pv_power=sensor.sonnenbatterie_235801_production_input | PvExcessControl.load_power=sensor.sonnenbatterie_235801_consumption_w = export_pwr_state=None | pv_power_state=None | load_power_state=400.0

Solved: Changed the entities for input and for output…I obviously used two entities, that were not actual any more…

As it works now…last question. why all this “0” in the export…do I still have a mistake there?

2024-06-11 16:55:11.559 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, 1688.0, 0, 2204.0, 0, 0, 768, 447, 351, 331]
2024-06-11 16:55:11.560 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, 1690.0, -616.0, 2206.0, -1210.0, -1385.0, 771, 449, 354, 334]

Hi,
The history is showing 60 min data. The first approx 52 zeros: most likely you started the script 8 minutes ago. (But it can also be the same reason, as in the next paragraph)
The zeros in the newer history values: the history is used to decide, if an appliance shall be switched on. If an appliance is switched on, or off the history must be “corrected” by the power used by this appliance. If not, further appliances will be switched on or off, as the history reports much or to less excess power. At this “correction”, the corrected values will never be below 0.
Therefore: everything is fine :grinning:
Maik

1 Like

Hi,
thanks for your detailed answer :slight_smile:
I did not get, what exactly your suggestion is. Limiting the grid power to 50% of the lowest prioritized appliance? I doubt, that this will result in a stable system. Maybe we can limit the grid power to a value independent from the individual appliances? (Switch on an appliance with prio >1000 even if the solar excess is not 100% sufficient, but do not exceed a constant threshold of grid power? )

I was just saying that it would be great to have to “levels” of high prio (>1000).
I can see 2 solutions:
1- a variable threshold: something that would be defined with a template like the priority.
2- a constant threshold: but 2 different values that would be activated upon the priority.
if appliance set to 1000 < prio < 1500 : constant A applies
if appliance set to 1500 < prio < 2000 : constant B applies
Default rule: the highest is applied.

Hi,
the constant is a limit for the maximum allowed grid power?
If yes: yes, I think both approaches can work.
@InventoCasa What do think about this?

The first approach can be faked by a virtual power source you subtract from your real power usage. But this is not perfect, as this will allow to switch on low priority appliances using 100% grid power.

Thanks a lot, Maik!!

should dynamic control work for an appliance the automation didn’t turn on by itself?

(i.e. - wallbox has been turned on manually, charging at 6A, then there’s surplus of 600W - so i would expect the automation to crank up to 8A …)

tia.

(just found that my ‘Appliance actual power sensor’ reported kW - corrected that, but still it doesn’t seem to work :expressionless:)

I had this working fine and then updated to the latest version on github. Now when my battery is on 11% (1& over the min) and solar is about 400w it turns on my immersion which is 3000w. I am not sure what’s changed.

I use the solcast remaining (and did before). Can there be a setting for MINIMUM battery level before anything starts? At the moment it’s pretty much using the grid so I’m baffled.

Debug looks like the average_excess_power is wrong. It’s increasing every time, but I’m not generating anywhere near what you are stating (as you can see from the history)

2024-06-14 08:48:12.321 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:49:12.299 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, 0, 0]
2024-06-14 08:49:12.299 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, 153, 180, 181, 209]
2024-06-14 08:49:12.306 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 723 W
2024-06-14 08:49:12.308 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:49:12.309 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:49:45.630 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.office_radiator_local_temperature_calibration: 18 (range -9.0 - 9.0)
2024-06-14 08:49:45.834 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.office_radiator_local_temperature_calibration: 18 (range -9.0 - 9.0)
2024-06-14 08:50:12.293 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, 0, 0]
2024-06-14 08:50:12.294 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, 153, 180, 181, 209, 267]
2024-06-14 08:50:12.302 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 990 W
2024-06-14 08:50:12.305 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:50:12.307 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:51:10.843 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.living_room_radiator_window_local_temperature_calibration: 18.5 (range -9.0 - 9.0)
2024-06-14 08:51:11.062 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.living_room_radiator_window_local_temperature_calibration: 18.5 (range -9.0 - 9.0)
2024-06-14 08:51:11.282 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.kitchen_radiator_utility_local_temperature_calibration: 16.5 (range -9.0 - 9.0)
2024-06-14 08:51:11.525 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.kitchen_radiator_utility_local_temperature_calibration: 16.5 (range -9.0 - 9.0)
2024-06-14 08:51:12.299 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, 0, 0]
2024-06-14 08:51:12.299 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, 153, 180, 181, 209, 267, 327]
2024-06-14 08:51:12.304 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 1317 W
2024-06-14 08:51:12.307 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:51:12.309 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:51:16.239 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.living_room_radiator_window_local_temperature_calibration: 18.5 (range -9.0 - 9.0)
2024-06-14 08:51:16.627 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.kitchen_radiator_utility_local_temperature_calibration: 16.5 (range -9.0 - 9.0)
2024-06-14 08:52:12.289 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, 0, 0]
2024-06-14 08:52:12.289 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, 153, 180, 181, 209, 267, 327, 376]
2024-06-14 08:52:12.300 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 1693 W
2024-06-14 08:52:12.302 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:52:12.306 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:53:12.291 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, 0, 0]
2024-06-14 08:53:12.292 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, 153, 180, 181, 209, 267, 327, 376, 508]
2024-06-14 08:53:12.299 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 2201 W
2024-06-14 08:53:12.301 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:53:12.304 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:53:17.933 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.living_room_radiator_window_local_temperature_calibration: 18.5 (range -9.0 - 9.0)
2024-06-14 08:53:18.172 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.living_room_radiator_window_local_temperature_calibration: 18.5 (range -9.0 - 9.0)
2024-06-14 08:54:12.297 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, 0, 0]
2024-06-14 08:54:12.298 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, 153, 180, 181, 209, 267, 327, 376, 508, 510]
2024-06-14 08:54:12.305 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (14.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 2711 W
2024-06-14 08:54:12.308 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Average Excess power not high enough to switch on appliance.
2024-06-14 08:54:12.311 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla (Prio 900)] Appliance is already switched off.
2024-06-14 08:55:12.299 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, 0, 0]
2024-06-14 08:55:12.299 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, 153, 180, 181, 209, 267, 327, 376, 508, 510, 256]
2024-06-14 08:55:12.304 DEBUG (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] [climate.tesla automation.hot_water_from_pv (Prio 900)] Home battery charge is sufficient (15.0/98.0 %) OR remaining solar forecast is higher than remaining capacity of home battery. Calculated average excess power based on >> solar power - load power <<: 2967 W

Fixed it by reverting lines 277 and 286

avg_excess_power = int(sum(PvExcessControl.export_history[-inst.appliance_switch_interval:]) / inst.appliance_switch_interval)

instead of

avg_excess_power = int(sum(PvExcessControl.export_history[-inst.appliance_switch_interval:]) / min([1,inst.appliance_switch_interval]))

Although I’m still not convinced but at least it’s not turning the immersion on with only 300W of excess solar!

@Neil_Brownlee Yes, that’s a bug. Apparently did not pay enough attention when reviewing the latest PR.
Will fix this later today.

2 Likes

hi @cypresss - did you find a solution to stopping the pyscript from spamming the logbook?

Sorry that was my fault. Thanks @Neil_Brownlee for the analysis and the fix.

Best,
Maik

Hi there,
I have a setup with Viction Multiplus II. An ET112 is connected to my system and can provide Load and Export power. Export power is “shown” as negative values and Load power as positive value.
So ideal function shoud to use Combien Import/Export power, but it is not compatible with the Optimizer. Do you have some idea about make a setup for this ?
Kind regards