Virtual http input

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

    #1

    Virtual http input

    Hi,

    I'm writing in English because my German is only good enough for me to be able to read (very slowly though), I hope you don't mind!

    I'm having some trouble with one virtual http input.
    I'm polling a page every minute, and the output is like this:

    {"version":1,"reqId":"1","result":"ok","error": "ui _alert_invalid","data": {},"state":1,"action":0,"cleaning": {"category":2,"mode":2,"modifier":1,"spotWidth" :0, "spotHeight":0},"details": {"isCharging":false,"isDocked":true,"isSchedule Ena bled":false,"dockHasBeenSeen":false,"charge":98}," availableCommands": {"start":true,"stop":false,"pause":false,"resum e": false,"goToBase":false},"availableServices": {"houseCleaning":"basic-1","spotCleaning":"basic-1","manualCleaning":"basic-1","easyConnect":"basic-1","schedule":"basic-1"},"meta": {"modelName":"BotVacConnected","firmware":"2.0. 0"} }
    As long as I request a number value, everything works fine.

    For example: "charge":\v gives me the number 98, which I can see in my user interface as 98% battery left.

    Now I'm stuck at getting a text value, I need the value listed after "error":"

    So in this case, I need ui_alert_invalid to be passed on to a "state" function block.

    No matter what I do, the output is always 0. I tried sending that string with a virtual text input to the state function block, and that works perfectly.
    So we know the state function block CAN receive text input, but it seems the virtual http input can not send them?

    If anyone could shed some light on this, that would be great!

    Wannes from Belgium.
    Zuletzt geändert von Gast; 22.03.2016, 22:28.
  • Christian Fenzl
    Lebende Foren Legende
    • 31.08.2015
    • 11234

    #2
    Hi Wannes,

    currently the Virtual HTTP Output cannot manage texts.

    For two or three use-cases I use a dirty, dirty hack but you have to figure out if it helps for your error messages:
    With the \1 keyword you get the ASCII code of the ONE symbol.

    For example:
    "error":"ui_alert_\1 will give you 105 (i).
    "error":"ui_alert_\s1\1 will give you 110 (n) - \s1 means discard 1 char.
    "error":"ui_alert_\s2\1 will give you 118 (v)

    If you KNOW all possible errors (that may be the pitfall) with one letter or multiple letters you would be able to interpret the message.

    In a State (Status?) block, you can re-assamble one up to four virtual inputs (if I1=105 AND I2=110 AND I3=118 then ...).

    Maybe not the right thing for error texts, but well working for some of your fields, e.g. (t)rue or (f)alse.

    Regards,
    Christian
    Hilfe für die Menschen der Ukraine: https://www.loxforum.com/forum/proje...Cr-die-ukraine

    Kommentar

    • Gast

      #3
      Hi Christian,

      thanks for the suggestion!
      It is a dirty workaround, but I think it will work, I'll get right on it!

      Wannes

      Kommentar

      • Gast

        #4
        Works perfectly!!
        Thanks!

        Kommentar

        Lädt...