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

Unify Presence QA Use result in scene


GeeMoney

Question

I have the Unify Presence QuickApp installed and configured so it is now keeping track on some of my devices in my network.

The outcome of this check is presented on the QA itself but how can I now use this result in a scene/lua code to act upon it ?

In block scene's I'm unable to select a QA and it's also not a device or user panel so how do I do this?

 

If the outcome of the QA is 0 (means all my configured devices are not found in the local network) I would like to close  the front gate for example.

Please login or register to see this attachment.

Edited by GeeMoney
typo's
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • On 2/24/2023 at 10:01 PM, Lode said:

    "global-variable" is a property, not the variable itself.

    I'm trying to help you out of here but i'm not an expert.

    With this codesnippet you can get a variable from a quickapp in a lua scene.
    Does this help you out ?

     

    Please login or register to see this code.

     

     

    Got it !!

     

    When all my devices are not found on my WiFi network, the Unifi Presence Quick App will have a value of 0.0 , my scene checks this value every 300 second (5 minutes) and turns off device 36 ( (hub.call({36} in the code) when the value is indeed 0.0 .

    Full code now with my own global-variable AUTOMATION == TRUE as a trigger. I've created this global-variable to have an easy way of stopping all scenes without having to click on each of them in the web interface. I Just change this global variable to FALSE and that's it, anyway:

     

    CONDITIONS:

     

    {
      conditions = { {
          isTrigger = true,
          operator = "==",
          property = "AUTOMATION",
          type = "global-variable",
          value = "TRUE"
        }, {
          isTrigger = true,
          operator = "matchInterval",
          property = "cron",
          type = "date",
          value = {
            date = { "00""07""3""3""*""2023" },
            interval = 300
          }
        } },
      operator = "all"
    }
     
    ACTIONS:
    --local v = fibaro.getValue(204,"value"). <--204 Is my specific Unifi Presence QuickApp ID. Only uncomment this to debug.
    --hub.debug("Scene70",v) <-- Only used to get the current value in the debug console.
    if ((hub.getValue(204'value') == 0.0)) then
         hub.call({36}, "turnOff")
    end
    Edited by GeeMoney
    Link to comment
    Share on other sites

    • 0

    You can call your Quickapp by it's ID.

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 33 minutes ago, marczu_83 said:

    Please login or register to see this code.

    This shoud trigger the scene

    I've tried that one with a simple light bulb but it seems that it is always triggering the light bulb no matter the value.

    Current value is 3. When I leave the value to zero in the code it still triggers the light bulb ?

    I'm not really familiar with LUA on HC3 yet so maybe I'm not understanding the conditions correctly.

    Link to comment
    Share on other sites

    • 0

    Please login or register to see this code.

    In your QA you can set a global variable to the desired number and use it as a condition.

    This must trigger your scene !!

    Edited by Lode
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 33 minutes ago, Lode said:

    Can you post you QA ?

    Please login or register to see this code.

     

    @Lode ok, but in the code I cannot find "global-variable" ? How do I do this ?
    Too be honest that is a bit of the thing with fibaro. The manuals or QA's lack a decent explanation of how to configure/set things.
    I have created some user-variables myself in the settings->General->Variables that I use in some of my scenes but How does this QA change/set that variable?
    So I have created now a variable for example that is named: "devices_at_home" with a value of 3. I would like to create a scene now that first checks if the value from the Unify QA is 0 and changes my "devices_at_home" into 0?
    If value is indeed zero ->continue with scene.
     

    Edited by GeeMoney
    Link to comment
    Share on other sites

    • 0

    "global-variable" is a property, not the variable itself.

    I'm trying to help you out of here but i'm not an expert.

    With this codesnippet you can get a variable from a quickapp in a lua scene.
    Does this help you out ?

     

    Please login or register to see this code.

     

    Edited by Lode
    Link to comment
    Share on other sites

    • 0
    On 2/24/2023 at 3:00 PM, GeeMoney said:

    I've tried that one with a simple light bulb but it seems that it is always triggering the light bulb no matter the value.

    Current value is 3. When I leave the value to zero in the code it still triggers the light bulb ?

    I'm not really familiar with LUA on HC3 yet so maybe I'm not understanding the conditions correctly.

     

    I think you had more triggers in the conditions block and set operator to any. Your condition says exactly, trigger if device value is 0 (zero).

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