Keine Ankündigung bisher.

sending HTTP PUT commands using virtual output

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

  • sending HTTP PUT commands using virtual output


    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:
    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,
    Angehängte Dateien

  • #2
    Try it with the POST syntax, maybe it works:

    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.Mär.2018, 07:28.
    LoxBerry/Plugin Support: Wenn du einen Begriff in meiner Antwort nicht auf Anhieb verstehst, bitte nicht gleich rückfragen, sondern erst die Suche im LoxWiki und bei Google bemühen.
    PN/PM: Ich bevorzuge die Beantwortung von Fragen in öffentlichen Threads, wo andere mithelfen und mitprofitieren können. Herzlichen Dank!


    • #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:\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.


      • #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:

        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:

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