Ankündigung

Einklappen
Keine Ankündigung bisher.

Webabfrage of variable length

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

    Webabfrage of variable length

    Hi,

    I've to rewrite my Webabfrage for the weather forecast, because the web site has changed (500 lines trashed )

    I'm willing to use a RSS feed, because it's much more stable, but ... the XML file is of variable length.
    That is, in the afternoon, they don't show the forecast for the morning anymore, and in the evening they don't show the forecast for the morning and mid-day anymore.
    So the Webabfrage will fail after noon.

    I thought writing 3 Webabfrage, each ending with a success/fail code, so if the first Webabfrage (morning) fails, trigger the second (noon), if it fails trigger the third (afternoon), but .. .. maybe there is a better way ?

    NB: I've done it for Cisco IP Phone via a PHP script without too much problems, but for the HS ???

    How can I solve this ? any suggestion ?

    Thank you

    #2
    Zitat von Warichet Beitrag anzeigen
    . maybe there is a better way ?
    No. That's the way to do it :-)

    Shorter "Webabfragen" are easier to maintain, too.
    Gruß Matthias
    EIB übersetzt meine Frau mit "Ehepaar Ist Beschäftigt"
    - PN nur für PERSÖNLICHES!

    Kommentar


      #3
      Hi,

      if you already done it with php for your phones, why don't you query that php with the HS?
      Use your results from the php and output it to a predefined xml, thats the easiest way to query
      just put in the results from morning so that it is allways complete.
      Nils

      aktuelle Bausteine:
      BusAufsicht - ServiceCheck - Pushover - HS-Insight

      Kommentar


        #4
        Hi, Raymond

        Kanst you look at the url of your weather page to post? I would like a look at this.

        Uwe

        Kommentar


          #5
          Zitat von NilsS Beitrag anzeigen
          if you already done it with php for your phones, why don't you query that php with the HS?
          ûûû ?!?
          Would love to ! but have no idea about how to do it
          Zitat von NilsS Beitrag anzeigen
          Use your results from the php and output it to a predefined xml, thats the easiest way to query
          just put in the results from morning so that it is allways complete.
          Mmm, I need a little help.
          Also, I thought for a while, re-writing the PHP script in Java, despites my limited programming skills , but even if it works, I've no idea how to call a Java function residing in Ajax.js and get the result to my Visu. Kind of missing link.
          I've read the "xxAPI v0.98 - erweiterte AJAX-Visu" several times, but you lost me and above all, I'm scared, scared to come up with a non-working system. But I'm still willing to do it.


          Zitat von michel38 Beitrag anzeigen
          Kanst you look at the url of your weather page to post? I would like a look at this.
          Maybe some comments .... to understand the context ?
          I first searched for a decent weather forecast, providing a reliable RSS feed, in french, with localization to my nearest city, Auch 32000, and FREE! (there are plenty of billable subscriptions, no thanks)
          I didn't find it, so I selected "La chaîne Météo"
          (what you see now is the NEW version, see the picture below for the old version)
          It had very nice icons and provided the forecast details I wanted, it provided general forecast for a 12 day periode (Webabfrage 159 lines) and detailed forecast for a 3 day periode (Webabfrage 341 lines).
          I suffered a bit writing the Webabfrage but finally got it right with the kind help of Blue04.
          Hereunder a sample of the 12 day (Lachainemeteo12.JPG) and 3 day (Lachainemeteo3.JPG) Visu. It's gone with the wind ...rhââ ...
          For the Cisco Phone, I could't re-use those Webabfrage, hence I choose another site: Météorologic
          It is localizable, provides a 3 day forecast and provides the wind force and direction (important for me). here
          The icons are ... boaf ... but it's just fine for Phone display
          (10x10cm). With some PHP programming, I managed to get it right on the phone display, one day per screen, see below CiscoMeteo2.JPG
          NB: The idea to use the Cisco Phone was mainly to display a KNX Visu, the same as the HS Visu, but only one device at a time, CiscoKNX-01.JPG.
          (Visu für zeeeeer kleine Manner ).

          As mentionned above, this RSS feed is of variable length, hence cannot be used "as is" in a standard Webabfrage.
          I'll try to re-use that PHP script within the HS ... with a little help from my friends ...

          Thank you for your interest in the topic.
          Angehängte Dateien

          Kommentar


            #6
            Hi Raymond,

            Zitat von Warichet Beitrag anzeigen
            I've read the "xxAPI v0.98 - erweiterte AJAX-Visu" several times, but you lost me and above all, I'm scared, scared to come up with a non-working system. But I'm still willing to do it.
            don't be scared
            You can do it without touching anything.
            To explain the required actions in short terms.

            1. put the ajax.js in a subfolder in hsupload, maybe hsupload/xxav/js
            2. put the start.htm and secure htm in the parent folder of that (hsupload/xxav)
            3. download the Webabfrage hslib from the xxAPI Thread
            3. create a user ajax pass ajax and use the imported Visupage xxAPI-INIT as the startpage for that user.
            4. goto the Visupage xxAPI-INIT and change in the TAB "VISUSEITE" the page to your usual Startpage.
            5. add somewhere in your Visu a link to the xxAPI-DEMO page you imported from the hslib
            6. upload complete (Bilder und Dateien)
            7. login to http://meinHS/opt/xxav/secure.htm
            8. browse to your xxAPI-DEMO Page and select an application. for Example 2 for an inline frame.
            Nils

            aktuelle Bausteine:
            BusAufsicht - ServiceCheck - Pushover - HS-Insight

            Kommentar


              #7
              Hi NilsS,

              Zitat von NilsS Beitrag anzeigen
              don't be scared
              You can do it without touching anything.
              Thank you for the refreshing news, I feel more comfortable.
              I've a strong tendency to be scared by things I don't understand

              What is your opinion about converting my PHP script to JS and putting it into AJAX.JS ?
              Is it a good idea ?
              If yes, can you tell me how I could call and use that js function from within the HS Visu, to display the weather forecast ?

              Thank you for your patience.

              Kommentar


                #8
                Zitat von Warichet Beitrag anzeigen
                What is your opinion about converting my PHP script to JS and putting it into AJAX.JS ?
                you missunderstood me. simple you can't use JS to query the data.
                You can:
                1. only display the weathernews on an embedded IFRAME with the xxAPI
                2. you can use php to fetch your needed results and represent it to your HS as an xml.

                If your preffered Weathersource is not in xml you have do use regex.
                google for preg_replace preg_match .. for example:
                PHP-Code:
                $dayonetemp_m=preg_replace("/.*Temperature.*[\/]td>([0-9]{1,2})<[\/]td>.*/g","\\1",$completewebsource);
                echo 
                "<data><dayonemorning_notavailable></dayonemorning_notavailable><dayonetemp>".$dayonetemp."</dayonetemp></data>"
                its not a real workin example, but only to show you how it work. (maybe use preg_match).
                and now make your Webabfrage to that php page.
                Code:
                 
                Beliebige Daten
                <dayonemorning_notavailable>
                Wert Klartext 
                </dayonemorning_notavailable>
                Beliebige Daten
                <dayonetemp>
                Wert Klartext
                </dayonetemp>
                ...
                I think you should use the php variant or redo your Webabfrage and use multiple smaller ones as Matthias allready said, because you can then use
                the value in your Logic for example if its warm tomorrow and you can delay heating in the morning....
                Nils

                aktuelle Bausteine:
                BusAufsicht - ServiceCheck - Pushover - HS-Insight

                Kommentar


                  #9
                  Zitat von NilsS Beitrag anzeigen
                  you missunderstood me.
                  Again ?
                  Zitat von NilsS Beitrag anzeigen
                  You can:
                  1. only display the weathernews on an embedded IFRAME with the xxAPI
                  2. you can use php to fetch your needed results and represent it to your HS as an xml.
                  OK

                  Zitat von NilsS Beitrag anzeigen
                  If your preffered Weathersource is not in xml
                  It is, I'm not really a fan of those preg_match crummy things

                  Zitat von NilsS Beitrag anzeigen
                  and now make your Webabfrage to that php page.
                  Pfiou, clever trick ! you have many of those in your pocket ?

                  Zitat von NilsS Beitrag anzeigen
                  I think you should use the php variant
                  OK, I'll try it that way.

                  Zitat von NilsS Beitrag anzeigen
                  or redo your Webabfrage and use multiple smaller ones
                  OK, I'm a bit reluctant, it's not very elegant, I'll use it if everthing else fails.
                  Maybe an idea (yes, this happens to mee ) if I knew at what time the RSS feed changes, I could trigger the right Webabfrage, i.e.
                  00H-12H Webabfrage1
                  12H-16H Webabfrage2
                  16H-18H Webabfrage3

                  Kommentar

                  Lädt...
                  X