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