<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Moin Allerseits,</p>
    <p>ich hab mal an VZ-Users geantwortet. passt wohl besser.</p>
    <p>Ich hab einen ESP (nodeMCU) laufen um Temperaturen von der
      Heizung an den VZ zu schicken. Vielleicht hilft dir der Code zu
      starten.</p>
    <p>Das ist auch zusammengeklaut und sicherlich keine schöner Code.
      läuft aber prächtig und kann nach dem ersten flashen über USB
      sogar über WIFI neu geflasht werden.</p>
    <p>Was macht das Ganze:</p>
    <p>Erstmal Setup vom WIFI, OTA und den DS18B20 Sensoren.</p>
    <p>Dann wird eine Webseite mit den letzten ausgelesenen Werten
      gebaut. Wenn einer danach fragt ;)</p>
    <p>Der nächste Block liest die Sensoren aus und meldet das an die
      middleware. Und zwar wenn der Timer abgelaufen ist 10*60*1000
      millisekunden.</p>
    <p>Ich denke so wie man die Werte schreibt, bekommt man sie auch
      gelesen und dann weiterverarbeitet.</p>
    <p><br>
    </p>
    <p>Viele Grüße</p>
    <p>Marcus<br>
    </p>
    <p><br>
    </p>
    <p>// Including the ESP8266 WiFi library<br>
      #include <ESP8266WiFi.h><br>
      #include <WiFiClient.h><br>
      #include <OneWire.h><br>
      #include <DallasTemperature.h><br>
      #include <ESP8266mDNS.h><br>
      #include <WiFiUdp.h><br>
      #include <ArduinoOTA.h><br>
      <br>
      // Replace with your network details<br>
      const char* ssid = "SSID";<br>
      const char* password = "WIFI-KEY";<br>
      const char* host = "ESP-Heizung";<br>
      <br>
      #define ONE_WIRE_BUS_1 D4<br>
      <br>
      String url1 = "GET /vz/htdocs/middleware.php/data/";<br>
      const char* vzhost1 = "192.168.1.XX"; // IP-Adresse des Servers
      (mit Punkten!)<br>
      const char* uuid_t1 = "XXXXXXXXXXXX-11e4-9ff2-XXXXXXXXXXXX"; //EG
      R<br>
      const char* uuid_t2 = "XXXXXXXXXXXX-e92d-11e4-99e7-XXXXXXXXXXXX";
      //EG V<br>
      const char* uuid_t3 = "XXXXXXXXXXXX-e92d-11e4-83b4-XXXXXXXXXXXX";
      //OG R<br>
      const char* uuid_t4 = "XXXXXXXXXXXX-e92d-11e4-a7fb-XXXXXXXXXXXX";
      //OG V<br>
      const char* uuid_t5 = "XXXXXXXXXXXX-e92d-11e4-8721-XXXXXXXXXXXX";
      //Raum<br>
      <br>
      const long interval1 = 10*60*1000; //meldeintervall an middelware<br>
      unsigned long timer1 = 0 - interval1;<br>
      <br>
      // Web Server on port 80<br>
      WiFiServer server(80);<br>
      <br>
      OneWire oneWire1(ONE_WIRE_BUS_1);<br>
      DallasTemperature sensors(&oneWire1);<br>
      DeviceAddress Probe01 = { 0x28, 0xFF, 0x52, 0xCE, 0x69, 0x14,
      0x04, 0xEF }; <br>
      DeviceAddress Probe02 = { 0x28, 0xFF, 0x79, 0x34, 0x65, 0x14,
      0x01, 0x89 };<br>
      DeviceAddress Probe03 = { 0x28, 0xFF, 0x98, 0xD0, 0x69, 0x14,
      0x04, 0x5D };<br>
      DeviceAddress Probe04 = { 0x28, 0xFF, 0x36, 0xA8, 0x65, 0x14,
      0x01, 0xFC };<br>
      DeviceAddress Probe05 = { 0x28, 0xFF, 0x0B, 0xA8, 0x65, 0x14,
      0x01, 0x94 };<br>
      <br>
      <br>
      float temp1(NAN), temp2(NAN), temp3(NAN), temp4(NAN), temp5(NAN);<br>
      <br>
      void setup() {<br>
        // Initialize the Temperature measurement library<br>
        sensors.begin();<br>
        // set the resolution to 10 bit (Can be 9 to 12 bits .. lower is
      faster)<br>
        sensors.setResolution(Probe01, 10);<br>
        sensors.setResolution(Probe02, 10);<br>
        sensors.setResolution(Probe03, 10);<br>
        sensors.setResolution(Probe04, 10);<br>
        sensors.setResolution(Probe05, 10);<br>
      <br>
        WiFi.mode(WIFI_STA);<br>
        WiFi.hostname(host);<br>
        WiFi.begin(ssid, password);<br>
        while (WiFi.status() != WL_CONNECTED) {<br>
          delay(500);<br>
          }<br>
          <br>
      // Starting the web server<br>
        server.begin();<br>
        delay(1000);<br>
        ArduinoOTA.setHostname(host);<br>
        ArduinoOTA.begin();<br>
        <br>
      }<br>
      <br>
      void loop() {<br>
         ArduinoOTA.handle();<br>
      <br>
        // Listenning for new clients<br>
        WiFiClient client = server.available();<br>
        if (client) {<br>
      //    New client<br>
          // bolean to locate when the http request ends<br>
          boolean blank_line = true;<br>
          while (client.connected()) {<br>
            if (client.available()) {<br>
              char c = client.read();<br>
              if (c == '\n' && blank_line) {<br>
                  client.println("HTTP/1.1 200 OK");<br>
                  client.println("Content-Type: text/html");<br>
                  client.println("Connection: close");<br>
                  client.println();<br>
                  client.println("<!DOCTYPE HTML>");<br>
                  client.println("<html>");<br>
      //            client.println("<head><meta
      http-equiv='refresh' content='60'/><title>ESP8266 -
      Temperature and Humidity</title></head>");<br>
                  client.println("<head><title>ESP8266 -
      Temperature DS18B20</title></head>");<br>
                  client.println("<body><h1>ESP8266 -
      Temperature DS18B20</h1>");<br>
                  client.println("<h3>EG R Temperature in Celsius:
      ");<br>
                  client.println(temp1);<br>
                  client.println("C</h3>");<br>
                  client.println("<h3>EG V Temperatur in Celsius:
      ");<br>
                  client.println(temp2);<br>
                  client.println("C</h3>");<br>
                  client.println("<h3>OG R Temperatur in Celsius:
      ");<br>
                  client.println(temp3);<br>
                  client.println("C</h3>");<br>
                  client.println("<h3>OG V Temperatur in Celsius:
      ");<br>
                  client.println(temp4);<br>
                  client.println("C</h3>");<br>
                  client.println("<h3>Heizraum Temperatur in
      Celsius: ");<br>
                  client.println(temp5);<br>
                  client.println("C</h3>");            <br>
                  client.println("<h3> ESP IP: ");<br>
                  client.println(WiFi.localIP());<br>
                  client.println("</h3>");<br>
                  client.println("<h3> WLAN SSID: ");<br>
                  client.println(WiFi.SSID());<br>
                  client.println("</h3>");<br>
                  client.println("<h3> Channel: ");<br>
                  client.println(WiFi.channel());<br>
                  client.println("</h3>");                       
      <br>
                  client.println("<h3> Signal-Strength: ");<br>
                  client.println(WiFi.RSSI());<br>
                  client.println("dbm </h3>");<br>
                  client.println("<h3> Uptime: ");<br>
                  client.println(millis() / 1000);<br>
                  client.println(" seconds</h3>");<br>
                  client.println("</body></html>");<br>
                  break;<br>
              }<br>
              if (c == '\n') {<br>
                // when starts reading a new line<br>
                blank_line = true;<br>
              }<br>
              else if (c != '\r') {<br>
                // when finds a character on the current line<br>
                blank_line = false;<br>
              }<br>
            }<br>
          }  <br>
          // closing the client connection<br>
          delay(1);<br>
          client.stop();<br>
      <br>
        }<br>
        if (millis() >= interval1 + timer1) {<br>
          // save the last time <br>
          timer1 = millis();<br>
          //do something<br>
              int i=0;<br>
              do { <br>
              sensors.requestTemperatures();<br>
              delay(50);<br>
              i++;<br>
                  }<br>
              while ((sensors.getTempC(Probe05) < 0) &&
      (i<100));<br>
              temp1 = sensors.getTempC(Probe01);<br>
              temp2 = sensors.getTempC(Probe02);<br>
              temp3 = sensors.getTempC(Probe03);<br>
              temp4 = sensors.getTempC(Probe04);<br>
              temp5 = sensors.getTempC(Probe05);<br>
              String url;<br>
              // Daten  melden<br>
              // mit dem Port 80 verbinden<br>
              if (temp1 > 0) {<br>
              client.connect(vzhost1, 80);<br>
              url = url1;<br>
              url += uuid_t1;<br>
              url += ".json?&value=";<br>
              url += temp1;<br>
              url += "&operation=add";<br>
              url += " HTTP/1.1";<br>
              client.print(url + "\r\n" + "Host: " + WiFi.localIP() +
      "\r\n" + "Connection: close\r\n\r\n");<br>
              int i1=0;<br>
              while((!client.available()) && (i1<1000)){<br>
                delay(10);<br>
                i1++;<br>
                }<br>
              client.stop();<br>
              }<br>
              if (temp2 > 0) {<br>
              client.connect(vzhost1, 80);<br>
              url = url1;<br>
              url += uuid_t2;<br>
              url += ".json?&value=";<br>
              url += temp2;<br>
              url += "&operation=add";<br>
              url += " HTTP/1.1";<br>
              client.print(url + "\r\n" + "Host: " + WiFi.localIP() +
      "\r\n" + "Connection: close\r\n\r\n");<br>
              int i2=0;<br>
              while((!client.available()) && (i2<1000)){<br>
                delay(10);<br>
                i2++;<br>
                }<br>
              client.stop();<br>
              }<br>
              <br>
              if (temp3 > 0) {<br>
              client.connect(vzhost1, 80);<br>
              url = url1;<br>
              url += uuid_t3;<br>
              url += ".json?&value=";<br>
              url += temp3;<br>
              url += "&operation=add";<br>
              url += " HTTP/1.1";<br>
              client.print(url + "\r\n" + "Host: " + WiFi.localIP() +
      "\r\n" + "Connection: close\r\n\r\n");<br>
              int i3=0;<br>
              while((!client.available()) && (i3<1000)){<br>
                delay(10);<br>
                i3++;<br>
                }<br>
              client.stop();<br>
              }<br>
              <br>
              if (temp4 > 0) {<br>
              client.connect(vzhost1, 80);<br>
              url = url1;<br>
              url += uuid_t4;<br>
              url += ".json?&value=";<br>
              url += temp4;<br>
              url += "&operation=add";<br>
              url += " HTTP/1.1";<br>
              client.print(url + "\r\n" + "Host: " + WiFi.localIP() +
      "\r\n" + "Connection: close\r\n\r\n");<br>
              int i4=0;<br>
              while((!client.available()) && (i4<1000)){<br>
                delay(10);<br>
                i4++;<br>
                }<br>
              client.stop();<br>
              }<br>
              <br>
              if (temp5 > 0) {<br>
              client.connect(vzhost1, 80);<br>
              url = url1;<br>
              url += uuid_t5;<br>
              url += ".json?&value=";<br>
              url += temp5;<br>
              url += "&operation=add";<br>
              url += " HTTP/1.1";<br>
              client.print(url + "\r\n" + "Host: " + WiFi.localIP() +
      "\r\n" + "Connection: close\r\n\r\n");<br>
              int i5=0;<br>
              while((!client.available()) && (i5<1000)){<br>
                delay(10);<br>
                i5++;<br>
                }<br>
              client.stop();<br>
              }<br>
              <br>
            }<br>
      <br>
      }<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Am 22.05.2017 um 07:55 schrieb Andreas
      Götz:<br>
    </div>
    <blockquote
      cite="mid:C0995080-0890-4616-B826-718D400A6D3F@gmail.com"
      type="cite">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div>Dann fang doch mal mit den Beispielen aus github/esp8266 an-
        da siehst Du schonmal wie Du http Requests machen kannst. Wenn
        das läuft gehts mit json parser weiter.</div>
      <div><br>
      </div>
      <div>Viele Grüße, Andreas </div>
      <div><br>
        Am 21.05.2017 um 22:23 schrieb Christian Wulff <<a
          moz-do-not-send="true" href="mailto:christianwulff@gmx.de">christianwulff@gmx.de</a>>:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div>
          <meta http-equiv="Content-Type" content="text/html;
            charset=utf-8">
          <meta name="Generator" content="Microsoft Word 14 (filtered
            medium)">
          <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
          <div class="WordSection1">
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Moin
                Andreas,<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hmm,
                verstehe momentan nur Bahnhof.<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hat
                das vielleicht schon jemand gemacht?<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Wenn
                ich ein paar Codeschnipsel hätte, dann könnte ich mich
                da gut einfuchsen.<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Lieben
                Gruß,<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Christian<o:p></o:p></span></p>
            <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <div>
              <div style="border:none;border-top:solid #B5C4DF
                1.0pt;padding:3.0pt 0cm 0cm 0cm">
                <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Von:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
                    Andreas Götz [<a moz-do-not-send="true"
                      href="mailto:cpuidle@gmail.com">mailto:cpuidle@gmail.com</a>]
                    <br>
                    <b>Gesendet:</b> Samstag, 20. Mai 2017 14:40<br>
                    <b>An:</b> <a moz-do-not-send="true"
                      href="http://volkszaehler.org">volkszaehler.org</a><br>
                    <b>Betreff:</b> Re: [vz-dev] ESP8266 mit Display
                    soll Daten aus dem Volkszähler auslesen und anzeigen<o:p></o:p></span></p>
              </div>
            </div>
            <p class="MsoNormal"><o:p> </o:p></p>
            <div>
              <p class="MsoNormal">Du brauchst den Esp8266HttpClient um
                da VZ Api abzufragen und eine passende Json Bibliothek.
                Wenn Du Platformio nutzt wird das mit den Bibliothen
                einfacher als mit der rudimentären Arduino Ide. <br>
                <br>
                Viele Grüße,<o:p></o:p></p>
              <div>
                <p class="MsoNormal">Andreas<o:p></o:p></p>
              </div>
            </div>
            <div>
              <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
                Am 19.05.2017 um 23:33 schrieb Frank Richter <<a
                  moz-do-not-send="true"
                  href="mailto:frank.richter83@gmail.com">frank.richter83@gmail.com</a>>:<o:p></o:p></p>
            </div>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <div>
                <div>
                  <p class="MsoNormal">Hallo Christian,<o:p></o:p></p>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">sollte kein Problem sein die
                      Daten als JSON von der Middleware zu bekommen.
                      Min/Max mit zugehörigen Timestamps ist automatisch
                      mit dabei. Kannst ja erst mal im Browser mit dem
                      API spielen.<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><a moz-do-not-send="true"
                        href="https://wiki.volkszaehler.org/development/api/reference">https://wiki.volkszaehler.org/development/api/reference</a><o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">Grüße<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">Frank<o:p></o:p></p>
                  </div>
                </div>
                <div>
                  <p class="MsoNormal"><o:p> </o:p></p>
                  <div>
                    <p class="MsoNormal">Am 19.05.2017 23:20 schrieb
                      "Christian Wulff" <<a moz-do-not-send="true"
                        href="mailto:christianwulff@gmx.de">christianwulff@gmx.de</a>>:<o:p></o:p></p>
                    <div>
                      <div>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Moin,<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">ich
                          möchte einen ESP8266 mit einem Display nutzen,
                          um ein paar Werte anzeigen zu lassen.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Aktuelle
                          Zeit<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Aktuelles
                          Datum<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Aktuelle
                          Außentemperatur<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Mindesttemperatur
                          in den letzten 24h<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Uhrzeit
                          wann die Mindesttemperatur geloggt wurde<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Maximaltemperatur
                          in den letzten 24h<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Uhrzeit
                          wann die Maximaltemperatur geloggt wurde<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Ich
                          möchte kein Android Tablet benutzen und ein
                          Frontend darstellen (hab ich schon, ich will
                          aber ein kleines separates Display nutzen),
                          sondern genau oben genannte Hardware benutzen.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Die
                          Hardware ist vorhanden.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Grafik
                          und Text kann ich schon darstellen.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Programmiert
                          werden soll mit der Arduino IDE.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Nun
                          ist nur die Frage wie kann ich auf die Daten
                          vom Volkszähler zugreifen?<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hat
                          sowas schon mal jemand gemacht?<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Lieben
                          Gruß,<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Christian<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
        </div>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>