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

Converting Scenes to LUA Problem


Valken

Question

Hi,

I need some help please. I had a few scenes that runs to change my variables that looks like this:(I have alot of others too)

Please login or register to see this image.

/files/thumbs/t_capture_580.png" alt="t_capture_580.png" />

Then i converted all to LUA code in HC2 and now they all stopped working? What went wrong or did i do something wrong?

Here is the converted LUA code from the above Block scene:

Please login or register to see this code.

All my scenes was built with the Block scene builder. But in the last few days my HC2 became very slow and unresponsive! Yesterday it completely froze and i had to do a recovery as i could no longer access the HC2 webpage.

I read somewhere (Or at least i think i did) that LUA code is more optimized and dont use so much resorces so i thought i will convert ALL my scenes to LUA..

Ps: I first disabled all my scenes and my HC2 was flying again and that was what brought me to the conclusion of changing the scenes to LUA.

The HC2 is a lot faster again after converting my scenes to LUA but now alot of my scenes dont work anymore and some scenes seem to go crazy.

If someone is willing to have a quick look at my HC2 and just tell me if i am doing it completely wrong or what i should do in future and where to start changing things i will be very greatfull...

I will give remote access to my HC2 if someone is willing to assist.

Thank You

Please login or register to see this attachment.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Am i right to say this scene is to click the button once every one minute for the whole day?

Perhaps you can try using this code?

Please login or register to see this code.

Link to comment
Share on other sites

  • 0

Hi

I think because you disabled the scene before you converted it you are missing the %%autostart at the top in the square brackets.

Brian

Link to comment
Share on other sites

  • 0

Could you explain what you are trying to achieve? The scene looks very complex for what you are trying to achieve. Also, if you have multiple scenes running in parallel, they suck up a lot of ressources. So it might be beneficial to create one scene that runs every minute and have all the different variables you want to update.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Am i right to say this scene is to click the button once every one minute for the whole day?

    Perhaps you can try using this code?

    Please login or register to see this code.

    Hi MalvinYNJ,

    Yes, this scene trigers a virtual (Push button 1) that checks the port on my phone. This then sets the variable to Home or Away. I use this instead of the GPS location in all other scenes to detirmine if i am home or not. (Works much better than GPS; No battery drain on phone)

    [ Added: 2014-05-24, 13:40 ]

    Could you explain what you are trying to achieve? The scene looks very complex for what you are trying to achieve. Also, if you have multiple scenes running in parallel, they suck up a lot of ressources. So it might be beneficial to create one scene that runs every minute and have all the different variables you want to update.

    Hi Dale1985,

    This scene is just to trigers a virtual device(Push button 1) that checks a TCP port on my phone. This then sets the variable to Home or Away. I use this instead of the GPS location in all other scenes to detirmine if i am home or not. (Works much better than GPS; No battery drain on phone)

    I have 4 variables (PresentState/Sleepstate/TimeOfDay/XBMC and 10 scenes to start each variable) that i use for everything etc. Do not turn on lights when its day based on motion (For example i am using the XBMC script to start or fade the lights when a movie starts or pause) this conflics with the lights on motion while watching a movie during the day, so i have to use the other variables to first check if i am watching a movie and if it is night or day.

    Hope this makes sense?

    I am also using the LIGHTS AUTOMATION LUA script by fibaro.rafikel.pl (

    Please login or register to see this link.

    ) to turn on and off all lights by motion sensor and is also based on the time of day and sleepstate variables?

    I can share my HC2 Toolkit data if you like?

    Thank You!

    [ Added: 2014-05-24, 13:48 ]

    Am i right to say this scene is to click the button once every one minute for the whole day?

    Perhaps you can try using this code?

    Please login or register to see this code.

    Hi Guys,

    One more thing: What exactly does the statement : fibaro:sleep(60*1000); mean?

    Does this restart the scene after a certain time or does it cancel the scen once it has run?

    Should you allways add this function at the end of scripts?

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    Hi

    One more thing: What exactly does the statement : fibaro:sleep(60*1000); mean?

    It means, Home Center wait for one minute (in this scene), then do next step (in this scene.

    F.ex.

    If You open the door, turn on the light, wait one minute then turn off the light.

    The time in bracket is in 0,001 second. so 60*1000 = 60000ms that means 60 s that means one minute.

    If fibaro have to wait for f.ex. 26 minute it will be 25*60*1000 so it will be fibaro:sleep(1500000)

    [ Dodano: 2014-05-27, 16:39 ]

    I don't understand in 100% wait You want to do, but first thing I see, is that You should input an "IF" for the day time in scene witch it is necessary, not to create a variable that run every one minute.

    But like I said i'm not exactly sure that I understood You

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Link to comment
    Share on other sites

    • 0

    Hi MalvinYNJ,

    Yes, this scene trigers a virtual (Push button 1) that checks the port on my phone. This then sets the variable to Home or Away. I use this instead of the GPS location in all other scenes to detirmine if i am home or not. (Works much better than GPS; No battery drain on phone)

    Oh I see what you did there. In that case, your fibaro must be working real hard to ping your phone every seconds. Anyway what port did you use to check the port on your phone? Currently, I only can ping my computer to see if it's turn on but for phone, I can't find a proper port to use.

    Thanks.

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