Zero Solar Power Export with ESPEasy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Zero Solar Power Export with ESPEasy

#1 Post by Wiki » 17 Nov 2022, 12:43

I have a small Solar Voltaik system installed, in Germany called „Balkonkraftwerk“. Means: four solar panels, power production limited to 600 Watt, plugin-installation.

The system has four 410 Watt panels, a Hoymiles HM-1500 inverter, limited to 40% of the theoretical 1500 Watt it could deliver to fullfill the restrictions of german regulations. Because I don’t get anything back for exported power I want to avoid energy export as far as possible. ESPEasy gives me the opportunity to do this pretty easy.

Hardware:
4x410 Watt peak solar panels
1xHoymiles HM-1500 solar inverter, limited to 40%
1xAhoy DTU for getting the data of the inverter into MQTT (1xESP8266, 1x eByte nRF2401+ (https://www.amazon.de/gp/product/B07P8TTHZH), software from here: https://github.com/lumapu/ahoy)
1xESP32 with ESPEasy, compiled from Ath (https://letscontrolit.com/forum/viewtop ... 990#p60990)
1xVolkszaehler https://www.ebay.de/itm/314152997777

The Ahoy DTU sends the data of the inverter every ten seconds into MQTT, configured to a clean MQTT topic /inverter/HM-1500.

The Volkszaehler does the same with the data from the energy counter. The precompiled Tasmota firmware of the Volkszaehler sends the data as a JSON data set configured to Zaehler/SENSOR,{"Time":"2022-11-14T15:24:00","SML":{"Verbrauch":1.474,"Einspeisung":0.770,"Watt":26.000}}. Ath was so kind to build a special version for the ESP32 so I can read the second level of the JSON message using MQTT Import with a JSON attribute e.g. SML.Watt.

Now its very easy to process the informations and adjust the inverter to produce not more energy as I need in my house:

Code: Select all

On Solar3#Watt Do
  TaskValueSet,5,1,[Solar#P_AC]+[Solar3#Watt] //just for the statistics calculating the overall consumption
  Publish domoticz/in,'{"idx":144,"nvalue":0,"svalue":"[Calc#Verbrauch]"}' //sending it to domoticz
  If [Solar3#Watt]>=0 //if import from public net store the consumption to energy counter of Domoticz as consumtion
    Let,1,[Solar3#Verbrauch]*1000
    Publish domoticz/in,'{"idx":150,"nvalue":0,"svalue":"[Solar3#Watt];%v1%"}'
  Else  //if export to public net store it into a seperate energy counter in Domoticz
    Let,1,[Solar3#Einspeisung]*1000
    Let,2,[Solar3#Watt]*-1
    Publish domoticz/in,'{"idx":151,"nvalue":0,"svalue":"%v2%;%v1%"}' 
  EndIf
  If [Solar3#Watt]>6 AND [Solar#Limit]<40 AND [Solar2#U_DC3]>32 AND [Solar#P_AC]>0 AND [Calc#Timer]=0 //the voltage of one of the panels is taken as indicator if the raise of power limit makes sense to avoid sending too often, check if a timer is running
    If [Solar#SolarPowerAuto]=1 //if the automatic inverter limitation is set to „on“
      Let,1,[Calc#Verbrauch]+20 //current needed solar power
      If %v1%<=600  //if the desired limit doesn’t exceed the allowed maximum
         Publish inverter/devcontrol/0/11/0,%v1%
      Else //set to allowed maximum
         Publish inverter/devcontrol/0/11/0,600
      EndIf
      TaskValueSet,5,2,1  //set the remark that a timer is set
      TimerSet,1,30 //set a timer to avoid unnessecary tries of changes of the inverter limit, it takes around thirty seconds for the inverter to react
     EndIf
  ElseIf [Solar3#Watt]<-15 AND [Solar#SolarPowerAuto]=1 And [Calc#Timer]=0 //if too much energy is exported
     Let,1,[Calc#Verbrauch]+20
     Publish inverter/devcontrol/0/11/0,%v1% //reduce the inverter limit accordingly 
     TaskValueSet,5,2,1
     TimerSet,1,30
  EndIf
  Publish domoticz/in,'{"idx":133,"nvalue":0,"svalue":"[Solar2#U_DC1]"}' //fill some fields in Domoticz, in this case the DC voltage of the panels
  Publish domoticz/in,'{"idx":134,"nvalue":0,"svalue":"[Solar2#U_DC3]"}'
  Publish domoticz/in,'{"idx":147,"nvalue":0,"svalue":"[Solar2#U_DC2]"}'
  Publish domoticz/in,'{"idx":148,"nvalue":0,"svalue":"[Solar2#U_DC4]"}'
EndOn
On Solar#SolarPowerAuto Do
  If %eventvalue%=0 //should the inverter limitation to current power consumption switched
    Publish inverter/devcontrol/0/11/0,600 //Publish for Ahoy DTU, fixed limit following regulations
  Else
    TaskValueSet,2,4,1
  EndIf
EndOn
On Rules#Timer=1 Do //If the countdown set for waiting for the limit change of the inverter is over
  TaskValueSet,5,2,0
Endon
...snapshots from the configuration of the MQTT Import tasks will follow......
Last edited by Wiki on 17 Nov 2022, 14:29, edited 2 times in total.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Zero Solar Power Export with ESPEasy

#2 Post by TD-er » 17 Nov 2022, 13:16

Hmm, so you're limiting the max. power the inverter is allowed to generate, based on your demands?
Why not trying to 'consume' the excess energy by turning on a larger boiler heater so you actually use and store the energy?

Not sure what the rules and regulations are in .de, but this seems like you're trying to avoid paperwork for donating energy to the grid.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#3 Post by Wiki » 17 Nov 2022, 14:14

The regulation concerning a "Balkonkraftwerk" say: 600W max (!), 4 panels max., no export, if export you will not get paid for (but you are forced to install and pay a two-way-counter(!)). With the pretty old structure of the electric installations in my house its currently not possible to do more. In the future there will be more possible, including a battery for storing the nightly needed energy.

Why did I start the project? At least as a proof of concept, a kind of curiosity and to be prepared for the future. The hardware I needed anyway (Ahoy to limit the inverter following the restrictions, Volkszaehler because I like to know my consumption, ESPEasy to get the data into my Domoticz).

The result: I get the data into my Smarthome environment, am able to trace and adjust my personal power consumption. In parallel I've purchased some small infrared heating panels which will be switched automatically depending on the delivery of solar energy. Boiler heating will be possible in summer with enough sun, but not now.

Beside the desired benefits it is possible to reduce export almost to zero. With the regulation of no payment for exported energy I felt put-on, now I feel better.

And posting it here is just as an example for the easy use of MQTT import using ESPEasy in a lean environment like mine (Smarthome with just Domoticz and mosquitto on a Raspberry).

The promised screenshots:

MQTT Import Task "Solar", as a mixture of JSON parsing Domoticz buttons and clean MQTT read from Ahoy DTU:
Unbenannt.JPG
Unbenannt.JPG (54.85 KiB) Viewed 5723 times
Unbenannt1.JPG
Unbenannt1.JPG (83.5 KiB) Viewed 5723 times
Unbenann2t.JPG
Unbenann2t.JPG (41.46 KiB) Viewed 5723 times
MQTT Import Task "Solar3", JSON parsing,read from Volkszaehler:
Unbenannt3.JPG
Unbenannt3.JPG (49.6 KiB) Viewed 5723 times
Unbenannt4.JPG
Unbenannt4.JPG (81.87 KiB) Viewed 5723 times
MQTT Import Task "Solar2", clean MQTT topics from Ahoy:
Unbenannt5.JPG
Unbenannt5.JPG (47.55 KiB) Viewed 5723 times
Unbenannt6.JPG
Unbenannt6.JPG (75.12 KiB) Viewed 5723 times

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#4 Post by Wiki » 17 Nov 2022, 14:38

And the overview page of the tasks:
Unbenannt7.JPG
Unbenannt7.JPG (73.46 KiB) Viewed 5719 times

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Zero Solar Power Export with ESPEasy

#5 Post by TD-er » 17 Nov 2022, 14:40

It sure is a good use case to show how to act on derived data from other sensors and even platforms.
And if you later plan on turning on appliances to "burn" the energy when available, then adapting it is really easy :)

It was more that I wanted to understand the reasoning behind it.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#6 Post by Wiki » 17 Nov 2022, 14:53

Was pretty interesting how mighty the actual ESPEasy can act in an environment with different platforms.

Up to now the Raspberry has to collect data from different sources and publish them for use in Domoticz. Every time a new data delivery component took place in my home it was a pain in the a## to first analyze the data and then to script in python. Worked, but now with the MQTT import&parsing functionality a solution is only some clicks away. I am so glad with this solution, that I have ordered at once a handful ESP32 mini. Until today the ESP8266 was my favourite, did everything I needed, but now I will expand ;-).

Thank you all for this great stuff!

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Zero Solar Power Export with ESPEasy

#7 Post by Ath » 17 Nov 2022, 15:00

I love this showcase! :D
/Ton (PayPal.me)

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#8 Post by Wiki » 17 Nov 2022, 16:25

Ath wrote: 17 Nov 2022, 15:00 I love this showcase! :D
And THAT makes me happy. At least you made it work in this way.........

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Zero Solar Power Export with ESPEasy

#9 Post by Ath » 17 Nov 2022, 16:40

Wiki wrote: 17 Nov 2022, 16:25 ... At least you made it work in this way.........
It was only about 6 lines of code I had to add ;)
/Ton (PayPal.me)

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#10 Post by Wiki » 17 Nov 2022, 19:03

Ath wrote: 17 Nov 2022, 16:40
Wiki wrote: 17 Nov 2022, 16:25 ... At least you made it work in this way.........
It was only about 6 lines of code I had to add ;)
No!

- reading a post
- identifying the problem and identifying that you are the person who could solve it
- opening whatever programming environment you use
- searching in sources for the correct part (and knowing, which is the correct part)
- adding the six lines of code
- saving&compiling
- zipping and posting of the zipped binary
- adding a comment
- adding a pull request to add the solved problem to the project

That's what you did for minimum.

Taking into account that most of the thousands of ESPEasy users even don't care that they could contribute to this goldworthy project at least with a donated cup of coffee your support is outstanding. Personally you and TD-er have solved my sometimes stupid small problems so repeatedly (and not only mine!), I can't appreciate more.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

User avatar
Ath
Normal user
Posts: 3415
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Zero Solar Power Export with ESPEasy

#11 Post by Ath » 17 Nov 2022, 19:47

Wiki wrote: 17 Nov 2022, 19:03 ...
No!

- ...
:lol: :lol: :lol:

To my defense I want to enter that:
- I wrote large parts of the code in P037 MQTT Import regarding JSON support, filtering and mapping
- Adding all that took staring at the code for many hours, and testing (and crashing) many times
- I really like to work on ESPEasy, learning and solving all those (C++) puzzles while I'm at it

Thanks for expressing your gratitude (also) in words, it's really appreciated :)

And please keep those requests and questions coming 8-)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Zero Solar Power Export with ESPEasy

#12 Post by TD-er » 17 Nov 2022, 21:26

Wiki wrote: 17 Nov 2022, 19:03 [...]
- opening whatever programming environment you use
[...]
Quite sure this part wasn't needed, knowing Ton ;)

Appreciate the compliments and gratitude :)

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Zero Solar Power Export with ESPEasy

#13 Post by Wiki » 19 Nov 2022, 13:31

And just to be complete, this is, how my Domoticz room "Solaranlage" now looks like:
Unbenannt8.JPG
Unbenannt8.JPG (181.96 KiB) Viewed 5626 times

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

bonti69
Normal user
Posts: 119
Joined: 08 Apr 2021, 12:16

Re: Zero Solar Power Export with ESPEasy

#14 Post by bonti69 » 25 Feb 2023, 11:06

Deutschland uber alles :shock:
The regulation concerning a "Balkonkraftwerk" say: 600W max (!), 4 panels max., no export, if export you will not get paid for (but you are forced to install and pay a two-way-counter(!)).
I'm surprised to hear that, now in a major energy crisis, when germany (re-)opens coal plants...
In Romania, we got a very encouraging legislation for pro-sumators, latest year. What your solar panels produce will be counted, the consumption of course, after 2 years will be the regularisation, with 1:1 kwh produced/ kwh consumed. So, you can produce in summer, usually 10 panels can produce around 4kw power, and consume the energy in winter, that FAIR ENOUGH. Until a year ago, you have to consume what you produced a previous month, if not , the energy company paid you about a 1/4 of real price of kwh.
I also heard that in Hungary you will not allowed to inject the energy at all
In one word, ursulla rules :roll:
Last edited by bonti69 on 25 Feb 2023, 19:39, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Zero Solar Power Export with ESPEasy

#15 Post by TD-er » 25 Feb 2023, 12:18

In the Netherlands, you can still deduct the unused kWh from your consumed amount and you only pay for the difference.
When this difference is negative, you get a lot less per kWh.
However there are companies that tried to do this per month, but they now stand corrected as there has been a lawsuit about it and it has now been made clear that this period is meant to be per year, unless you switch from energy supplier.
Starting 2025, this will change and you can only deduct a smaller fraction of the kWh you feed in from your consumed kWh.
This fraction will be lowered each next year until it reaches 0 in 7 or 8 years.
For the rest of the feed-in kWh you will then get the same price as with the "total negative" amount of energy consumption.
They are still debating what this price should be. So far they only mentioned it should be "a fair price". Some suggested it to be 60 or 80% of the consumption price. (ex. VAT)

Last year my total energy bill was a few-100 euro.
This year I expect to get close to 0 as I have installed 11'000 Wp of solar panels and don't use gas. (for obvious reasons, since they had to demolish the entire street and rebuild it due to earth quakes, caused by gas extraction)

bonti69
Normal user
Posts: 119
Joined: 08 Apr 2021, 12:16

Re: Zero Solar Power Export with ESPEasy

#16 Post by bonti69 » 25 Feb 2023, 20:04

"...This fraction will be lowered each next year until it reaches 0 in 7 or 8 years."
That means you are allowed to inject few years, then goodbye? You can consume your own electricity or buy from us...
Seems stupid, but is not unintended. The power companies are afraid to lose their business. Forget the planet, climate change, our wallet first.
The 1:1 rule will not last to long...But this is very incentive, and drives the desire to go for solar. The biggest problem of solar energy is impredictibility and storage. [good to know: https://stopthesethings.files.wordpress ... isch_1.pdf ]. Well, you can predict that in winter you'll produce 10% that you produce in summer. You will never be selfsustain, because the demand in winter is maximum, when production is at minimum. Even if you oversize the panels, your production in summer will be so big you can't use. Your 10kw is also for heating?
So the grid company will be a huge battery, maybe in summer they will not burn any fossil, if there will be enough solar individuals. Individuals/pro-sumers will produce in summer and will be rewarded in winter, when suppliers start the power plants. Good enough for the planet.
Investment in battery banks is not advisable because of prices.
Look at the romanian electricity production, 5 to 5 minute sample, realtime : https://www.sistemulenergetic.ro/
Blessed country, 8000MWh production, 6500 consumed, no solar/is night, and only 2500 fossil ... And they f**k us with only 250kWh/month/family=aka grid meter at 0.16€/kwh, over 300kwh you pay 0.26€/kwh the entire quota
Attachments
Screenshot 2023-02-25 at 21-10-30 Productia si consumul de energie electrica in Romania pe ramuri de productie.png
Screenshot 2023-02-25 at 21-10-30 Productia si consumul de energie electrica in Romania pe ramuri de productie.png (92.43 KiB) Viewed 4336 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Zero Solar Power Export with ESPEasy

#17 Post by TD-er » 25 Feb 2023, 21:14

bonti69 wrote: 25 Feb 2023, 20:04 "...This fraction will be lowered each next year until it reaches 0 in 7 or 8 years."
That means you are allowed to inject few years, then goodbye? You can consume your own electricity or buy from us...
Seems stupid, but is not unintended. The power companies are afraid to lose their business. Forget the planet, climate change, our wallet first.
[...]
Well not entirely.

We have like 2 kWh prices (well it is a bit more complex, but let's assume this for now :) )
- Netto Consumption price
- Netto feed-in price.

Let's assume you pay 0.40 euro/kWh (the more complex situation is that the price is much higher, more on that later)
That means without solar panels, that's what you're paying.
With solar panels, let's assume you consume (from the energy company) 6000 kWh/year and produce (feed-in) 5000 kWh, then you first subtract the kWh's from eachother, leaving you 1000 kWh to pay, at 40ct/kWh = 400 euro.

If you consume 6000 kWh and solar panels produce 7000 kWh, you have a netto of -1000 kWh.
Then you would get 1000x the kWh netto feed-in price.
Typically this is somewhere between 5 and 15 ct/kWh, so let's assume 10ct/kWh => 100 euro paid to you.

Now the changes starting in 2025 and let's assume you feed in as much as you consume.

65% of the feed-in kWh can be deducted from your total consumption:
6000 x 0.4 euro/kWh = +2400 euro
64% of 6000 kWh x 0.4 euro/kWh = 3840 kWh x 0.4 euro/kWh = -1536 euro
36% of 6000 kWh x 0.1 euro/kWh = 2160 kWh x 0.1 euro/kWh = -216 euro

In total you have to pay 648 euro.

For 2025/2026 this is 64%, then each year it will be 9%-point less.
From 2031 on, it will be 0%

Now the incredibly complex part.
The actual kWh price is much higher than 40ct/kWh.
Some even had to pay close to 1 euro per kWh.
The government has put on a cap of 0.40/kWh, but only upto some limit, upto 2900 kWh.
Luckily, this limit of 2900 kWh is over a year, as long as you don't switch to another supplier during the year billing period.
So if you have solar panels, you can first deduct the kWh's (at least in 2023/2024) and if you end up with less than 2900 kWh, you know you don't have to pay more than 40 ct/kWh.
I have absolutely no idea how they will handle this starting 2025 as it has been made clear you have to take the year consumption/production and not per day or month.

TL;DR
They managed to make something as simple as an energy bill, into something nobody can understand anymore. Even judges have trouble deciding on what the law actually states.

bonti69
Normal user
Posts: 119
Joined: 08 Apr 2021, 12:16

Re: Zero Solar Power Export with ESPEasy

#18 Post by bonti69 » 25 Feb 2023, 22:41

For 2025/2026 this is 64%, then each year it will be 9%-point less.
From 2031 on, it will be 0%
Long story short, 7 years from now the only benefit of a roof with solar panels is to consume for yourself WHEN is sun, no point to inject in the grid anymore. Like our friend from germany said,
600W max (!), 4 panels max., no export, if export you will not get paid for (but you are forced to install and pay a two-way-counter(!)).
That means heating will be out of question, by electricity. Point.
Unfortunately, if things goes wrong, they can and will change the rules

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests