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
Mateo

How getting a QA/QD variable value in a scene?

Question

Hello community :)

 

Looking for some support. I do have created a QA which is automating light control based on movement for each room.

when a move is detected, it's lighting on and updating a QA variable named "Presence". After 3 minutes, lights goes off (if no motion detected), and presence status goes to absent in that room.

 

In parallel, i do have a scene where i need to check this presence status of a room in the appropriate QA Variable (this "Presence" status).

How do i get it?

sorry the question is very stupid but after one hour of search, can't find it :)

 

Thanks in advance for your experience !

:)

take care

 

 

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0
13 hours ago, Mateo said:

Hello community :)

 

Looking for some support. I do have created a QA which is automating light control based on movement for each room.

when a move is detected, it's lighting on and updating a QA variable named "Presence". After 3 minutes, lights goes off (if no motion detected), and presence status goes to absent in that room.

 

In parallel, i do have a scene where i need to check this presence status of a room in the appropriate QA Variable (this "Presence" status).

How do i get it?

sorry the question is very stupid but after one hour of search, can't find it :)

 

Thanks in advance for your experience !

:)

take care

 

QA variables are a bit inefficient to use as ordinary variables, but this is how to access them - deviceID need to be valid

Please login or register to see this code.

 

Share this post


Link to post
Share on other sites
  • 0

Maybe you can create a Variable and use "0" for absent and "1" for present.

I made a variable "Woonkamer_Presence" and set it to "0" as default. When there is motion a scene sets the variable to "1" and the delay sets it back to "0" after 20 seconds (as test but in your case you can set it to 3 minutes).

You can create a scene for every motion detector and use the variable in another scene to trigger (e.g. When variable Woonkamer_Presence = 1 then Switch = On)a switch for the lights.

I'm using scenes because I can't write scripts in LUA :-( 

Please login or register to see this attachment.

Share this post


Link to post
Share on other sites
  • 0
  • Inquirer
  •  

    9 hours ago, jgab said:

     

    QA variables are a bit inefficient to use as ordinary variables, but this is how to access them - deviceID need to be valid

    Please login or register to see this code.

    @jgab, second time you save me with your experience! will owe you a beer :)

    thanks a lot, would have never imagine that would be that complex to get this simple data.

    What would be your recommendation then? storing this variable into the QA and finally get it as you said, or finally build a global variable with k(room), v(presence or absence) ?

     

    thanks again for your presence and return of experience on this forum for all of us !

    br

    mathias

     

    1 hour ago, Renaixsence said:

    Maybe you can create a Variable and use "0" for absent and "1" for present.

    I made a variable "Woonkamer_Presence" and set it to "0" as default. When there is motion a scene sets the variable to "1" and the delay sets it back to "0" after 20 seconds (as test but in your case you can set it to 3 minutes).

    You can create a scene for every motion detector and use the variable in another scene to trigger (e.g. When variable Woonkamer_Presence = 1 then Switch = On)a switch for the lights.

    I'm using scenes because I can't write scripts in LUA :-( 

    Please login or register to see this attachment.

     

    thanks @Renaixsence

    do you mean you have created one GLOBAL variable to store it ?

    :)

     

    Share this post


    Link to post
    Share on other sites
    • 0

    I didn't create a global variable because every room needs to have his own variable (present/absent) to trigger the switch/light in the room but you can do it without a variable and when there is motion detected you trigger the event and the delayed timer and every time there is motion detected the delay is set to 0 and starts all over again and switches of the powerplug after 40s (in my example).

    The event per room can be useful to trigger another event in another room (switch of the light after 1 minute for instance so i doesn't stay on for 3 minutes when you leave a room and enter another

    Please login or register to see this attachment.

    Share this post


    Link to post
    Share on other sites
    • 0
    22 hours ago, Mateo said:

    Looking for some support. I do have created a QA which is automating light control based on movement for each room.

    when a move is detected, it's lighting on and updating a QA variable named "Presence". After 3 minutes, lights goes off (if no motion detected), and presence status goes to absent in that room.

     

    In parallel, i do have a scene where i need to check this presence status of a room in the appropriate QA Variable (this "Presence" status).

    How do i get it?

     

    I assume your scene is Lua based? Global variables are easier as you can trigger the scene when the variable change value - this is difficult with quickvars.

    You could also post a "customeEvent" that your scene could trigger on, but it's an event and difficult to check the state afterwards.  

     

    So, the real way to do it is to make sure that your QA is of type com.fibaro.motionSensor and set the value property of the QuickApp to true when you detect presence and false after 3min.

    That way your scene can trigger on your device changing state - like a real physical device. You can also use the QA in block scenes and trigger on state going on and off.

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  •  

    On 5/12/2020 at 6:02 PM, jgab said:

     

    I assume your scene is Lua based? Global variables are easier as you can trigger the scene when the variable change value - this is difficult with quickvars.

    You could also post a "customeEvent" that your scene could trigger on, but it's an event and difficult to check the state afterwards.  

     

    So, the real way to do it is to make sure that your QA is of type com.fibaro.motionSensor and set the value property of the QuickApp to true when you detect presence and false after 3min.

    That way your scene can trigger on your device changing state - like a real physical device. You can also use the QA in block scenes and trigger on state going on and off.

     

    hello jgab,

    indeed developing scenes in LUA,

    Fully get your idea, very pragmatic and effective :) like it...

     

    was having in mind potentially another approach that would then gives a full overview of the presence in the house on top (Actually i want to duplicate the ligh control QA for all my rooms and then each QA could contribute to a globalVariable having the status of all).

    I do have difficulties into writing the code that, from each QA would store and update the room data in that a table, part of a globalVariable.

    would just like to store (roomCode = "presence" or "absence")

     

    any code idea?

    thanks a lot

     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • found the solution... if it could help:

     

    Please login or register to see this code.

    thanks all, take care

     

    Share this post


    Link to post
    Share on other sites
    • 0
    Posted (edited)

    Can someone explain how these scripts can be used in HC3. I can only find how to convert a block script to LUA or write one yourself for a scene but I find it very limited (I would like to have a LUA script for my ZRC-90 so I don't have to make a scene for every button (8 and its 4 functions = 32 scenes :-( )

     

    For every function of button 8 on my ZRC-90 I have a single scene. How can I combine these three scenes/scripts in one script (so I can do the same for all the buttons on my ZRC-90 and have one script)

     

    Now I have this for button 8 pressed

     

    DECLARATIONS (Conditions/Triggers)

    ACTIONS

     

     

     

     

    {

      conditions = { {

          id = 56,

          isTrigger = true,

          operator = "==",

          property = "centralSceneEvent",

          type = "device",

          value = {

            keyAttribute = "Pressed",

            keyId = 8

          }

        } },

      operator = "all"

    }

     

     

    I have this for button 8 pressed twice

    fibaro.call(58'turnOn')

     

     

     

     

    DECLARATIONS (Conditions/Triggers)

    ACTIONS

     

     

     

     

    {

      conditions = { {

          id = 56,

          isTrigger = true,

          operator = "==",

          property = "centralSceneEvent",

          type = "device",

          value = {

            keyAttribute = "Pressed2",

            keyId = 8

          }

        } },

      operator = "all"

    }

    fibaro.call(58'turnOff')

     

     

     

     And so on ….

    How can I combine these in one script ??

    Edited by Renaixsence

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • On 5/19/2020 at 1:42 AM, Mateo said:

    found the solution... if it could help:

     

    Please login or register to see this code.

    thanks all, take care

     

     

    Actually it doesn't work that well :)

    it's creating a table and encoding it in a Global Variable but when using the same code in another QA, it's replacing instead of adding the data of another room ....

    (as a remember, having a sample QA that i replicate from room to room and that contribute to a single globalVariable when motion detected in one or other room. Expected results is a complete table having status of presence for all rooms).

     

    @jgabmy saver, any idea for this new but surely simple issue?

    i've tried getting the globalvariable table into my QA, adding or updating a key and recoding and sending back... but stucks with multiple issues :)

     

    thanks in advance for any help:)

     

     

     

    Share this post


    Link to post
    Share on other sites
    • 0

    I thought about doing something like this

    Please login or register to see this attachment.

     

    This is a QA that is of type com.fibaro.binarySensor (the icon with the blue person standing/running)

    It has 2 quickApp variables to configure

    "devices" that one sets to a list of devices you want to watch, ex "21 214"

    "delay" that is the delay in seconds before it becomes safe again after being breached.

     

    Assume I have two rooms, 

    Room A with two sensors, 21 and 214

    Room B with two sensors, 33 and 36

     

    I create one DeviceSensor QA with devices = "21 214" and delay = "120" and I give the QA the name "Room A"

    Assume that the QA deviceID for room A will be 301

    That QA will turn on when either device 21 or 214 turns on, and it will turn off when 21 and 214 have booth been safe for 2 minutes

    That way I can ex. turn off the light in room A when the QA turns safe.

     

    Then I do the same thing for room B. Maybe also with a delay of 2 minutes.

    Assume that the QA deviceID for room B will be 302

     

    Then I make another DeviceSensor QA with devices = "301 302" and a delay = "120" and I give the QA the name My House"

    Assume that  the QA for deviceID for the house will be 303

    That QA will turn on when any sensor in room A or room B turns on, and it will turn safe 2 min after both room A and room B both turns safe.

    (This will in effect be 4min after all sensors are safe, we could set it to 0s and it would be after 2min)

     

    Then we can trigger on 303 becoming safe and turn off the front light...

     

    So, this way we can have a hierarchy of sensors for rooms, floors and the whole house - or any other way we want to divide up the house.

     

    That's was my idea.

     

    P.S The QA also works for lights, watching if lights are on or off. Any type of device that sets its value to false or 0 when off and true or val>0 when on.

    Edited by jgab

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 32 minutes ago, jgab said:

    I thought about doing something like this

    Please login or register to see this attachment.

     

    This is a QA that is of type com.fibaro.binarySensor (the icon with the blue person standing/running)

    It has 2 quickApp variables to configure

    "devices" that one sets to a list of devices you want to watch, ex "21 214"

    "delay" that is the delay in seconds before it becomes safe again after being breached.

     

    Assume I have two rooms, 

    Room A with two sensors, 21 and 214

    Room B with two sensors, 33 and 36

     

    I create one DeviceSensor QA with devices = "21 214" and delay = "120" and I give the QA the name "Room A"

    Assume that the QA deviceID for room A will be 301

    That QA will turn on when either device 21 or 214 turns on, and it will turn off when 21 and 214 have booth been safe for 2 minutes

    That way I can ex. turn off the light in room A when the QA turns safe.

     

    Then I do the same thing for room B. Maybe also with a delay of 2 minutes.

    Assume that the QA deviceID for room B will be 302

     

    Then I make another DeviceSensor QA with devices = "301 302" and a delay = "120" and I give the QA the name My House"

    Assume that  the QA for deviceID for the house will be 303

    That QA will turn on when any sensor in room A or room B turns on, and it will turn safe 2 min after both room A and room B both turns safe.

    (This will in effect be 4min after all sensors are safe, we could set it to 0s and it would be after 2min)

     

    Then we can trigger on 303 becoming safe and turn off the front light...

     

    So, this way we can have a hierarchy of sensors for rooms, floors and the whole house - or any other way we want to divide up the house.

     

    That's was my idea.

     

    P.S The QA also works for lights, watching if lights are on or off. Any type of device that sets its value to false or 0 when off and true or val>0 when on.

     

     

    thank you so muh @jgab, will review this.

     

    in the meantime and for community, i've just found this running solution a few minutes ago.

    Still lacking for experiencing it completely, but looks working :)

     

    Please login or register to see this code.

     

    35 minutes ago, jgab said:

    I thought about doing something like this

    Please login or register to see this attachment.

     

    This is a QA that is of type com.fibaro.binarySensor (the icon with the blue person standing/running)

    It has 2 quickApp variables to configure

    "devices" that one sets to a list of devices you want to watch, ex "21 214"

    "delay" that is the delay in seconds before it becomes safe again after being breached.

     

    Assume I have two rooms, 

    Room A with two sensors, 21 and 214

    Room B with two sensors, 33 and 36

     

    I create one DeviceSensor QA with devices = "21 214" and delay = "120" and I give the QA the name "Room A"

    Assume that the QA deviceID for room A will be 301

    That QA will turn on when either device 21 or 214 turns on, and it will turn off when 21 and 214 have booth been safe for 2 minutes

    That way I can ex. turn off the light in room A when the QA turns safe.

     

    Then I do the same thing for room B. Maybe also with a delay of 2 minutes.

    Assume that the QA deviceID for room B will be 302

     

    Then I make another DeviceSensor QA with devices = "301 302" and a delay = "120" and I give the QA the name My House"

    Assume that  the QA for deviceID for the house will be 303

    That QA will turn on when any sensor in room A or room B turns on, and it will turn safe 2 min after both room A and room B both turns safe.

    (This will in effect be 4min after all sensors are safe, we could set it to 0s and it would be after 2min)

     

    Then we can trigger on 303 becoming safe and turn off the front light...

     

    So, this way we can have a hierarchy of sensors for rooms, floors and the whole house - or any other way we want to divide up the house.

     

    That's was my idea.

     

    P.S The QA also works for lights, watching if lights are on or off. Any type of device that sets its value to false or 0 when off and true or val>0 when on.

     

     

    it gives me quite a lot new good ideas :)

     

     

     

     

    Share this post


    Link to post
    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...