Ankündigung

Einklappen
Keine Ankündigung bisher.

Reading a GA and displaying the value in decimal via PHP

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

    Reading a GA and displaying the value in decimal via PHP

    Hi,

    I'm trying to read and display a GA (temperature) with PHP.
    I've read the procedure on the KNX site, but I wonder if someone has already done it with PHP or similar ? (from ETS -> décimal)

    Thank you.

    #2
    Maybe this, testing ...

    Kommentar


      #3
      Hoi
      Have a look at PDF:
      http://www.knx.org/fileadmin/downloa....5.00%20AS.zip
      Page 31 I think
      Code:
      3.10 Datapoint Types “2-Octet Float Value”
      Format: 2 octets: F16
      octet nr: 2 MSB 1 LSB
      field names: FloatValue
      encoding: MEEEEMMM MMMMMMMMM
      Encoding:
      FloatValue = (0,01*M)*2(E)
      E = [0 … 15]
      M = [-2 048 … 2 047], two’s complement notation
      For all Datapoint Types 9.xxx, the encoded value 7FFFh shall always be used to denote invalid
      data.
      Range: [-671 088,64 … 670 760,96]
      PDT: PDT_KNX_FLOAT
      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


        #4
        Hi,

        see the eibd examples threre is a simple php client.

        hth

        Marcus

        Kommentar


          #5
          Hi,

          Zitat von mknx Beitrag anzeigen
          see the eibd examples threre is a simple php client.
          I don't feel at home within eibd, I would appreciate a pointer to the file

          Thank you

          Kommentar


            #6
            Hi,

            I dont know the path. Download the source code and look for a php file. On Linux you could use: find . | grep php

            So Long

            Marcus

            Kommentar


              #7
              Zitat von mknx Beitrag anzeigen
              Download the source code and look for a php file.
              That's what I did before posting.
              No luck

              Thanks anyway

              Kommentar


                #8
                Hi,

                I'm unable to make anything consistent with the conversion.
                Here is an extract of the code
                PHP-Code:
                $value GroupRead("127.0.0.1","0/6/38");
                ....
                $eis5 hexdec($value);
                $wert = ($eis5 0x07ff);
                if ((
                $eis5 0x08000) != 0)
                 {
                 
                $wert $wert 0xfffff800;
                 
                $wert $wert *-1;
                 }
                $wert $wert << (($eis5 0x07800) >> 11);
                if ((
                $eis5 0x08000) != 0)
                 {
                 
                $wert $wert * -1;
                 }
                $val $wert/100;
                ......
                $string "Temp: " $val "°C"
                Maybe a sharp eye will see the problem ?

                Kommentar


                  #9
                  There is something wrong with the GroupRead
                  When I force the input to a known value, the conversion works fine, i.e: 1902 = 20,64°
                  PHP-Code:
                  $value GroupRead("127.0.0.1","0/6/38");
                  $value 1902;
                  $eis5 hexdec($value);
                  $wert = ($eis5 0x07ff);
                  if ((
                  $eis5 0x08000) != 0)
                   {
                   
                  $wert $wert 0xfffff800;
                   
                  $wert $wert *-1;
                   }
                  $wert $wert << (($eis5 0x07800) >> 11);
                  if ((
                  $eis5 0x08000) != 0)
                   {
                   
                  $wert $wert * -1;
                   }
                  $val $wert/100;
                  ......
                  $string "Temp: " $val "°C"

                  Kommentar


                    #10
                    This is beyhond my understanding.
                    The command GroupRead is not to be suspected as it works in other applications in the same environment.

                    The conversion is not to be suspected as it works with a fixed value.

                    But the 2 together, no go.

                    Anyone has an idea, please ?

                    Kommentar


                      #11
                      I'm not sure that I could help you, but I give it a try. What is the return value of the Groupwrite command?
                      And you do have an running eibd, which listens on 127.0.0.1.

                      Marcus

                      Kommentar


                        #12
                        Zitat von mknx Beitrag anzeigen
                        I give it a try.
                        Much appreciated, thank you aforehand

                        Zitat von mknx Beitrag anzeigen
                        What is the return value of the Groupwrite command?
                        0.23 which is totally inconsistent
                        The actual temp as shown in the Visu is 21.8

                        Zitat von mknx Beitrag anzeigen
                        And you do have an running eibd, which listens on 127.0.0.1.
                        Yes, I understand that's the standard way of doing.
                        eibd is running on a NAS QNAP with PHP5.
                        I've another application to display KNX data on a Cisco phone, also using PHP, and it is working fine, using the same GroupRead.

                        Thanks

                        Kommentar


                          #13
                          I think I see your Problem. You are using the wrong decoding function. Floating Point values are a little ugly to decode, but there should be a function in the client.

                          I'm on a Road Trip and have no access to my dev computer. => you have to Look for the right function by yourself.

                          So long

                          Marcus

                          Kommentar


                            #14
                            Zitat von mknx Beitrag anzeigen
                            You are using the wrong decoding function.
                            Ah ?!? some light in my tunnel

                            Zitat von mknx Beitrag anzeigen
                            there should be a function in the client
                            I've seen the function f2_decode($val), it doesn't work either, maybe it was the wrong one.

                            Zitat von mknx Beitrag anzeigen
                            you have to Look for the right function by yourself.
                            OK, I'll have a closer look.

                            Thank you for the hint.

                            PS: I was convinced it was the right function, because when I type a value, as seen in ETS, I get the right output.

                            Kommentar


                              #15
                              Hi Ray,

                              maybe this can help you get eis5 (DPT9) decoding done.
                              SourceForge.net Repository - [openautomation] Contents of /PyWireGate/trunk/knx_connector/DPT_Types.py

                              Its in python but that shouldn't be to hard to port to php.

                              There is also a DPT Type guessing function.
                              Nils

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

                              Kommentar

                              Lädt...
                              X