Monitoring and controlling - HOYMILES microinverters

Place your projects here
Helmut_number_one
Posts: 98
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 42 times
Been thanked: 9 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by Helmut_number_one »

Yes, you are my hero
Danke, ich hatte val auch schon probiert, wohl nicht so richtig ;-)
User avatar
PeterN
Posts: 392
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 184 times
Been thanked: 220 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by PeterN »

Good!
Be careful, because json$ might return a "not found", resulting in a numeric value 0, if I'm not mistaken

Viel Erfolg und Spaß!
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

hi my code is nearly finishd - using a ILI9341 Display with an A-Z Touch Mod
added some Progressbars ,Monitoring the Inverter Power an the Grid Power- the control of the microinverter is still missing

@Helmut - take a look into the code it is easy to read ot the DTU -i think AHOY is similar to "openDTU"

Code: [Local Link Removed for Guests]

'SHELLY-Commands1 http://shellyem-3494547bb5f5/relay/0?turn=on
'touch.calib
OPTION.BASE 1
OPTION.WLOG 1

dim Feld$(6)
Feld$(1) = " Produktion":Feld$(2)="2":Feld$(3)="3":Feld$(4)="4":Feld$(5)="5"
dim Daten$(6)
tft.init 1
gui.init 2, black

Pegel0=0 :Pegel1=0
Prg1 = GUI.ProgressBar(5, 180, 305, 20,Pegel1 ,0 ,red ,white ,black )'ProgessBar GRID Power
Prg2 = GUI.ProgressBar(5, 202, 305, 20,Pegel0 ,0 ,green ,white ,black )'ProgressBar Power Generation
Gui.SetRange Prg1, 0, 3800 'single Phase full load
Gui.SetRange Prg2, 0, 800 'HM Inverter full load

TFT.TEXT.POS 3,10 : TFT.TEXT.SIZE 2 : tft.text.color white
tft.print "DTU.IP:", WORD$(IP$,1) ;"";wifi.rssi
tft.print ""
pause 2000



do
OnTouch touchme
gosub shellyreq
gosub DTUreq
gosub touchme
loop
Wait

shellyreq:

wgetasync"http://shellyem-3494547bb5f5/status" ' do an HTTPS GET request
'wlog WGETRESULT$
pause 3000
result$=wgetresult$

TFT.RECT 0, 60, 320, 120, tft.rgb(80,80,80),1,15
TFT.TEXT.POS 5,67 : TFT.TEXT.SIZE 3 : tft.text.color white

search1$="power"'channel
power$=json$(RESULT$, search1$)
search2$="voltage"'channel
voltage$=json$(RESULT$, search2$)
search3$="total"'channel
total$=json$(RESULT$, search3$)
search4$="total_returned"'channel
returned$=json$(RESULT$, search4$)
'wlog power$,voltage$,total$,returned$
if power$ = "not found" then
gosub failed
else
'write values to display
tft.text.color white
  tft.print "Verbrauch:";
  if left$(power$,1)= chr$(45)
  tft.text.color green : power$=mid$(power$,2,4):Gui.SetColor Prg1, green, white, black
  else
  tft.text.color red
  Gui.SetColor Prg1, red, white, black
  endif

if instr(1,power$,".") =3 then
  tft.print left$(power$,2);" Wh"
else
  tft.print left$(power$,4);" Wh"
  
endif
TFT.TEXT.POS 5,97 : TFT.TEXT.SIZE 3 : tft.text.color white
  tft.print "Total :";total$;" kW"
TFT.TEXT.POS 5,127 : TFT.TEXT.SIZE 3 : tft.text.color white
  tft.print "Spannung:";left$(voltage$,3);" Volt"  
Return
failed:
tft.text.color red
tft.print " Connection failed"
pause 2000
option.wdt 1
return
DTUreq:

DTUresult$=wget$("http://192.168.2.34/api/inverter/id/0")
DTUsearch$="ch"'channel
DTUret$=json$(DTUresult$, DTUsearch$)
'ret$=json$(WGETRESULT$, search$)
if DTUret$ <> "not found" then
DTUsw$=DTUret$
DTUsw$=replace$(DTUsw$,"["," "):DTUsw$=replace$(DTUsw$,","," ")
TFT.RECT 0, 10, 320, 30, tft.rgb(80,80,80),1,15
TFT.TEXT.POS -8,15 : TFT.TEXT.SIZE 3 : tft.text.color white
  Daten$(1) = word$(DTUsw$, 4)
  tft.print Feld$(1) + ":";
  tft.TEXT.COLOR green
  tft.print left$(Daten$(1),3) + " Wh"
  endif
return
touchme:

  
Pegel1= val(power$)
Pegel0=Val(Daten$(1))
'wlog Pegel1;Pegel0
Gui.SetValue Prg1, Pegel1 
gui.setvalue Prg2, Pegel0
'Gau2 = GUI.Gauge(10, 50, 150, 150, val(power$) ,black, white ,green ,3)

gui.refresh 
gui.redraw
'wlog ramfree
return
DSCN0583.JPG
You do not have the required permissions to view the files attached to this post.
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

@Helmut
this is the string you will get with:

Code: [Local Link Removed for Guests]

DTUresult$=wget$("http://192.168.2.34/api/inverter/id/0")
Result:

Code: [Local Link Removed for Guests]

{"id":0,"enabled":true,"name":"WR01","serial":"11419155xxxxxx","version":"10016","power_limit_read":65535,"power_limit_ack":false,"ts_last_success":1697645246,"generation":0,"status":0,"alarm_cnt":1,"ch":[[229.4,0,0,50.03,0,13.5,91.752,2519,0.7,0,0,564.9],[14.9,0.02,0.3,1081,49.406,0.075,297.5],[14.9,0.03,0.4,1438,42.346,0.1,295.9]],"ch_name":["AC","1","2"],"ch_max_pwr":[null,400,400]}
these all strings so you can parse them
Ron
PS:but watch out for a wlog output didn't work for me at the same time as writing to the TFT
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
Helmut_number_one
Posts: 98
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 42 times
Been thanked: 9 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by Helmut_number_one »

Hallo Ron,
wie kann man(n) die Leistung steuern? außer durch MQTT habe ich keinen Weg gefunden.
Das bedeutet aber, dass man ein Broker nutzen muss.
Ich nutze zwar IP-Symcon und kann das alles damit machen, hätte aber gern ein Wand-touch-Display.
Hatte schon mit Virtuinio IOT und Modbus TCP gearbeitet, jetzt mal mit ESP32 ;-)
https://www.youtube.com/watch?v=CwgmrcxG7hQ
Hast Du da schon einen Ansatz?
Alles Gute

Hello Ron,
how can you control the performance? I haven't found a way other than through MQTT.
But that means you have to use a broker.
I use IP-Symcon and can do everything with it, but I would like a wall touch display.
Do you already have an approach?
Best regards, Helmut
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

Hello,

the "openDTuU or AHOY DTU communicate directly with the inverter - so you can not only receive data but also control certain values, for example the "Power Limit", so it is done and you don't need anything else
see this example :

https://selbstbau-pv.de/wissensbasis/nu ... steuerung/

If you have tested this successfully, let me know :)

have a nice Day
Ron
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

*annoyed...; :oops:

the ESP32 module - ESP32 dev Kit V4 - for the TFT display died again overnight - I noticed that it was very warm from the beginning an - this can be prevented by reducing the WIFI Power ?? ??? - Or has anyone already cooled the chip with a fan ??
it started with the fact that the get requests were no longer reliably processed - same as in the previous module

have a better Day
Ron
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
User avatar
PeterN
Posts: 392
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 184 times
Been thanked: 220 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by PeterN »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Oct 20, 2023 8:57 am *annoyed...; :oops:

the ESP32 module - ESP32 dev Kit V4 - for the TFT display died again overnight - I noticed that it was very warm from the beginning an - this can be prevented by reducing the WIFI Power ?? ??? - Or has anyone already cooled the chip with a fan ??
it started with the fact that the get requests were no longer reliably processed - same as in the previous module

have a better Day
Ron
Is your ESP32 board damaged at the voltage regulator? Have you connected (too many) external devices (display etc.) to the internal 5V>3V3 regulator? This could be too much current or power dissipation for the regulator.

I have noticed more and more 5V power supplies lately that actually have a 5V2 output, so a 1N4001 to reduce the voltage can also reduce the power to the 3V3 regulator.
Or you can use a separate power supply/ regulator.


A problem could also arise if 5V peripherals are connected to the only 3V3 tolerant (!) inputs of the ESP32
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

hi Peter,
i use this :https://www.az-delivery.de/products/az- ... VAQAvD_BwE

the Voltage at the 5V Pin ist exactly 4.994 V !

It is also remarkable: now that it no longer works, the ESP chip is only half as warm - but tomorrow I will receive new modules. then I will reduce the Wifi power first and see what comes - it worked well for a few days
Last edited by RonS on Fri Oct 20, 2023 9:50 am, edited 1 time in total.
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
User avatar
PeterN
Posts: 392
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 184 times
Been thanked: 220 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by PeterN »

Oh !!!
Would not have expected problems with the use of this board.
That is indeed annoying!
Post Reply