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

Door lock timer check


kyote

Question

Hi all,

 

I am trying to create a scene that checks if my front (Z-Wave) door lock has been unlocked for x minutes - then turn on a light (this is not the end goal, however for simplicity all I would like to do is turn in a light for the moment).

 

The issue...

 

In the LUA code below - all works as expected. Where I am falling down is if the lock is locked within the x minute timer countdown, my LUA code still turns on the light after the time expires - I would like my scene to re-set if the door is locked again.

 

I have been investigating possibly using a variable, however I think I may be over complicating things - is there an easier (simpler) way?

 

Please login or register to see this code.

 

Thanks for any assistance offered, it is greatly appreciated.

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

If you only won't the last instance of you code to run you can add this to the top of your code.

This will check if there is another instance of the code already running and if there is stop it before running your cade again.

 

--[[
%% properties
386 secured
%% weather
%% events
%% globals

%% killOtherInstances
--]]

Link to comment
Share on other sites

  • 0
  • Inquirer
  • On 4/2/2018 at 11:51 PM, John9439 said:

    If you only won't the last instance of you code to run you can add this to the top of your code.

    This will check if there is another instance of the code already running and if there is stop it before running your cade again.

     

    --[[
    %% properties
    386 secured
    %% weather
    %% events
    %% globals

    %% killOtherInstances
    --]]

     

    I was not aware of the killOtherInstances function - thank you :)

     

    However I believe this will not stop the scene from counting down to 0 and turning on the light if the lock is locked once more - it would however kill the previous instance if the lock is unlocked once again.

     

    Ideally, I need a way to kill the countdown once the lock is locked again - really trying to avoid using a variable if possible...

     

    Does anyone else have a simple solution to this scene?

     

    Thanks

    Edited by kyote
    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...