Seite 1 von 4

Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 8:06 am
von Frank-H
Ich habe einen Hoymiles 600 WR und mir auch schon eine Ahoy DTU zusammengebaut, die auch läuft und alle Werte anzeigt.
Ich habe auch gelesen, dass es möglich ist, diese per JSON direkt in die OpenWB einzulesen. Die in der entsprechenden Diskussion zur Open DTU angegebenen Werte funktionieren leider mit der Ahoy anscheinend nicht.
Ich bin ziemlicher Anfänger.
Kann jemand beschreiben, wie die Ahoy DTU korrekt per JSON in die OpenWB eingebunden werden kann?

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 8:19 am
von LutzB
Wie sieht denn das JSON aus und über welche URL kann es abgefragt werden? Um den Rest kümmert sich dann vermutlich Det. :D

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 8:29 am
von derNeueDet
Ach menno, immer ich :shock:

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 9:46 am
von Frank-H
Ist das gemeint:

Code: Alles auswählen

{"avail_endpoints":{"system":"http://192.168.188.77/api/system","statistics":"http://192.168.188.77/api/statistics","inverter/list":"http://192.168.188.77/api/inverter/list","index":"http://192.168.188.77/api/index","setup":"http://192.168.188.77/api/setup","live":"http://192.168.188.77/api/live","record/info":"http://192.168.188.77/api/record/info","record/alarm":"http://192.168.188.77/api/record/alarm","record/config":"http://192.168.188.77/api/record/config","record/live":"http://192.168.188.77/api/record/live"}}
?

Hier wäre auch ein Link zu Github: https://github.com/lumapu/ahoy

oder wäre das hilfreich (XXX ersetzt persönliche Daten):

Code: Alles auswählen

{"wifi":{"ssid":"XXXXXXXXXX","pwd":"","dev":"AHOY-DTU","adm":"XXXXXX","prot_mask":61,"dark":false,"ip":"","mask":"","dns1":"","dns2":"","gtwy":""},"nrf":{"intvl":15,"maxRetry":5,"cs":15,"ce":2,"irq":0,"sclk":0,"mosi":0,"miso":0,"pwr":1},"ntp":{"addr":"pool.ntp.org","port":123},"sun":{"lat":51.XXXXXXXXX,"lon":6.3XXXXXXXX,"dis":true,"offs":0},"serial":{"intvl":5,"show":false,"debug":false},"mqtt":{"broker":"","port":1883,"user":"","pwd":"","topic":"inverter","intvl":0},"led":{"0":255,"1":255,"act_high":false},"plugin":{"disp":{"type":0,"pwrSafe":false,"pxShift":true,"rotation":0,"contrast":60,"data":255,"clock":255,"cs":255,"reset":255,"busy":255,"dc":255}},"inst":{"en":false,"rstMidNight":false,"rstNotAvail":false,"rstComStop":false,"iv":[{"en":true,"name":"Hoymiles","sn":18972783XXXX1,"yield":[0,0,0,0],"pwr":[365,365,0,0],"chName":["Ost","West","",""]}]}}
?

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 10:07 am
von LutzB
Einer der Endpoints im ersten JSON müsste die aktuellen Daten liefern. Das musst Du ausprobieren und wenn Du fündig geworden bist daskomplette JSON inkl. passendem Endpoiont posten.

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 10:28 am
von derNeueDet
Ich würde mal gerne das JSON aus dem Endpoint live sehen.

Bitte beim Ersetzen aufpassen, dass du keine Zahlenwerte mit X überschreibst sondern mit einer Zahl! Ich suche ungern nach Parsing Fehlern😉

VG
Det

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 10:43 am
von Frank-H
Ich bitte Nachsicht, wenn mir nicht ganz klar ist, was mit "live sehen" gemeint ist. Ich habe von Programmierung leider keine Ahnung...

Hier Liste, wie sie aus "api/live" kommt:

Code: Alles auswählen

{"generic":{"wifi_rssi":-75,"ts_uptime":49,"menu_prot":true,"menu_mask":61,"menu_protEn":true,"esp_type":"ESP8266"},"refresh":15,"ch0_fld_units":["V","A","W","Hz","","°C","kWh","Wh","W","%","var"],"ch0_fld_names":["U_AC","I_AC","P_AC","F_AC","PF_AC","Temp","YieldTotal","YieldDay","P_DC","Efficiency","Q_AC"],"fld_units":["V","A","W","Wh","kWh","%"],"fld_names":["U_DC","I_DC","P_DC","YieldDay","YieldTotal","Irradiation"],"iv":[true,false,false,false,false,false,false,false,false,false]}
Vielleicht hilft auch ein Screenshot weiter:
Screenshot 2023-04-26 124151.jpg

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 10:46 am
von LutzB
Da snd ein paar Beschreibungen drin, aber keine aktuellen Messwerte. Geh wie geschrieben einfach alle Endpoints durch.

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 10:55 am
von Frank-H
Ich glaube, ich habe es in der /api/record/live gefunden. Leider weiß ich nicht, wie man es formatiert (es ist alles untereinander geschrieben), aber vielleicht kannst du trotzdem etwas damit anfangen:

Code: Alles auswählen

{"inverter":[[{"fld":"U_DC","unit":"V","val":"34.30"},{"fld":"I_DC","unit":"A","val":"2.48"},{"fld":"P_DC","unit":"W","val":"84.70"},{"fld":"YieldDay","unit":"Wh","val":"686.00"},{"fld":"YieldTotal","unit":"kWh","val":"404.91"},{"fld":"Irradiation","unit":"%","val":"23.21"},{"fld":"U_DC","unit":"V","val":"34.40"},{"fld":"I_DC","unit":"A","val":"2.51"},{"fld":"P_DC","unit":"W","val":"86.20"},{"fld":"YieldDay","unit":"Wh","val":"403.00"},{"fld":"YieldTotal","unit":"kWh","val":"390.63"},{"fld":"Irradiation","unit":"%","val":"23.62"},{"fld":"U_AC","unit":"V","val":"229.80"},{"fld":"I_AC","unit":"A","val":"0.71"},{"fld":"P_AC","unit":"W","val":"163.20"},{"fld":"Q_AC","unit":"var","val":"0.10"},{"fld":"F_AC","unit":"Hz","val":"49.99"},{"fld":"PF_AC","unit":"","val":"1.00"},{"fld":"Temp","unit":"°C","val":"25.40"},{"fld":"ALARM_MES_ID","unit":"","val":"1.00"},{"fld":"YieldDay","unit":"Wh","val":"1089.00"},{"fld":"YieldTotal","unit":"kWh","val":"795.54"},{"fld":"P_DC","unit":"W","val":"170.90"},{"fld":"Efficiency","unit":"%","val":"95.49"}]]}

Re: Ahoy DTU per JSON einbinden

Verfasst: Mi Apr 26, 2023 11:04 am
von Frank-H
Hier noch mal als "Rohdaten mit Formatierung":

Code: Alles auswählen

{
  "inverter": [
    [
      {
        "fld": "U_DC",
        "unit": "V",
        "val": "34.20"
      },
      {
        "fld": "I_DC",
        "unit": "A",
        "val": "2.95"
      },
      {
        "fld": "P_DC",
        "unit": "W",
        "val": "101.00"
      },
      {
        "fld": "YieldDay",
        "unit": "Wh",
        "val": "704.00"
      },
      {
        "fld": "YieldTotal",
        "unit": "kWh",
        "val": "404.93"
      },
      {
        "fld": "Irradiation",
        "unit": "%",
        "val": "27.67"
      },
      {
        "fld": "U_DC",
        "unit": "V",
        "val": "34.20"
      },
      {
        "fld": "I_DC",
        "unit": "A",
        "val": "2.52"
      },
      {
        "fld": "P_DC",
        "unit": "W",
        "val": "86.10"
      },
      {
        "fld": "YieldDay",
        "unit": "Wh",
        "val": "419.00"
      },
      {
        "fld": "YieldTotal",
        "unit": "kWh",
        "val": "390.64"
      },
      {
        "fld": "Irradiation",
        "unit": "%",
        "val": "23.59"
      },
      {
        "fld": "U_AC",
        "unit": "V",
        "val": "229.80"
      },
      {
        "fld": "I_AC",
        "unit": "A",
        "val": "0.78"
      },
      {
        "fld": "P_AC",
        "unit": "W",
        "val": "178.70"
      },
      {
        "fld": "Q_AC",
        "unit": "var",
        "val": "0.00"
      },
      {
        "fld": "F_AC",
        "unit": "Hz",
        "val": "50.00"
      },
      {
        "fld": "PF_AC",
        "unit": "",
        "val": "1.00"
      },
      {
        "fld": "Temp",
        "unit": "°C",
        "val": "25.50"
      },
      {
        "fld": "ALARM_MES_ID",
        "unit": "",
        "val": "1.00"
      },
      {
        "fld": "YieldDay",
        "unit": "Wh",
        "val": "1123.00"
      },
      {
        "fld": "YieldTotal",
        "unit": "kWh",
        "val": "795.57"
      },
      {
        "fld": "P_DC",
        "unit": "W",
        "val": "187.10"
      },
      {
        "fld": "Efficiency",
        "unit": "%",
        "val": "95.51"
      }
    ]
  ]
}