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

Virtual button to start a scene


Question

Posted

I had a similar topic a few days ago, but I have still no idea, what LUA code I have to use in a virtual button to start a simple Scene.

 

I tried a lot, but it all didn´t work, although the scene works perfect when I start it manually - but not via a virtual button.

 

Could someone provide me with a screenshot of a virtual button / LUA Code to start a scene please?

Please login or register to see this image.

/emoticons/default_icon_rolleyes.gif" alt=":roll:" />

Recommended Posts

  • 0
  • Inquirer
  • Posted

    Oh, I didn´t know that. But then it´s still difficult for me to use this Scene, because a delay for every push notification / every device will make this scene very slow because there are so many devices to check (and honestly I don´t know how and where I have to add this piece of LUA Code). But on the other hand a pop up message instead will be sent to every registered mobile phone although I only want to get a message to the mobile phone where the scene was started (and honestly I don´t know how to change the scene to get pop up messages instead of push notifications

    Please login or register to see this image.

    /emoticons/default_icon_confused.gif" alt=":-?" /> ). This seems to be a big problem for me...

    • 0
    Posted (edited)

    EDIT

    (02/05/2017)

    This is old code. For latest code please check here:

     

    Ok, here is an idea how to check status of all windows and doors manually by pressing RUN button on scene. You will get report with popup message since push messages are not received if you are in app. Still this scene will be also triggered by any door or window when opened/closed and will send you push message which one.

     

    here is the tested code:

    Please login or register to see this code.

    I used your device ID from your source so it should be just copy & paste. EDIT this time.

    Edited by Sankotronic
    • 0
  • Inquirer
  • Posted

    Wow, thank you Sankotronic - that´s great.

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" /> 

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

     

    I just tried it with copy & paste but when I ran it with the Run-Button the debug line Shows "Unexpected symbol near local in line 58" - what does it mean?

    • 0
    Posted (edited)

    There is a comma , in line 57 which needs to be deleted:

    Please login or register to see this code.

    I already corrected it in my previous post. Sorry, thats problem with my copy & paste 

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" />

     

    Also I noticed mistake in line 42 and it should be as follows:

    Please login or register to see this code.

    instead local trigger = fibaro:getSourceTrigger()

     

    also line 45 should be like this:

    Please login or register to see this code.

    This mistakes are also corrected in source code in post above.

    Edited by Sankotronic
    • 0
  • Inquirer
  • Posted

    No Problem - it´s still exciting to get closer to a working solution. I tried copy & paste again now and got a message in the debug, that in line 71 "then" is expected near "=". What could it mean?

    Please login or register to see this image.

    /emoticons/default_icon_eek.gif" alt=":shock:" />

    • 0
    Posted

    Missing one equal sing in line 71:

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    Yes, it works now. But when I start it via Run-Button I got no push notification (or mobile phone) and the Debug Shows "not closed" in the next line "in Küche" but not the device.

    Please login or register to see this image.

    /emoticons/default_icon_neutral.gif" alt=":-|" />

    • 0
    Posted

    Since it is very difficult to just copy and paste parts of code to make it to your wishes and not making mistakes at the end I tested on my HC. Of course since my system is different than yours and my sensors have different ID, and I use some solution from cag014 I still have to change it after testing but it should finally work. Sorry I didn't do that before.

     

    So code is corrected in my previous post.

    • 0
    Posted

    Yes, it works now. But when I start it via Run-Button I got no push notification (or mobile phone) and the Debug Shows "not closed" in the next line "in Küche" but not the device.

    Please login or register to see this image.

    /emoticons/default_icon_neutral.gif" alt=":-|" />

     

    For each door and window you have to write description in their advanced tab under Device description. I wish I know how to get device name, but I don't know except this description. Maybe there is somebody with more knowledge that can help us? Even this

     

    fibaro:getRoomNameByDeviceID()

     

    I found on SIIO web site and not in Fibaro manuals or any other Fibaro website.

    • 0
    Posted (edited)

    Here is also icon for these scene:

     

    Please login or register to see this attachment.

     

     

    Edited by Sankotronic
    Attachment quota filled up / deleting older stuff sorry :-(
    • 0
  • Inquirer
  • Posted

    Thanks I like the icon as well (I searched a lot but I only find questionsmarks etc.). I still only have the problem, that I don´t get push notifications, but now I found a describtion in the script, that I have to create variables too. Maybe this was the problem. How many variables do I need and what name do they need?

    • 0
    Posted

    Thanks I like the icon as well (I searched a lot but I only find questionsmarks etc.). I still only have the problem, that I don´t get push notifications, but now I found a describtion in the script, that I have to create variables too. Maybe this was the problem. How many variables do I need and what name do they need?

     

    I really don't understand your question. Are those ID in properties section from door/windows sensors or not?

    • 0
  • Inquirer
  • Posted

    Sorry - it was my fault. Yes, the values in the upper part of the script behind properties are the door / window sensors. I only wondered that I still didn´t receive a push notification when I start the scene from my desktop. But now I started the Scene from my iOS app and it worked perfectly (and that´s were I wanted it for). Thanks a lot so far!!

     

    (The only problem is now, that I only get a message from the rooms where some devices are still triggered, but not from the name of the device itself...  )

    • 0
    Posted (edited)
    On 6/16/2016 at 4:53 PM, jojo1967 said:

    ...(The only problem is now, that I only get a message from the rooms where some devices are still triggered, but not from the name of the device itself...  )

     

    As I explained two times before. Script is using USER DESCRIPTION for each device (in this case door and window) and this description must be typed in by user (in this case you) on Advanced tab, see picture:

     

    Please login or register to see this attachment.

     

    Enjoy!

    Edited by Sankotronic
    • 0
  • Inquirer
  • Posted

    Yes, now I got it - great! Now it works perfect. Thanks again (to be honest - I didn´t recognize this description field before

    Please login or register to see this image.

    /emoticons/default_icon_cry.gif" alt=":cry:" /> )....

    • 0
    Posted

    Yes, now I got it - great! Now it works perfect. Thanks again (to be honest - I didn´t recognize this description field before

    Please login or register to see this image.

    /emoticons/default_icon_cry.gif" alt=":cry:" /> )....

    No worries, I'm happy that it works ok. If there is anything else I can help with, just ask!

     

    Enjoy!

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