lumapu / ahoy

Various tools, examples, and documentation for communicating with Hoymiles microinverters
https://ahoydtu.de
Other
951 stars 224 forks source link

Werte ohne MQTT weiter verarbeiten #1061

Closed ningyichensha closed 1 year ago

ningyichensha commented 1 year ago

Ich möchte die Messwerte ohne MQTT per wifi im Haus weiterleiten. Im Modul show livedata habe ich es bereits erfolgreich integriert. Aber dieses Modul wird nur aufgerufen, wenn ich die Seite des esp Ahoy am PC oder smatphone aufrufe.

Wie geht das ohne den Aufruf der Seite?

so habe ich es gemacht: Modul app.cpp ab Zeile 630 for(uint8_t fld = 0; fld < 10; fld++) { pos = (iv->getPosByChFld(CH0, list[fld])); if(0xff != pos) { modHtml += F("<div class=\"subgrp\">"); modHtml += F("<span class=\"value\">") + String(iv->getValue(pos)); modHtml += F("<span class=\"unit\">") + String(iv->getUnit(pos)) + F(""); modHtml += F("<span class=\"info\">") + String(iv->getFieldName(pos)) + F(""); modHtml += F("

");

                if (String(iv->getFieldName(pos)) == "P_DC") {

                DPRINTLN(String(iv->getFieldName(pos)) + " " + String(iv->getValue(pos)));
                WiFiClient client;
              if (!client.connect(host_licht_roll_kueche_sued, 5585)) {
              Serial.println("connection failed");
              }

            // This will send a string to the server
            Serial.println("sending data to server");
            if (client.connected()) {
            client.println((String(iv->getFieldName(pos)) + " " + String(iv->getValue(pos))));**
            }

Hardware

Modelname: __ Retailer URL: __

nRF24L01+ Module

Antenna:

Power Stabilization:

Version / Git SHA:

Version: ..__ Github Hash: ___

Build & Flash Method:

Debugging:

lumapu commented 1 year ago

I think you should test the feature "print inverter data" which is contained in the "system config" section of the settings. Otherwise you should have your own build to do that. We provide two options: MqTT and REST API

ningyichensha commented 1 year ago

@lumapu Thanks for your suggestions. In the meantime I found this solution:

I trigger your dtu software with this code in my application:

async def url(): while True: try: urequests.get("http://192.168.178.93/livedata") except: pass await asyncio.sleep(60)

Then, I receive the data which I need by my extension to your Modul app.cpp. see the 1. post.

Danke Peter