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


  • 1

Quick Apps questions


tcviper

Question

Hello ?

If I want to make a Quick App (VD) with 2 buttons, what is the command to call for a http line?

So when button 1 is pressed I want deviceid XX to turn on ?

 

Thanks

Link to comment
Share on other sites

Recommended Posts

  • 0
3 minutes ago, tcviper said:

Hello ?

If I want to make a Quick App (VD) with 2 buttons, what is the command to call for a http line?

So when button 1 is pressed I want deviceid XX to turn on ?

 

Thanks

Didn't really understand.

You want to create the QD (with 2 buttons that control a deviceID) with a http request?

...or you want to press a button on the QD with a http request?

...or?

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I simply want to enable the satel alarm (which is device id 857 in my case) (actions are arm and disarm). With a virtual device.

     

    The device id has these properties:

     

    Please login or register to see this code.

     

    So how can I (from a new quick app vd) call this device id 857 to arm or disarm?

    Edited by tcviper
    Link to comment
    Share on other sites

    • 0
    9 minutes ago, tcviper said:

    I simply want to enable the satel alarm (which is device id 857 in my case) (actions are arm and disarm). With a virtual device.

     

    The device id has these properties:

     

    Please login or register to see this code.

     

    So how can I (from a new quick app vd) call this device id 857 to arm or disarm?

     

    Doesn't it work to do fibaro.call(857,"arm") resp. fibaro.call(857,"disarm") ?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ha, thank you that works indeed ?

     

    Actually it works in the preview windows, but not when i click the buttons in the app (or from a scene), any idea?

     

    @jgab looks like you can create 'buttons' with those actions, however in the app when you 'enable' or 'disable' the device that does not call for those buttons. 

    Edited by tcviper
    Link to comment
    Share on other sites

    • 0
    Guest kallecux

    yes - thats right - the 2 buttons are not shown - maybe later with a new smartphone app....

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 10 minutes ago, kallecux said:

    yes - thats right - the 2 buttons are not shown - maybe later with a new smartphone app....

     

    And as far as you know there is no way to make the 2 buttons call the default 'on' and 'off' of a vd device? :P

    Link to comment
    Share on other sites

    • 0

    Does anyone know how to send a GET command with a url address in Quick apps to control another device via LAN? It is not possible to enter the IP address. In HC2 I sent:

     

    function updateStatus()
        local deviceID = fibaro:getSelfId();
        local ipaddress = fibaro:getValue(deviceID, "IPAddress");
        local port = fibaro:getValue(deviceID, "TCPPort");
        
        local rPi = Net.FHttp(ipaddress, port);
        local resp, status, result = rPi:GET("/?device=relay&name=Power1&command=get");
        
        local stat = "OFFLINE";
          local icon = 1012
        
        if ((result == 0) and (status == "200")) then      
            local status = json.decode(resp)["value"]
            if (status == "on") then icon = 1005 else icon = 1006 end
            if status == "on" then stat = "ON" else stat = "OFF" end
        else
            --fibaro:debug("Result = "..result)
            --fibaro:debug("Status = "..status)
        end

          fibaro:call(deviceID, "setProperty", "currentIcon", icon);
        fibaro:call(deviceID, "setProperty", "ui.".."lblStatus"..".value", stat);  
    end

    function setState(state)

        local deviceID = fibaro:getSelfId();
        local ipaddress = fibaro:getValue(deviceID, "IPAddress");
        local port = fibaro:getValue(deviceID, "TCPPort");
        
        local rPi = Net.FHttp(ipaddress, port);
        local resp, status, result = rPi:GET("/?device=relay&name=Power1&command="..state);
        if ((result == 0) and (status == "200")) then
          
        else
            --fibaro:debug("Result = "..result)
            --fibaro:debug("Status = "..status)
        end
    end

    setState("toggle")
    updateStatus()

    Link to comment
    Share on other sites

    • 0

    Hi. I had a command in Vd HC2 :

    Please login or register to see this code.

    and through the vd button I could open the door with this command, now I don't know how to do it :( HC3 Quick apps . Can anyone help? thank you in advance and sorry for my english.
     

     

    Edited by DJSUCHAR
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • So nobody has found a way to use the Quick apps/devices On/Off state for a function?

    Link to comment
    Share on other sites

    • 0
    1 hour ago, tcviper said:

    So nobody has found a way to use the Quick apps/devices On/Off state for a function?

    You mean in the mobile app? In the web UI it works for me (I haven't used the app with HC3).

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Yes, in the mobile app or with scenes. So that button 1 can reflect ON for the device for example.

    Link to comment
    Share on other sites

    • 0

    I am not sure if I understand the question, but I can say additional buttons are not working in the app right now, Fibaro is working on new HC firmware and app with bugfixes. But the main function (eg on/off of a binary switch quick app) should work.

     

    Is this what you want to do?


    "Quick App" has been mentioned a few times so maybe a quick teaser to demonstrate what it can do, and show one of the main differences compared with VD. Such a QA can represent a device, for example a "binary switch" or "multilevel switch". You write lua code to set on/off state and respond to on/off requests. It behaves like a "real" (eg Z-Wave) switch and that was not possible with VD on HC2 (you could add "ON/OFF" labels and text but it was always a VD and not a switch). It will show on the app as eg a light or a switch (it is configurable).
     
    Sorry for the crappy camera work, I am not a "youtuber" at all ;)
     
    Tinkerers will recognize what I am doing here but for everyone else... What you see is a small module with a blue LED. It runs a web server and accepts on and off commands. On the left you'll see me click the "quick app" in the HC3 BUI and the LED will follow. On the right hand side, I have the web interface of that module. When I toggle the device there, the Quick App will toggle. You'll see a slight delay because in this case I "poll" the on/off state once every 3 seconds.
     

     

    I didn't film the Fibaro App on my phone, but I did test it and that red/green button updates and controls the device.

     

    23 minutes ago, jgab said:

    You mean in the mobile app? In the web UI it works for me (I haven't used the app with HC3).

    To be on the safe side, the buttons you added don't work in the app, it is a bug/limitation and Fibaro knows about it. This is going to confuse many users, I hope a fix will land soon...

    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Forgot to attach my example code... Credit wehre credit due, this code is the result of a cooperation of @AutoFrank, @petergebruers and some rework done by Fibaro, which is to say the main issue right now is lack of proper documentation of FQA aka "Fibaro Quick Apps"...

     

    Please login or register to see this attachment.

    • Thanks 4
    Link to comment
    Share on other sites

    • 0
    On 2/12/2020 at 11:41 AM, petergebruers said:

    Forgot to attach my example code... Credit wehre credit due, this code is the result of a cooperation of @AutoFrank, @petergebruers and some rework done by Fibaro, which is to say the main issue right now is lack of proper documentation of FQA aka "Fibaro Quick Apps"...

     

    Please login or register to see this attachment.

     

    Just a reflection...

    I'm starting to come to the conclusion that one shouldn't add functions to the QuickApp object/class unless they are part of the device's "API"...

    The QuickApp class/object only have one predefined method 'onInit()'... the other methods you define on QuickApp are callbacks (UI elements and functions being available with  fibaro.call(<device>, <name>, ...). As such they are accessible from other devices/scenes or external API. The specific support/functionality for a device resides in the 'self' object (getVariable, updateView etc..) and are also (unfortunately) exposed in the same way.

    So my point is that I don't think people should make a habit on adding all functions to the QuickApp class, but create "normal" Lua functions and "objects" that are kicked-off by a call from :onInit().

    But that will probably be part of the proper FQA documentation ;-) 

    Edited by jgab
    • Like 1
    Link to comment
    Share on other sites

    • 0
    12 minutes ago, jgab said:

    So my point is that I don't think people should make a habit on adding all functions to QuickApp, but create "normal" Lua functions and "objects" that are kicked-off by a call from :onInit().

    I think so, this example was the first real working FQA on my system and maybe it is a bit misleading to think it is "the way to go".

     

    14 minutes ago, jgab said:

    But that will probably be part of the proper FQA documentation ;-) 

    I hope so... We cant keep reverse engineering and trying... Oh, wait, that is the fun part, we surely can keep digging and trying ;)

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 hours ago, petergebruers said:

    I am not sure if I understand the question, but I can say additional buttons are not working in the app right now, Fibaro is working on new HC firmware and app with bugfixes. But the main function (eg on/off of a binary switch quick app) should work.

     

    Is this what you want to do?


    "Quick App" has been mentioned a few times so maybe a quick teaser to demonstrate what it can do, and show one of the main differences compared with VD. Such a QA can represent a device, for example a "binary switch" or "multilevel switch". You write lua code to set on/off state and respond to on/off requests. It behaves like a "real" (eg Z-Wave) switch and that was not possible with VD on HC2 (you could add "ON/OFF" labels and text but it was always a VD and not a switch). It will show on the app as eg a light or a switch (it is configurable).
     
    Sorry for the crappy camera work, I am not a "youtuber" at all ;)
     
    Tinkerers will recognize what I am doing here but for everyone else... What you see is a small module with a blue LED. It runs a web server and accepts on and off commands. On the left you'll see me click the "quick app" in the HC3 BUI and the LED will follow. On the right hand side, I have the web interface of that module. When I toggle the device there, the Quick App will toggle. You'll see a slight delay because in this case I "poll" the on/off state once every 3 seconds.
     

    I didn't film the Fibaro App on my

    phone, but I did test it and that red/green button updates and controls the device.

     

    To be on the safe side, the buttons you added don't work in the app, it is a bug/limitation and Fibaro knows about it. This is going to confuse many users, I hope a fix will land soon...

     

    Yes, that is sort of what I was trying to say,

    - A Quick app device that has 2 buttons and  those buttons basically represent ON or OFF for that device (so it works everywhere),

    now the only thing then is, how to do the fibaro.call(857,"arm") resp. fibaro.call(857,"disarm") for those buttons.

    Link to comment
    Share on other sites

    • 0
    19 minutes ago, tcviper said:

     

    Yes, that is sort of what I was trying to say,

    - A Quick app device that has 2 buttons and  those buttons basically represent ON or OFF for that device (so it works everywhere),

    now the only thing then is, how to do the fibaro.call(857,"arm") resp. fibaro.call(857,"disarm") for those buttons.

     

    So I believe that it's a binary switch that has that kind of button red/green ring like the hall lamp in petergebruers example.

    That means that the QD is of type binary switch and has 

    function QuickApp:turnOn() self:updateProperty("value", true) end

    function QuickApp:turnOff() self:updateProperty("value", false) end

    ...that is called when you press the ring (and it changes color from red to green and back.

    If that button works on the mobile app (I don't know) you can...

     

    ...make a "facade" QD of type binary switch and add the calls to 857 there as a response to turnOn/turnOff commands on that facade QD.

    function QuickApp:turnOn() fibaro.call(857,"arm")  self:updateProperty("value", true) end

    function QuickApp:turnOff() fibaro.call(857,"disarm")  self:updateProperty("value", false) end

     

    Then you would also like to update the state of your binary switch if the alarm (deviceID 857) changes state without you using the binary facade switch. From a QD you need to poll the state of the alarm I guess....

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ok, @jgab so i did this:

    Please login or register to see this code.

     

    Any idea why this does not work? I can click the button but nothing happens? 1147 is the device id that needs to be armed.

    Edited by tcviper
    Link to comment
    Share on other sites

    • 0

    Do you see the log ?

    Please login or register to see this code.

    if not I guess even the built in-buttons doesn’t work in the mobile app...?

     

    Link to comment
    Share on other sites

    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...