Ankündigung

Einklappen
Keine Ankündigung bisher.

Wetterdaten aus dem Internet

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    #31
    Zitat von MarkusL Beitrag anzeigen
    Genau, oder einfach das Wetter eines vergangenen oder zukünftigen Urlaubs darzustellen ist ganz nett
    Stimmt Auf meinem Handy hab ich im Wetter auch FdF oder Soufriere als Heimatort, was interssiert mich wie mehr oder minder besch**** das Wetter heute oder morgen hier ist, schlecht ist es eh
    Um zu verstehen warum man (ausserhalb der Hurrikan-Zeit) dort lieber wäre reicht die Grosswetterlage mal dicke

    Makki
    EIB/KNX & WireGate & HS3, Russound,mpd,vdr,DM8000, DALI, DMX
    -> Bitte KEINE PNs!

    Kommentar


      #32
      Would be nice to have some additional weather-related icons (clouds, rain, frost, ...) complementing this new macro.

      Kommentar


        #33
        Zitat von martenss Beitrag anzeigen
        Would be nice to have some additional weather-related icons (clouds, rain, frost, ...) complementing this new macro.
        Look at the WEATHER Icons in the manual. There are such icons.
        offizielles Supportforum für den Enertex® EibPC: https://knx-user-forum.de/eibpc/
        Enertex Produkte kaufen

        Kommentar


          #34
          Indeed, didn't notice the clouds before. Thanks ;-).

          Kommentar


            #35
            Ich hab jetzt auch ein wenig mit der Wetterabfrage gespielt, nur komme ich gleich an einige Grenzen. Habe Sie folgendermaßen umgestellt

            Code:
            // Und nun parsen
            if xmlCount==2 then {
                /* Die eigentlichen Daten passen in einen einizigen String, daher Ausschneiden des Headers */;
                PosStart=find(xmlText_Data1,$<forecast_information>$,0u16)+size($<forecast_information>$);
                xmlText=split(xmlText_Data1,PosStart,END)+xmlText_Data2;
                /* Parsen nach Stadt*/;
                PosStart=find(xmlText,$<city data="$,0u16)+size($<city data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_Stadt=split(xmlText,PosStart,PosEnd);
                /* Parsen nach Datum*/;
                PosStart=find(xmlText,$<forecast_date data="$,0u16)+size($<forecast_date data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_Datum=split(xmlText,PosStart,PosEnd);
                /* Parsen nach aktuell Wetterart*/;
                PosStart=find(xmlText,$<condition data="$,0u16)+size($<condition data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_Akt_Wetterart=split(xmlText,PosStart,PosEnd);
                /* Parsen nach aktuell Temperatur */;
                PosStart=find(xmlText,$<temp_c data="$,0u16)+size($<temp_c data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+PosStart;
                Weather_Akt_Temp=convert(split(xmlText,PosStart,PosEnd),0.0);
                /* Parsen nach aktuell Luftfeuchte*/;
                PosStart=find(xmlText,$<humidity data="Feuchtigkeit:$,0u16)+size($<humidity data="Feuchtigkeit:$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_Akt_RegX=split(xmlText,PosStart,PosEnd);
                /* Parsen nach aktuell Wind*/;
                PosStart=find(xmlText,$<wind_condition data="Wind: $,0u16)+size($<wind_condition data="Wind: $);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_Akt_Wind=split(xmlText,PosStart,PosEnd);
                /* Parsen nach 1.Tag Name*/;
                PosStart=find(xmlText,$<day_of_week data="$,0u16)+size($<day_of_week data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_1Tag_Name=split(xmlText,PosStart,PosEnd);
                /* Parsen nach 1.Tag minTemp*/;
                PosStart=find(xmlText,$<low data="$,0u16)+size($<low data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+PosStart;
                Weather_1Tag_minTemp=convert(split(xmlText,PosStart,PosEnd),0.0);
                /* Parsen nach 1.Tag maxTemp*/;
                PosStart=find(xmlText,$<high data="$,0u16)+size($<high data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+PosStart;
                Weather_1Tag_maxTemp=convert(split(xmlText,PosStart,PosEnd),0.0);
                /* Parsen nach 1.Tag Wetterart*/;
                PosStart=find(xmlText,$<condition data="$,0u16)+size($<condition data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_1Tag_Wetterart=split(xmlText,PosStart,PosEnd);
                /* Parsen nach 2.Tag Name*/;
                PosStart=find(xmlText,$<day_of_week data="$,0u16)+size($<day_of_week data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_2Tag_Name=split(xmlText,PosStart,PosEnd);
                /* Parsen nach 2.Tag minTemp*/;
                PosStart=find(xmlText,$<low data="$,0u16)+size($<low data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+PosStart;
                Weather_2Tag_minTemp=convert(split(xmlText,PosStart,PosEnd),0.0);
                /* Parsen nach 2.Tag maxTemp*/;
                PosStart=find(xmlText,$<high data="$,0u16)+size($<high data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+PosStart;
                Weather_2Tag_maxTemp=convert(split(xmlText,PosStart,PosEnd),0.0);
                /* Parsen nach 2.Tag Wetterart*/;
                PosStart=find(xmlText,$<condition data="$,0u16)+size($<condition data="$);
                PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                Weather_2Tag_Wetterart=split(xmlText,PosStart,PosEnd);
                xmlCount=0
            } endif
            Als Antwort bekomme ich für den zweiten Tag die gleichen Werte wie vom ersten Tag Wo ist mein Fehler, oder anders gefragt, wie kann man die Abfrage so umbauen, das er die Informationsblöcke trennt?

            Kommentar


              #36
              I've done exactly the same and got the same results.

              In the mean time I found the problem: start-position of the find() command is at the start of the string (pos1 = 0) -> as such always first occurrence of eg. low data is returned.

              I am currently changing my implementation such that pos1 is equal to last end-pos, but have still to validate it.

              Sammy

              Kommentar


                #37
                Zitat von martenss Beitrag anzeigen
                I am currently changing my implementation such that pos1 is equal to last end-pos, but have still to validate it.
                Can you put your Ergebniss on-line?

                Kommentar


                  #38
                  Zitat von michel38 Beitrag anzeigen
                  Can you put your Ergebniss on-line?
                  Ich dachte das wird damit klar, weil man ja auch den String zum ersten und dann zum zweiten Male sucht:
                  [highlight=epc]
                  /* Parsen nach Wolken*/;
                  PosStart=find(xmlText,$<condition data="$,0u16)+size($<condition data="$);
                  PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                  Wolken=split(xmlText,PosStart,PosEnd);

                  /* Parsen nach Wolkenvorhersage für 1. Tag*/;
                  PosStart=find(xmlText,$<condition data="$,1u16)+size($<condition data="$);
                  PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                  VorhersageWolken=split(xmlText,PosStart,PosEnd);[/highlight]

                  find() sucht nach einem Teilstring in einem String, über das 3.Argument kann man nun (x+1)-te Auftauchen des gleichen Teilstrings suchen lassen:
                  Man vergleiche das HTML file (http://www.google.com/ig/api?weather...+Germany&hl=de)
                  Dort tauchen immer wieder die gleichen Strings im File (=String in dem wir suchen) auf, jediglich für den 1.Tag an erster Stelle, für den 2. an zweiter Stelle etc.

                  find(xmlText,$<condition data="$,0u16)
                  sucht also in String xmlText das erste Auftauchen (von Anfang an gerechnet) des Strings <condition data="

                  find(xmlText,$<condition data="$,1u16)
                  Sucht das 2.-te Auftauchen usw. Gleiches gilt dann für die Temperaturen etc.
                  offizielles Supportforum für den Enertex® EibPC: https://knx-user-forum.de/eibpc/
                  Enertex Produkte kaufen

                  Kommentar


                    #39
                    Danke.

                    Jetzt hab auch ich es verstanden. Wenn ich mir das Beispiel etwas genauer angesehen hätte auch früher.

                    Kommentar


                      #40
                      Zitat von michel38 Beitrag anzeigen
                      Als Antwort bekomme ich für den zweiten Tag die gleichen Werte wie vom ersten Tag Wo ist mein Fehler,
                      Hoi

                      Ich hab' zwar das mit dem Zähler selbst herausgefunden, aber wie man den Debugger startet, das entzieht sich bis jetzt hartnäckig meiner Kenntniss.

                      Edit: Ahhhh, jetzt, soooo einfach .... F5 bzw. EibPC -> Variablen vorgeben und abfragen
                      Grüsse Bodo
                      Fragen gehören ins Forum, und nicht in mein Postfach;
                      EibPC-Fan; Wiregate-Fan; Timberwolf-Fan mit 30x 1-Wire Sensoren;

                      Kommentar


                        #41
                        My implementation is attached here.

                        Changes compared to the German version from pio:
                        - hourly iso daily update
                        - addition of tomorrow's forecast
                        - recover after single xml message arrival (during busy hours Google seems to respond the second message with another IP@)
                        - multi-language support (in Google itf)
                        - updateCounter to keep track of last successful update

                        Could probably be added to the English library, after being "polished" by Enertex.
                        Angehängte Dateien

                        Kommentar


                          #42
                          Hoi

                          Ich hab's nicht als Macro verpackt, aber festgestelt, dass der Aufruf von
                          [highlight=epc]GoogleIP = resolve($www.google.com$);[/highlight]
                          zeitnah zur eigentlichen Webabfrage passieren muss.
                          Ich hab's dank der vielen Hinweise so gelöst:
                          [highlight=epc]
                          [EibPC]
                          BT7=6
                          BT8=7
                          BT9=8
                          BT10=9
                          BT11=10
                          BT12=11
                          BT13=12
                          BT14=13

                          [WebServer]
                          button(BT7)[TEMPERATURE]$Temperatur$ button(BT8)[WEATHER]$Feuchte$ button(BT9)[TEMPERATURE]$Temp. Max$
                          button(BT10)[TEMPERATURE]$Temp. Min$ button(BT11)[WEATHER]$Aktuell$ button(BT12)[WEATHER]$Heute$ button(BT13)[WEATHER]$Wind$
                          button(BT14)[INFO]$Stadt$

                          // Google Weather: Es kommen 2 TCP Pakete an.
                          Port=0u16
                          IP=0u32
                          GooglePort=80u16
                          GoogleIP=0u32
                          xmlText=$$
                          xmlText_Data1=$$
                          xmlText_Data2=$$
                          xmlCount=0
                          PosStart=0u16
                          PosEnd=0u16
                          Google_Stadt=$$
                          Google_Temperatur=0.0
                          Google_Luftfeuchte=0.0
                          Google_VorhersageMax=0.0
                          Google_VorhersageMin=0.0
                          Google_Wolken=$$
                          Google_VorhersageWolken=$$
                          Google_Wind=$$

                          // TCP Verbindung aufmachen
                          if mtime(02,00) or mtime(17,00) or mtime(32,00) or mtime(47,00) then {
                          GoogleIP = resolve($www.google.com$);
                          connecttcp(GooglePort,GoogleIP)
                          }endif

                          // TCP Anfrage schicken
                          if mtime(02,03) or mtime(17,03) or mtime(32,03) or mtime(47,03) then {
                          sendtcp(GooglePort,GoogleIP,$GET /ig/api?weather=Zurich+Switzerland&hl=de HTTP/1.1$,0x0D,0x0A,0x0D,0x0A)
                          }endif

                          // Es kommen 2 Pakete an
                          if event(readtcp(Port,IP,xmlText)) and IP == GoogleIP then {
                          if (xmlCount==0) then xmlText_Data1=xmlText endif;
                          if (xmlCount==1) then xmlText_Data2=xmlText endif;
                          xmlCount=xmlCount+1
                          }endif

                          // TCP Verbindung wieder ordentlich schließen
                          if mtime(02,08) or mtime(17,08) or mtime(32,08) or mtime(47,08) then {
                          closetcp(Port,IP)
                          } endif

                          // Und nun parsen der XML Daten
                          if xmlCount==2 then {
                          /* Die eigentlichen Daten passen in einen einizigen String, daher Ausschneiden des Headers */;
                          PosStart=find(xmlText_Data1,$<forecast_information >$,0u16)+size($<forecast_information>$);
                          xmlText=split(xmlText_Data1,PosStart,END)+xmlText_ Data2;

                          /* Parsen nach Stadt*/;
                          PosStart=find(xmlText,$<city data="$,0u16)+size($<city data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                          Google_Stadt=split(xmlText,PosStart,PosEnd);

                          /* Parsen nach Temperatur */;
                          PosStart=find(xmlText,$<temp_c data="$,0u16)+size($<temp_c data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+ PosStart;
                          Google_Temperatur=convert(split(xmlText,PosStart,P osEnd),0.0);

                          /* Parsen nach Luftfeuchte */;
                          PosStart=find(xmlText,$<humidity data="Feuchtigkeit:$,0u16)+size($<humidity data="Feuchtigkeit:$);
                          PosEnd=find(split(xmlText,PosStart,END),$%$,0u16)+ PosStart;
                          Google_Luftfeuchte=convert(split(xmlText,PosStart, PosEnd),0.0);

                          /* Parsen nach Vorhersage Min*/;
                          PosStart=find(xmlText,$<low data="$,0u16)+size($<low data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+ PosStart;
                          Google_VorhersageMin=convert(split(xmlText,PosStar t,PosEnd),0.0);

                          /* Parsen nach Vorhersage Max*/;
                          PosStart=find(xmlText,$<high data="$,0u16)+size($<high data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"$,0u16)+ PosStart;
                          Google_VorhersageMax=convert(split(xmlText,PosStar t,PosEnd),0.0);

                          /* Parsen nach Wolken*/;
                          PosStart=find(xmlText,$<condition data="$,0u16)+size($<condition data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                          Google_Wolken=split(xmlText,PosStart,PosEnd);

                          /* Parsen nach Wolkenvorhersage für 1. Tag*/;
                          PosStart=find(xmlText,$<condition data="$,1u16)+size($<condition data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                          Google_VorhersageWolken=split(xmlText,PosStart,Pos End);

                          /* Parsen nach Wind*/;
                          PosStart=find(xmlText,$<wind_condition data="$,0u16)+size($<wind_condition data="$);
                          PosEnd=find(split(xmlText,PosStart,END),$"/>$,0u16)+PosStart-1u16;
                          Google_Wind=split(xmlText,PosStart,PosEnd);

                          xmlCount=0;
                          webdisplay(BT7,Google_Temperatur,TEMPERATURE,DISPL AY,GREEN);
                          webdisplay(BT8,Google_Luftfeuchte,WEATHER,DISPLAY, GREEN);
                          webdisplay(BT9,Google_VorhersageMax,TEMPERATURE,DI SPLAY,GREEN);
                          webdisplay(BT10,Google_VorhersageMin,TEMPERATURE,D ISPLAY,GREEN);
                          webdisplay(BT11,Google_Wolken,WEATHER,DISPLAY,GREE N);
                          webdisplay(BT12,Google_VorhersageWolken,WEATHER,DI SPLAY,GREEN);
                          webdisplay(BT13,Google_Wind,WEATHER,DISPLAY,GREEN) ;
                          webdisplay(BT14,Google_Stadt,WEATHER,DISPLAY,GREEN )
                          } endif


                          [/highlight]
                          Grüsse Bodo
                          Fragen gehören ins Forum, und nicht in mein Postfach;
                          EibPC-Fan; Wiregate-Fan; Timberwolf-Fan mit 30x 1-Wire Sensoren;

                          Kommentar


                            #43
                            Hallo,

                            Nach ein paar Startschwierigkeiten , hier mal mein Ergebnis:

                            Kommentar


                              #44
                              Hi Uwe,
                              wie immer. Einfach nur der Hammer!
                              Gruß
                              Volker

                              Wer will schon Homematic?

                              Kommentar


                                #45
                                Danke Volker

                                Aber mal eine andere Frage. Funktioniert es nur mit xml oder geht auch eine html-Seite? Mein Favorit ist immer noch yahoo.

                                Kommentar

                                Lädt...
                                X