Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

How do I show feedback in virtual device?


Question

Posted

Hi All,

Looking to show feedback somehow in virtual device, can anyone help me urgently? Would like to try and get it done today.

I have an iTach serial talking to an Onkyo receiver over rs232 (pre ip models). I successfully have it talking over iTest (GC realterm kinda program) and am just finalising it working via HC2. What I need to know is, I can see feedback in terminal window but how do I display it in Virtual device?

1) Where do I show it? Does it have to be in button?

2) How do I show it ? Ie LUA or just some string?

E.g "!1MVLUP\cr" sends command to put vol up by one. I then get a message back in code telling me in decimal what the value is. I need to parse it and show it in the device to show the volume. Obviously I can do this for a lot of parameters yo then use in scrnes etc.

Help much appreciated.

KR, Dave:)

6 answers to this question

Recommended Posts

  • 0
Posted

Hi dw89, all you need is mentioned in description of main loop, you can show volume level by slider or simply by label, just use this example:

Examples of use: fibaro:call(1170, ˝setProperty˝, ˝ui.Label1.value˝, ˝program 1˝); - sets virtual device ID 1170 Label1 content to program 1 value. fibaro:call(1170, ˝setProperty˝, ˝ui.Slider1.value˝, ˝45˝); - sets virtual device ID 1170 Slider1 to the value of 45.
  • 0
  • Inquirer
  • Posted

    Hi J Nowacki,

    Thanks for the hint. Im a bit new to the fibaro calls and Lua so Im just trying to figure it all out.

    Is there a repository of information on the fibaro api etc somewhere?

    Sure it will all come in time!

    Will come back to you if I get stuck or if I get it all working!

    KR, Dave:)

    • 0
    Posted

    You can find some info here:

    Please login or register to see this link.

    but for now we have only polish version of that.

    • 0
  • Inquirer
  • Posted

    J.Nowacki/Whomever,

    Unless I'm stupid (quite possible considering I've never used LUA before) all this does is 'set' Label 1 on virtual device id1170 to the value of 'program 1'.i.e.

    fibaro:call(1170, ˝setProperty˝, ˝ui.Label1.value˝, ˝program 1˝);

    so, if the outcome of Program 1 was '2' then label would read '2'.

    I understand that 100% but what I'm trying to work out is how to I 'capture' the feedback in the first place so that I can update the label secondly?

    i.e. command sent to put power on in RS232 is "!1PWR010x0D" This puts power on and will return a value like "!1PWR01" which, in this case, just states that it is now "On". So, before I write 'On' to my label....how do I capture the return message in the LUA in MAIN from my button command above? If you can tell me how to capture the message I can work the rest out for all kinds of messages (or should be able to!).

    Edit: Will this work?

    iTach = Net.FHttp("192.168.1.82", 4999)

    iTach:setBasicAuthentication("Admin","Admin")

    response, status, errorCode = iTach:POST("!1PWR010x0D")

    if errorCode == 0

    then

    fibaro:call(??, ˝setProperty˝, ˝ui.Label1.value˝, response);

    fibaro:log(status)

    else

    fibaro:log("error")

    end

    Update at 20:30; I've found some much better code using tcpSocket:write and read to do the job but I still need to know how to find the Virtual Device 'ID' so that I can set the read information to the ui.label1 message label. Any advice greatly appreciated on how to find ID

    How do I get Virtual Device ID for "??" above?

    Please help asap:) Dave

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Posted

    You can do it in 2 ways:

    - myDeviceID will contain id of device

    Please login or register to see this code.

    -when you are in configuration panel of virtual device, check address bar of your browser, at the end the id of device is listed e.g.

    Please login or register to see this code.

    in that case 63 is the id

    • 0
  • Inquirer
  • Posted

    Great, thanks very much;)

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...