sendig REST call to change a virtual input from within the UI

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • bboydens
    Azubi
    • 23.02.2016
    • 6

    #1

    sendig REST call to change a virtual input from within the UI

    How would one enter a REST call in a 'Virtual Output' and 'Virtual Output COmmand' to toggle a switch defined by a 'Virtual Inoput' ? I have a condition that requires changing some switches in the Web UI, defined as 'Virtual Inputs', but struggle defining that in the properties of 'Virtual Output' and 'Virtual Output Commands'.
    Anyone knows how to enter such command ?
  • Christian Fenzl
    Lebende Foren Legende
    • 31.08.2015
    • 11234

    #2
    Usually, things that need to be triggered or changed internally, would have for example a switch block, but not a VI, in the program and visu.

    But as a dirty workaround, have a look to the Loxone documentation about Webservices.
    Have I mentioned that for internal changes, this is really dirty?
    Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine

    Kommentar

    • bboydens
      Azubi
      • 23.02.2016
      • 6

      #3
      Tx Christian.

      I realize it sounds like implementing a "useless switch" type of solution (e.g. http://www.conrad.be/ce/nl/product/1...omSuggest=true)....
      May I explain my use case, maybe there's a neater way of doing things:

      In a guest room, guests have a small tablet Web UI as switch panel near the entrance.
      Guests can control 5 functions, with 5 simple on/off switches. (VI's, input type = "Switch", not "Push Button").
      They can easily see feedback if functions are still on or off, by looking at the switches on the tablet.

      As their host, I want to be able to switch everything back to normal when they leave the room, so a next guest gets "all off" when he enters the room.

      - Do you have a better simple way to display "sliding switches" to the guests ?
      - Thanks for the suggestion to look into web services, that's what I'm doing, but I cannot get the comma

      Kommentar

      • bboydens
        Azubi
        • 23.02.2016
        • 6

        #4
        sorry, hit post too quick...
        ... but I cannot get the commands right to set that VI switch back to "OFF".

        The Virtual input has as descrption "Main Light"
        The Virtual Output which I'm trying to use to reset that VI has "Address" set to the miniserver, appended with colon plus the port used here. "Close connection after sending" doesn't seem to matter...
        The Virtual Output Command's "Command for ON" has :"dev/sps/io/Main%20Light/off", the HTTP method for ON is set to "POST".

        What am I doing wrong ?

        Rgds,
        Tx for your suggestions...

        Kommentar

        • Christian Fenzl
          Lebende Foren Legende
          • 31.08.2015
          • 11234

          #5
          It's the default GET action, and is "Main Light" a unique identifier in your program?
          Try it in the web browser first, and if you have to authenticate in web, you have to in VO too.
          Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine

          Kommentar

          • duncan
            LoxBus Spammer
            • 28.08.2015
            • 313

            #6
            what about using a push button block instead of virtual input - it appears in the visu as a switch to show the status, but it has a Tr, R and O input so you can reset it easily using your own virtual input attached to the R

            Kommentar

            • bboydens
              Azubi
              • 23.02.2016
              • 6

              #7
              Hi Duncan,
              thx, never used simple push button block before, so didn't knew. Always thought VI was the simplest for UI purposes, but that works indeed. It does clutter up the LoxConfig pages more than a VI, but it works!

              Hi Christian,
              thx for the hint on GET, expected it need POST, since I was setting a variable...That did it.

              In looking for something else to use as unique identifier, to make it easier to reference rather than having to use the name of the control, I discovered that the Connection ID works as well:
              It is thus easier to use eg "miniserver/dev/sps/io/VI85/off"... rather than specifying the full Display Name of the control with Connection ID VI85....
              Zuletzt geändert von bboydens; 18.01.2017, 22:34. Grund: just discovered Connection ID works too

              Kommentar

              • bboydens
                Azubi
                • 23.02.2016
                • 6

                #8
                Hmm, still suffering here;
                it works OK from the browser with the "miniserver/dev/sps/io/VI85/off" command,
                but does not work when using the VO referring to miniserver and VO command for ON set to "dev/sps/io/VI85/off", using the GET method....

                Kommentar

                Lädt...