Monitoring and controlling - HOYMILES microinverters

Place your projects here
RonS
Posts: 115
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 64 times
Been thanked: 23 times

Monitoring and controlling - HOYMILES microinverters

Post by RonS »

I use a small self-built solar power plant - after all microinverters from "Envertech" died, I bought the ones from Hoymiles - HM-800
These also offer the possibility to regulate the power.

Now some hard-working guys have set out to hack the communication with these modules.
This resulted in two projects: one is the "openDTU", the other is the "Ahoy" DTU - The Hoymils inverters communicate with the help of an NRF24l01+ module. (see : Microcontroller.net and as an example https://ahoydtu.de)
Both projects use an ESP and these radio modules for communication and generate a web interface and support MQTT and a REST API -
this gave me the idea to monitor and possibly control the microinverters with an ESP32 and AnnexRDS.
The first steps have been taken:

Code: [Local Link Removed for Guests]

'DTU-Monitor

'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"
tft.init 1
tft.fill 0
ret$=""
TFT.TEXT.POS 3,10 : TFT.TEXT.SIZE 2 : tft.text.color white
tft.print WORD$(IP$,1) 
tft.print ""
ONWGETASYNC answer_done

' do an HTTPS GET request
'WGETASYNC "http://192.168.2.34/api/statistics", 80
'pause 2000
'wgetasync "http://192.168.2.34/api/livedata/status/inverters",80
'pause 1000
'wgetasync"http://192.168.2.34/api/inverter/list",80
'pause 1000
do
'wgetasync"http://192.168.2.34/api/livedata/status/inverter",80
'pause 1000
wgetasync"http://192.168.2.34/api/inverter/id/0",80
pause 5000
loop
Wait

answer_done:
'wlog WGETRESULT$
tft.fill 0
TFT.RECT 0, 30, 310, 30, tft.rgb(80,80,80),1,15
TFT.TEXT.POS 0,35 : TFT.TEXT.SIZE 3 : tft.text.color white
search$="ch"'channel
ret$=json$(WGETRESULT$, search$)
if ret$ <> "not found" then
sw$=ret$
sw$=replace$(sw$,"["," "):sw$=replace$(sw$,","," ")
DatCount=word.count(sw$,",") : wlog DatCount
delimiter$ = chr$(32)
dim Daten$(13) 


'for z = 1 to 13
  Daten$(1) = word$(sw$, 4)
'next z
'for z = 1 to 9
  tft.print Feld$(1);":"; Daten$(1)
'next z


end if
Return


The (first) result is the output of the instantaneous power generation on a TFT display with Annex
DSCN0570.JPG


a picture of the AHOY DTU module:


DSCN0572.JPG
and a picture of the AHOY- web-interface:

image.png
You do not have the required permissions to view the files attached to this post.
Last edited by RonS on Thu Sep 28, 2023 8:47 am, edited 2 times in total.
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 »

the next step would be to collect the grid data, I'm still thinking about which module I'll take to choose from, e.g. a SHELLY 3EM but I don't need 3 phases.But this SHELLY 3EM can be queried with WGET

have a nice day
Ron

PS: I am always grateful for your hints and improvements to the code and the entire project
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 »

Ok I looked around a bit, the Shelly is too expensive for me. But.
Most sensors, including the "ahoy dtu", "tasmota" and "Tuya" send data to an MQTT broker
My question: Is it possible to receive it and what would be the settings for it?
I have already tried with the "onmqtt" command - as in the manual, however, nothing could receive
The Ahoy dtu sends to port 1883, can be changed, have also entered the IP address of my "receiver". see picture:

transmitter side:
image.png
thanks Ron
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
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by peridot »

Node Red running on a Pi Zero? I use one to receive data from my Fronius Inverter.
image.png
You do not have the required permissions to view the files attached to this post.
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 »

thanks peridot ,

Receiving the data from the Ahoy DTU and therefore the inverter is not the problem via GET request works with annex beautiful
that's how it's supposed to work with the SHELLY, but I was looking for alternatives, e.g. receiving MQTT data from these modules into the esp with annex
Ron
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by peridot »

OK, understand now, do you have a MQTT server running on your network? if not try a HiveMQ broker, I have a Hive acc and post/read data very successfully with Annex.
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 »

no,
"tasmota" and "shelly" and "tuya" - modules are sending data to a broker, automatic , these data I would like to receive with an esp and annex
if that's not possible I have to buy an expensive Shelly module where I can pick up the data via GET request, which should work according to my internet research

when that's done, I can calculate how much my microinverter is allowed to produce so that nothing is fed back into the GRID
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by peridot »

Hi Ron, sorry we are going in circles :? probably its because I am not understanding what you already have or familiar with those devices.
I did a little digging myself on the AhoyDTU project and to use the MQTT they need to run a MQTT broker (Mosquito) locally, from Ahoy setup. Not sure if it will send outside your local network if you wanted to use say "Hive" but Ahoy does not currently do SSL so that would be a problem.

image.png

So you would have to set up a Mosquito server running locally (Ie Pi Zero) then get you data into Annex from that but seems like a extra step?
This is how I understand it anyway, Mike
You do not have the required permissions to view the files attached to this post.
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 »

yes , peridot ,

that's how it would work - ahoy, tasmota and tuya and shelly also do it this way - the other way is via wget request directly and without extra ioBroker.
that's why I do this with wget and it works fine with the AHOY DTU-
An example of the received data - from this I then extract the current performance:

Code: [Local Link Removed for Guests]

HTTP/1.1 200 OK
Content-Length: 397
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: content-type
Connection: close
Accept-Ranges: none

{"id":0,"enabled":true,"name":"WR01","serial":"1141915xxxxx","version":"10016","power_limit_read":70,"power_limit_ack":false,"ts_last_success":1695967512,"generation":0,"status":2,"alarm_cnt":0,"ch":[[240.5,0.14,34.6,50,1,16.6,66.335,13.37,36.4,95.055,0,457.6],[34.4,0.61,20.9,7.64,36.33,5.225,239.9],[32.9,0.47,15.5,5.73,30.005,3.875,240.8]],"ch_name":["AC","1","2"],"ch_max_pwr":[null,300,300]}
but now I also want to measure the grid power to see how much I take from the grid and how much is fed into the grid
there is an example with a module "SHELLY 3EM" that works the same way - But this the "SHELLY EM" is very expensive.
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
peridot
Posts: 46
Joined: Mon Mar 08, 2021 4:54 am
Has thanked: 7 times
Been thanked: 93 times

Re: Monitoring and controlling - HOYMILES microinverters

Post by peridot »

Ah, OK, I believe the usual way is to use a CT sensor on the mains input tail and one one on each of the feeds to house loads, this way you can calculate everything.
In Australia in new houses the electrical cabinet is very integrated into the building and cannot be accessed without an electrician and certification, So that is out for me, I take a "partial" approach I measure the watts rate usage led on the smart meter , I use for most sensors around home esp8266 running "espeasy" as its versatile to setup and program and is rock solid, pretty well set and forget. I then recover the data from a Fronius Inverter and calculate in a Annex ESP32 module the Grid usage , I can't get absolute values as i can't know actual usage but its near over time. I am currently rebuilding my system but have in the past used EmonCMS running on a Raspberry Pi 4. See my web page describing the logger end of my previous system here.
Post Reply