Ankündigung

Einklappen
Keine Ankündigung bisher.

EibPC HTTP request

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

    EibPC HTTP request

    Hi

    I'm running a mpd deamon on my server. To control this music player I use a web client.

    So far I can control this music player with CommandFusion. To do this I use the HTML link to start, stop, etc the music.

    example
    Code:
    http://x.x.x.x/phpmpreloaded/web_clients/phpmp/index.php?command=play
    When i send this link with JavaScript the music starts.(so far so good)

    Now I have a switch that sends a command trough my KNX bus.

    example
    Code:
    "Music_NextPlaylist-3/2/1"
    When this address is send on the bus I want to trigger a HTML GET request from EibPC. This request has to do the same as above.

    So far I have this configured
    Code:
    mpdPort = 80u16
    mpdIP = 192.168.1.41
    mpdDelay = 200u64
    mpdNextTrack = 0b01
    
    if event("Music_NextPlaylist-3/2/1") then mpdNextTrack = 0b01 endif
    if mpdNextTrack then connecttcp(mpdPort, mpdIP) endif
    if after(mpdNextTrack, mpdDelay) then sendtcp(mpdPort, mpdIP, $/phpmpreloaded/web_clients/phpmp/index.php?command=play$) endif
    closetcp(mpdPort, mpdIP)
    This doesn't work. Does somebody know what the problem might be ?

    #2
    Ivan,
    first, will mpdNextTrack ever get another value? Remind the validation scheme! (Even if the tcp would work it might only work once)

    Then: You have a kind of SPS inside the EibPC with a very smal time slot.

    You won't be able to open the tcp connection, send a couple of bytes and close the connection within one cyclus.

    You need to open the connection and wait for establishment. If the connections stands then you can send your data and close afterwards.
    There are issues in the manual so consult the version later than manual version 19. (Or Michael can help here)

    Have a look at the Homecontrol Macros, they use tcp connections.

    Regards,
    Bernd

    Kommentar


      #3
      Tx for the reply. I'll try to wait some more time before sending the http-request.

      The switch will always send value 1 to the address 3/2/1. Everytime I receive such a value (regardless the previous value), I would like to react by going to the next track in my track list.

      I thought the "event()" procedure was written for such cases. If this is not the case, how would you propose to solve this issue?

      Tx - Ivan

      Kommentar


        #4
        Zitat von eulaersivan Beitrag anzeigen
        I thought the "event()" procedure was written for such cases. If this is not the case, how would you propose to solve this issue?
        Correct. But Isn't there a bug in your code, you set mpdNextTrack to 0b01, but you need 1b01. Perhaps you need another delay after the sendtcp before closing the tcp socket, but you can try.
        Watch also the last if-statement. Your closetcp didnot do anything (no preceeding if).
        [highlight=epc]
        mpdPort = 80u16
        mpdIP = 192.168.1.41
        mpdDelay = 200u64
        mpdNextTrack = 0b01

        if event("Music_NextPlaylist-3/2/1") then mpdNextTrack = 1b01 endif
        if mpdNextTrack then connecttcp(mpdPort, mpdIP) endif
        if after(mpdNextTrack, mpdDelay) then {
        sendtcp(mpdPort, mpdIP, $/phpmpreloaded/web_clients/phpmp/index.php?command=play$);
        closetcp(mpdPort, mpdIP);
        mpdNextTrack = 0b01
        }endif

        [/highlight]
        offizielles Supportforum für den Enertex® EibPC: https://knx-user-forum.de/eibpc/
        Enertex Produkte kaufen

        Kommentar


          #5
          Zitat von eulaersivan Beitrag anzeigen
          Code:
          sendtcp(mpdPort, mpdIP, $/phpmpreloaded/web_clients/phpmp/index.php?command=play$)
          This isn't a HTTP GET. You are just sending a string, that your HTTP server cannot recognize. If I remember correctly a HTTP GET message should look like this:
          Code:
          sendtcp(mpdPort, mpdIP, $GET /phpmpreloaded/web_clients/phpmp/index.php?command=play HTTP/1.1$)
          But probably it would be much more straight forward to connect to mpd itself because mpd is controlled by TCP messages anyway. Information about the communication can be found here: The Music Player Daemon protocol
          Firma: Enertex Bayern GmbH, Ebermannstädter Straße 8, 91301 Forchheim
          Amazon: KNXnet/IP Router
          , KNXnet/IP Interface

          Kommentar


            #6
            Ist zwar so etwas wie Leichenschändung - aber hat Jemand das schon gelöst (ev. ja mit den neuen Http-Befehlen)?

            Also nicht über einen weiteren Client, sondern nativ vom eibPC an mpd...

            Ich steig' da irgendwie nicht durch
            Zuletzt geändert von EPIX; 10.04.2022, 18:24.
            EPIX
            ...und möge der Saft mit euch sein...
            Getippt von meinen Zeigefingern auf einer QWERTZ Tastatur

            Kommentar

            Lädt...
            X