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


Question: variables will update during script?


Redeemer

Recommended Posts

Hi there,

 

I have a little question about variables declaration. Sorry if this question is already elsewhere but I was unable to find it.

 

At the beginning of the script I declare a variable calling a sensor with something like this:

 

myvariable = fibaro:getvalue(*ID*, "value")

 

and I use it thorough my script.

 

If the sensor change status during the script (let's say the variable is linked to a motion sensor, that from breached switch to safe because it doesn't see any movement anymore) does the variable update itself or I have to call again for a "getvalue" to force it to update?

 

Thanks

Link to comment
Share on other sites

  • Topic Author
  • Answer by myself: no, they will not update themselves automatically. you have to call them again to update.

     

    Changing question: there is a way to update a variable every time the sensor linked change state?

     

    Thanks

    Link to comment
    Share on other sites

    @Redeemer You can update a global variable with the actual status. But in your code you then still have to react on the changed global variable. 

     

    Maybe explain what you are trying to achieve? Many things are already solved on the forum. 

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • Hi @SmartHomeEddy ,

     

    Thanks for the help, I imagined that.

     

    I'm doing a little script that leaves the garage door open "while" it sees movement inside it (informations got by 2 motion sensors).

     

    I get the value from these sensors at the beginning of the script and convert them into variables (to remember them better), and I noticed that those variables does not change unless you call them again when the sensor change status.

     

    This is it, without entering into details. If you need more of them I can post the entire script here.

    Link to comment
    Share on other sites

    @Redeemer I use a script that leaves the light on, as long as there is movement by two motion sensors. That sounds the same?

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

  • Topic Author
  • @SmartHomeEddy yeah exactly, except that I have to leave also my garage door open, but that should not be too difficult to implement.

     

    Can you share it? I’m still a noob in LUA scripting.

     

    Thanks!!

    Link to comment
    Share on other sites

     

     

    This is my ACTION part:

     

    Please login or register to see this code.

     

     

     

    This is my DECLARATIONS part:

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    10 minutes ago, SmartHomeEddy said:

    This is my ACTION part:

     

    ehm, i think Radeemer is looking for HC2 solution, not HC3 (and on HC3 in scenes one can additionally use get/setSceneVariable)

    Link to comment
    Share on other sites

    54 minutes ago, tinman said:

    (and on HC3 in scenes one can additionally use get/setSceneVariable)

    Have you figured out where they store the scene variables?

    Link to comment
    Share on other sites

    I had the same sort of script on my HC2, but can’t find it on the forum. Maybe I never uploaded it. I found something a bit simular:

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • Thanks to all of you guys, I have looked at the other forum post but it's pretty complicated. I have done something similar but with a lot less lines of code. At the moment it's working fine, will let you know if there will be troubles.

     

    @SmartHomeEddy since you have HC3, can you tell me how it works? I have a couple of Sankotronic scripts and other ones made by myself, do you think I can have some troubles with that?

    Link to comment
    Share on other sites

    23 minutes ago, Redeemer said:

    can you tell me how it works?

     

    do you mean the script that keeps the light on during motion?

     

    Link to comment
    Share on other sites

  • Topic Author
  • On 10/27/2020 at 1:37 PM, SmartHomeEddy said:

     

    do you mean the script that keeps the light on during motion?

     

     

    No, I mean the HC3 entirely. I have heard, some time ago, that there are some troubles with some VDs (like the one for NetAtmo weather by Sankotronic).

    Link to comment
    Share on other sites

    @Redeemer The HC3 works fine. But second party scripts are still to be developed. The VDs won't work on the HC3. Sankotronic hasn't build HC3 scripts of Quickapps, so if you rely on his scripts or VDs, try to find alternatives of build them yourself. I don't use Netatmo, so I don't know if that works ok. There are Quickapps for Netatmo. 

     

    There is a lot of development on this forum. Without that, I wouldn't have bought the HC3, but that also counts for the HC2 I still have. 

    Link to comment
    Share on other sites

  • Topic Author
  • On 11/2/2020 at 8:29 AM, SmartHomeEddy said:

    @Redeemer The HC3 works fine. But second party scripts are still to be developed. The VDs won't work on the HC3. Sankotronic hasn't build HC3 scripts of Quickapps, so if you rely on his scripts or VDs, try to find alternatives of build them yourself. I don't use Netatmo, so I don't know if that works ok. There are Quickapps for Netatmo. 

     

    There is a lot of development on this forum. Without that, I wouldn't have bought the HC3, but that also counts for the HC2 I still have. 

    Thanks a lot for your analysis. Very helpful!

    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
    Reply to this topic...

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