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

Input field for a variable in a quickapp.


Question

Posted

Ok, so i understand the variable when creating a quickapp. (or at least, a little)

 

Could someone point me to, how to make it interactive, Like i have a quickapp with a

entry for a variable. I would like a dropdown option in the block scene when i use that quickapp.

With a entry field. (like a push msg does). 

 

Thanks

19 answers to this question

Recommended Posts

  • 0
Posted

Maybe a global variable is more suitable for that? 

  • 0
  • Inquirer
  • Posted (edited)
    37 minutes ago, SmartHomeEddy said:

    Maybe a global variable is more suitable for that? 

     

    Not sure what you mean there

     

    I have this code

     

    Please login or register to see this code.

     

    So the variable is what i enter in the field of the quickapp itself.

     

    If i make it a "global variable" would it then show up as a entry field in the quickapp itself ?

    How would i do that.

     

    (sorry, mijn engels is zo slecht. Zeker als het wat technisch wordt)

     

    Edited by ppeterr
    • 0
    Posted

    Don’t know for sure what you want to achieve. You want to change that “saywhat”?
     

    A global variable can be used in a block scene:

     

    Please login or register to see this image.

    /monthly_2021_08/46507242-8007-4E59-B21D-33BC7296FAB2.jpeg.5506f47d788659af99bbcd963a01364c.jpeg" />

     

    It can also be read, created and updated from a quickapp. So maybe you can use a global variable instead of a quickapp variable. 

    • 0
  • Inquirer
  • Posted

    I created a quickapp with a variable "saywhat". So i can enter a text that will be used in a link that activates

    a TTS script so it speaks out the variable.

    I can place this quickapp-block, in a scene. So when i open the shades (another block-scene), the quickapp reads out the variable "saywhat"".

     

    It would be perfect, if the scene block (with the quickapp) would have a entry field for the variable "saywhat",

    so i can use it mutliple times, without changing the variable in the quickapp.

     

    Now i copy the quickapp, rename it, change the variable, and re-use it in a block scene.

     

     

     

     

     

    • 0
  • Inquirer
  • Posted

    Tomorrow i'll look into the  global variable. Thanks for the tip :)

    • 0
    Posted

    I think it should work. Set the string in the global variable with the blockscene, start the quickapp and read, use the global variable. 
     

    And maybe if the global variable is empty, use the quickapp variable content.

     

    • 0
  • Inquirer
  • Posted

    I think a global variable is not what i need. If i understand it correct, a global variable is a value that

    can be set in a quickapp and used multiple times 

     

    Sorry not to be clear enough :)  I have so many ideas but not the knowledge.

     

    I would like a input field, like we have in a push notification.  So you can type in the variable

    per block scene. Like the field where i typed "weg"

     

     

    Please login or register to see this attachment.

    • 0
    Posted (edited)
    1 hour ago, ppeterr said:

    I think a global variable is not what i need. If i understand it correct, a global variable is a value that

    can be set in a quickapp and used multiple times 

     

    No, that is not what I mean, global not like in quickapp, but global like all over your Homecenter. 

     

    I mean the variable you can also create and edit in the "variable" tab in the "6. General" option.

     

    Variables may be used to expand the functionality of scenes. There are two types of variables: standard and enumerated. Standard variable takes one predefined value that can be used and changed in scenes, while enumerated variable takes one value from a set of values defined during the creation of a given variable.

     

    In the Lua manual:

     

    Please login or register to see this attachment.

     

     

    So it is not a "non local" variable in the quickapp (the quickapp manual also writes about global variables in a different way). It is a variable you can use throughout all your scenes and quickapps, like global on your Homecenter. 

     

    If you use my

    Please login or register to see this link.

    quickapp, that has also options to use global variables to extent its functions.

     

     

     

     

     

    Edited by SmartHomeEddy
    • 0
  • Inquirer
  • Posted

    Oke, yeah i am using your Buienradar QA. I love it, it works perfect. I took a look at the code,

    and checked the LUA manual. I decided to leave it for now. Its above my skills.

    Actually anything more then the basic stuff you can do with the HC3 has got a pretty steep learning curve.

    Or at least, for a "normal" user i think. Anyway thanks for pointing me in the right direction.

    • 0
    Posted
    15 minutes ago, ppeterr said:

    Oke, yeah i am using your Buienradar QA.

     

    (There are two, Buitenradar Rain and Buienradar Weather. The last one has the global variable routines.)

     

    It takes some time to get a grip on it. But if I see your learning curve, it won't take you much time to get this. 

     

    Small hint:

    api.get: get the value of the variable

    api.post: create variable (with a value)

    api.put: change value of the variable

    api.delete: delete the variable

     

    This is the routine I use to create or update the variable in the Buienradar Weather quickapp (jgab has a better routine), tag = name of the Global and res = the value for the Global. I edited the routine from the Buitenradar Weather quickapp, to only show the basics of api.get, api.post, api.put. 

     

    If (api.get) the global is nil, it doesn't exists, so use api.post to create and insert the value.

    If the global isn't nil, it exists, use api.put to change the value. 

     

    Please login or register to see this code.

     

    No pressure ?

     

    • Thanks 1
    • 0
  • Inquirer
  • Posted

    @SmartHomeEddy Let me bother you one more time about this. Because i am not

    one step further. Could you please provide me with a very small quickapp, that contains

    the code for a functional global variable, that gives me a entry field when used it a block scene.

     

    I really would like to find it out myself, but it seems i am thinking in a totally wrong direction,

    and it its been days trying to get it to work. And it got me nowhere yet :)

    • 0
    Posted

    I will make a small quickapp, one moment please ...

    • 0
  • Inquirer
  • Posted
    4 minutes ago, SmartHomeEddy said:

    I will make a small quickapp, one moment please ...

     

    No pressure ?

     

    Kidding, no hurry at all. Thanks! I think when i see how it works, i will understand it a little faster.

    • -1
    Posted (edited)

    @ppeterr Insert this code in a quickapp and let it run. At startup the quickapp will create a global variable "globalTest" if it doesn't exists. The value will be "Hello World". If the quickapp exists, the value will be updated (at startup of the quickapp). The quickapp will show the value (and table content) of the global variable every 10 seconds in the logging. 

     

    If the global variable exitst (you can see that in the option "6. General" in the tab "Variables") you can create a simple blockscene like this: 

     

    Please login or register to see this attachment.

     

    If you run it, the value (text) will be changed to "Dit is een test"

     

    The logging will look like:

     

    Please login or register to see this code.

     

    I hope this is wat you are looking for. 

     

    Please login or register to see this code.

     

     

     

     

    Edited by SmartHomeEddy
    • Like 1
    • 0
  • Inquirer
  • Posted

    Well, this works - and it doesnt look like anything i was doing. This makes a little more sense to me :)

     

    Just to make it clear for me:

     

    So, the code makes a new variable in the api, called "globaltest"

    It stays there, doesnt do anything,  you only made a loop to show the current variable status.

     

    This gives me a panel, i can put in front of the block scene, that changes the variable.

    And i can use that in a next block (quickapp) that reads the api entry.

     

    That would be it, excellent.

     

    I only need to figure out how to change a local variable in the quickapp, to read the global variable.

    Please login or register to see this code.

     

    Thanks, thanks a lot for helping me out. Really apreciate 

    • 0
    Posted (edited)
    8 minutes ago, ppeterr said:

    So, the code makes a new variable in the api, called "globaltest"

    It stays there, doesnt do anything,  you only made a loop to show the current variable status.

    Yes, it then only loops and shows the value of the global variable. 

     

    8 minutes ago, ppeterr said:

    So, the code makes a new variable in the api, called "globaltest"

    Ofcourse you can also simply make the global variable just adding it in option “6. General” tab “Variables”

     

    Please login or register to see this code.

    This puts the table content of the global variable in a local variable named text

     

    Please login or register to see this code.

    if you want to get the value (text) of that in your local variable “say” 

     

     

     


     

     

    Edited by SmartHomeEddy
    • Like 1
    • 0
  • Inquirer
  • Posted

    Oke, i just found the option 6. General variables - feel a little stupid now :P

    You mentioned it before, so i searched the LUA manuals for option 6 ...owowoow

     

    This makes it much more clear for me now.....

    • 0
  • Inquirer
  • Posted (edited)

    Oke it works, but it gives me a error. [edit] seems to be a easy fix.

     

    This is the QA code, that reads the globalvar

     

    Please login or register to see this code.

     

    This gives me a url, to parse to the php server:

     

    Please login or register to see this code.

     

    Where "this is a test yes yes yes " is the value from the globalvar. (yes yes this works thanks)

     

    When i paste this link into a browser, it does work.

     

    But the error is:

     

    Please login or register to see this code.

     

    Ow and that has al to do with the spaces in between

    As a space the php needs %20.

     

    Thats it for today :) it seems to work

    Thanks so much @SmartHomeEddy

     

    Please login or register to see this code.

     

    Edited by ppeterr
    • Like 1
    • 0
    Posted

    Great to see it worked ???

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