Ankündigung

Einklappen
Keine Ankündigung bisher.

sending HTTP PUT commands using virtual output

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

  • sending HTTP PUT commands using virtual output

    hi,

    I have a problem with the virtual output command. Everything works fine when I use fiddler and assembly my command. But when I want to use Loxone to do this, it's not working. I grabbed what loxone is sending and there seems to be some syntax error in what I put there.
    command I am sending:
    PUT
    http://192.168.0.226/api/xxxxx/lights/1/state
    host: 192.168.0.226
    content-length: 13

    body: {"on":true}

    I want to learn how to do this, since these lights are not the only thing I want to create in this way. I also want to link with my raspberry in this manner.

    what I did in loxone:
    1) I set the address accordingly in the virtual Output
    2) I create a command for this virtual output with the settings:
    Command for ON -> {"on":true}
    HTTP method for ON -> PUT
    Command for OFF -> {"on":false}
    HTTP method for OFF -> PUT

    where do I set the headers? if I sniff with Loxone logger I see the attached image. content-type: text/plain charset=utf-8 I think this is the mistake

    I appreciate your feedback.

    Kind regards,
    Toon
    Angehängte Dateien

  • #2
    Try it with the POST syntax, maybe it works:
    http://www.loxwiki.eu/display/LOX/HT...+Loxone+senden

    PS: Are you sure you really need a PUT not a POST? PUT is uncommon for simple APIs.
    Zuletzt geändert von Christian Fenzl; 09.Mr.2018, 08:28.
    PN/PM: Ich bevorzuge die Beantwortung von Fragen in öffentlichen Threads, wo andere mithelfen und mitprofitieren können. Herzlichen Dank!

    Kommentar


    • #3
      For this project I had to use PUT.
      After another trial and error session today, I found out how I have to configure my loxone:
      in the virtual output:
      in the output command:
      HTTP extensions for ON : host: 192.168.0.226\r\nContent-Type: application/json
      HTTP POST command for ON : {"on": true}
      HTTP method for ON : PUT
      same for OFF...

      This makes my light turn on and off. I still have 1 problem where it sends the ON when I turn it off but I will look into that some other day.

      Kommentar


      • #4
        I also did some experimenting with this, zorianders settings work but can be simplified, the 'HTTP extensions' (which are HTTP headers) are not needed, you also don't need to repeat the address. It's also very important to NOT have a trailing slash after the address. That makes:

        Address: http://192.168.0.226
        Command for ON : /api/xxxxx/lights/1/state
        HTTP extensions for ON :
        HTTP POST command for ON : {"on": true}
        HTTP method for ON : PUT

        Or what I'm using for our doorbell:

        Address: http://192.168.0.226
        Command for ON : /api/xxxxx/groups/0/action
        HTTP extensions for ON :
        HTTP POST command for ON : {"alert": select}
        HTTP method for ON : PUT

        Kommentar

        Lädt...
        X