Monitoring and controlling - HOYMILES microinverters

Place your projects here
Helmut_number_one
Posts: 122
Joined: Fri Dec 09, 2022 10:03 am
Has thanked: 54 times
Been thanked: 14 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by Helmut_number_one »

Ich nutze OpenDTU und habe Ron's Projekt etwas verändert.
Man(n) kann fast alles darstellen, einzelne Strings, ich brauche nur das was ich hier auf dem Bild zeige.
Danke an Ron für die Vorarbeit.
Edit: nachdem mir der Entwicker cicciocb bei der Curl in ESPBasic geholfen hat, kann man nun auch die Leistung über ESP32Basic einstellen

I use OpenDTU and have modified Ron's project slightly.
You can display almost anything, individual strings, I only need what I show here in the picture.
Thanks to Ron for the preparatory work
Edit: the developer cicciocb helped me with curl in ESPBasic, you can now also adjust the Power Limit via ESP32Basic
Annex Version 1.51.5 on ESP32-2432028b board tested
On this board you can switch off the RGB-LED with this code:

Code: [Local Link Removed for Guests]

' RGB-LED switch off on ESP32-2432S028 board
LED_R = 4
LED_G = 16
LED_B = 17


pin.mode LED_R, input
pin.mode LED_G, input
pin.mode LED_B, input
Edit 26.11.23 Code with bedder text print, watchdog

Code: [Local Link Removed for Guests]

 
'TOUCH.CALIB

OPTION.BASE 1
OPTION.WLOG 1

option.wdt  40000

tft.init 1
gui.init 6, black

Pegel0=0 :Pegel1=0 : Pegel2=10:  Pegel3=0: Slider=0
Testbalken1 = GUI.ProgressBar(5,31,316,147,Pegel3,0,pink, black,black)
Prg1 = GUI.ProgressBar(5, 180, 312, 20,Pegel1 ,0 ,pink ,black ,white )
Prg2 = GUI.ProgressBar(5, 202, 312, 20,Pegel0 ,0 ,yellow ,black ,white )
Gui.SetRange Prg1, 0, 4800 
Gui.SetRange Prg2, 0, 900 

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

do

gosub OpenDTUreq

gosub touchme

loop
Wait

OpenDTUreq:

wgetasync"http://192.168.0.73/api/livedata/status" 
pause 4000
resultSolar$ = wgetresult$

power$=STR$(val(json$(RESULTSolar$, "Power.v")),"%2.1f")  
voltage$=STR$(val(json$(RESULTSolar$, "Voltage.v")),"%2.1f")    
total$=STR$(val(json$(RESULTSolar$, "YieldTotal.v")),"%2.1f") 
Day$=STR$(val(json$(RESULTSolar$, "YieldDay.v")),"%2.1f")     
Temp$=STR$(val(json$(RESULTSolar$, "Temperature.v")),"%2.1f") 
Leistung$=STR$(val(json$(RESULTSolar$, "limit_relative")),"%2.1f") 
'Day$ = str$(4200) zum testen der Balkenanzeige

if power$ = "not found" then
  gosub failed
else
gui.refresh 
gui.redraw

  TFT.TEXT.POS 5,37 : TFT.TEXT.SIZE 2 : tft.text.color green
  tft.text.color green,black'tft.rgb(0,0,0)
  tft.print " P= "+ Power$ + " W" + " / " + Temp$ + " "+chr$(39)+" Cel"
  TFT.TEXT.POS 5,67 : TFT.TEXT.SIZE 2 : tft.text.color pink
  tft.text.color pink,black
  tft.print " P Total : "+total$ + " kWh"
  TFT.TEXT.POS 5,97 : TFT.TEXT.SIZE 2 : tft.text.color red
  tft.text.color red,black
  tft.print " P Heute : "+Day$+" W" 
  TFT.TEXT.POS 5,127 : TFT.TEXT.SIZE 2 : tft.text.color white
  tft.text.color green,black
  tft.print " Spannung: "+voltage$+" V" 
  TFT.TEXT.POS 5,157 : TFT.TEXT.SIZE 2 : tft.text.color yellow
  tft.print " Limit   : "+Leistung$  + " %"
  TFT.TEXT.POS 5,182 : TFT.TEXT.SIZE 2 : tft.text.color white
  tft.print "0-                     5kw"
  
Return

failed:
tft.text.color red
tft.print " Connection failed"
pause 2000
OPTION.WDTRESET
'option.wdt 1
return

touchme:
  
Pegel1=val(Day$) 
Pegel0=val(Power$) 
Pegel2=val(Leistung$)
'
Gui.SetValue Prg1, Pegel1 
gui.setvalue Prg2, Pegel0

  TFT.TEXT.POS 5,182 : TFT.TEXT.SIZE 2 : tft.text.color red
  tft.print "   P Heute: "+Day$ +" W"
  TFT.TEXT.POS 5,205: TFT.TEXT.SIZE 2 : tft.text.color green
  tft.print "             "   +Power$+" W"
  OPTION.WDTRESET
return
OnTouch touchme

wait

 

touchme:

  touch.read 'Read the calibrated position

  print "touched", touch.x, touch.y, touch.z
 OPTION.WDTRESET
return

You do not have the required permissions to view the files attached to this post.
Last edited by Helmut_number_one on Sun Nov 26, 2023 9:09 am, edited 4 times in total.
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 65 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

a question :
is there a command in annexRDS with which you can simple measure the time in a running program ? I didn't find anything (but that doesn't mean anything :) )
my goal is to collect values e.g. every 5 min on average to then store them in an array and display them later

Ron
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by cicciocb »

Yes, time$
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by cicciocb »

Or, if you want see the time passed from a given moment, use millis
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 65 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

hmmm,
MILLIS
Returns the number of milliseconds elapsed since the start-up of the module
there is no syntax...or example -it is possible? :
let millis = 0
do someting
if millis=5000 then millis=0 ??

thanks
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
User avatar
cicciocb
Site Admin
Posts: 2195
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 470 times
Been thanked: 1461 times
Contact:

Re: Monitoring and controlling - HOYMILES microinverters

Post by cicciocb »

you can simply do like this

t = millis
.......
.... your program
.....
.....
print millis - t ' print the time passed in milliseconds
.....
.....
User avatar
Electroguard
Posts: 946
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 310 times
Been thanked: 352 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by Electroguard »

Or do similar with unixtime in seconds, history = timeunix(time$) then keep testing time$ for when timeunix(time$) exceeds history + duration_secs.
BeanieBots
Posts: 361
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 197 times
Been thanked: 115 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by BeanieBots »

Or use one of the two timers to repeat a sub routine every X milliseconds.

TIMER0 interval, label
wait

label:
do something
Return
Schallschutz
Posts: 12
Joined: Wed Apr 19, 2023 9:28 pm
Has thanked: 2 times
Been thanked: 1 time

Re: Monitoring and controlling - HOYMILES microinverters

Post by Schallschutz »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Oct 19, 2023 2:29 pm 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


Hello Helmut,

please try this peace of code to set the Hoymilies Limit (non permanent).

Code: [Local Link Removed for Guests]

DTU_user$ = "admin"            ' Username  
DTU_password$="12345678"		' Pawword 
DTU_ip$ = "192.168.178.60"   
limit_set = 400 ' Set Limit to this value - 400 Watt


head$ = "application/x-www-form-urlencoded"
message$ = |data={"serial":"116181623423", "limit_type":0, "limit_value":xxx}|      ' please change the serial to your Hoymiles serial
m$ = replace$(message$, "xxx", str$(limit_set)) ' replace  'xxx' with the value
      WLOG "Limit will set to :" , limit_set
a$ = WPOST$("http://" + DTU_user$ + ":" + DTU_password$ + "@" + DTU_ip$ + "/api/limit/config", m$, 0 ,head$)
wlog a$
regards
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 65 times
Been thanked: 23 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by RonS »

thanks "schallschutz" for your replay ,
we 'v found the answer at this place : [Local Link Removed for Guests]

for ahoy and open DTU
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
Post Reply