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

Posted

I would appreciate some help with writing a scene.  I've created the scene as detailed in the image below.

 

On the press of my door bell push it triggers the scene as follows -

 

1) Memorise current position of CCTV camera (Memorise code placed in virtual device on button 152 press)

 

2) Move CCTV camera to front door preset (code placed in virtual device on button 41 press)

 

3) After 30 second delay move CCTV camera back to saved position preset (code placed in virtual device on button 153 press).

 

The scene works fine apart from when the door bell button is pressed multiple times in quick succession it saves the current position (i.e. Step 1) as the front door.  I need it to ignore more than a single button press until the camera has returned to the memorised position.  How to I code this?

 

Thanks in advance

 

Steve

 

 

 

Please login or register to see this image.

4 answers to this question

Recommended Posts

  • 0
Posted

Option1 = use Lua and check at the beginning of the scene for duplicates. If another copy of the scene is running, ignore new triggers.

 

Option2 = create a global variable "sceneRunning" and check that it is 0 every time button is pressed. If it really is 0, change it to 1 before first CCTV button press, and then back to 0 after the last CCTV button press

  • 0
  • Inquirer
  • Posted

    Option1 = use Lua and check at the beginning of the scene for duplicates. If another copy of the scene is running, ignore new triggers.

     

    Option2 = create a global variable "sceneRunning" and check that it is 0 every time button is pressed. If it really is 0, change it to 1 before first CCTV button press, and then back to 0 after the last CCTV button press

     

    Rait,  Thank you for your advice,  I opted for your Lua option...

     

    I have now coded it as below

    Please login or register to see this code.

    Unfortunately this bit of my code is not correct because it stops the scene running even on one call.  Any ideas what i have done wrong?

    Please login or register to see this code.

    Thanks

     

    Steve

    • 0
    Posted

    I believe fibaro:countScenes returns a string, as most fibaro functions do. So you need to use tonumber(fibaro:countScenes())

    • 0
  • Inquirer
  • Posted

    I believe fibaro:countScenes returns a string, as most fibaro functions do. So you need to use tonumber(fibaro:countScenes())

     

    Thank you that works a treat.

     

    Steve

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