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


  • 3

[SCENE] Main scene FTBE v1.3.4


Sankotronic

Question

Main scene FTBE v 1.3.4

 

Hello everyone!

 

NEW version is OUT!

 

More about scene and download you can find here:

 

WHAT'S NEW:

 

  • Main scene FTBE 1.3.4 - changed function for time of day calculation and added use of SleepState global to set time of day to morning when Awake  regardless of current time
  • Main scene FTBE 1.3.0 - cleaned some bugs, added some more checks to prevent scene from stop running due to errors. Optimized and compacted code, removed unnecessary comments. DemoMode only stops changing timers while user code and scheduled events will continue to execute. Darkness can now be changed by measured lux level or global variable that is set to lux value measured by light measuring devices placed outside. Scene is now running on setTimeout function instead on sleep for better timing and also aligns to 0 seconds or exact minute.
  • Sunrise & Sunset VD v1.4.0 - Modified main loop code to better handle global variables. Variables are now automatically repaired and are not reset to default settings after HC2 reboot. Added variable SunriseIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically.
  • Home Status VD v1.1 - Added variable HomeStatIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically. Added label that shows most important values on VD when closed.
  • Home Timers VD v1.1 - Added variable HomeTimersIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically. Added label that shows most important values on VD when closed.

 

 

Please login or register to see this attachment.

 

 

NOTE - This version is compatible with previous versions so need to do any changes in your current code of other scenes and VD's.

 

REQUEST - If you like my work and found it useful please give me support by rating and writing short review. Thank you! :-)

 

PS

Dear friends from Slovakia you can find this scene and VD translated to your language here: 

Please login or register to see this link.

 

 

Edited by Sankotronic
Updated to new version
  • Like 17
  • Thanks 6
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • In your browser enter this address http://<YOUR HC IP>/docs/  then select iosDevices, click on TRY IT! button and you will get all mobile devices ID that are connected to the HC.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
    12 hours ago, Sankotronic said:

    it happened to me several times same error but in completely different codes. I spent whole day and didn't find any errors in the code. After clicking on run button scene executed without any error any more. There is no bug in the scene cause I tested it on my HC2 before posting here. I don't have explanation what happens but it helps to delete scene LUA code completely from window and then copy code again from downloaded document.

     

     

    I got the same error. Commenting out the following statement resolved the issue.

    Please login or register to see this code.

    I'm not entirely clear on what the content of this global should look like to be honest.

    Edited by Tor Magnus
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 33 minutes ago, Tor Magnus said:

     

     

    I got the same error. Commenting out the following statement resolved the issue.

    Please login or register to see this code.

    I'm not entirely clear on what the content of this global should look like to be honest.

     

    Hi @Tor Magnus

     

    About HomeTable and how it is used check my previous post on this link:

    and under point No 2) is explanation of usage and some links with more information.

     

    I have comment above line with HomeTable to be deleted if not used on your system:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    16 hours ago, WimF said:

    Hi,

     

    while trying to get this code to work I'm learning a lot ( thanks for this).

    but in the main scene I'm getting following error and I don't have a clue of what is happening.

     

    [DEBUG] 19:41:41: line 35: unexpected character @ character: 1 0:1 [t] line:
    [DEBUG] 19:41:41: t

     
     
    hopefully someone can point me in the right direction.
     
     
    thanks

     

    14 hours ago, WimF said:

     

    I've tried to start all over again (3 times) without success. 

    Finally I tried a soft restart of the HC2 and that solved the problem, it seems to be running fine now.

     

    3 hours ago, Tor Magnus said:

     

     

    I got the same error. Commenting out the following statement resolved the issue.

    Please login or register to see this code.

    I'm not entirely clear on what the content of this global should look like to be honest.

     

     

    Unfortunately I did get back the same error  this morning.

    i've commented out the HomeTable (although i have set up the table) and the error disappeared.

     

    Although the home table worked OK if still rebuild it and now the error is gone (again!!) , hope it is now finally solved.

     

     

    Edited by WimF
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi, @WimF,

     

    This line of code

    Please login or register to see this code.

    is just fine since it is present in all my scenes and VDs and they are working perfectly fine. Must be some other problem but I can't point finger since it happened to me only few times until now and scene continue to work after just pressing RUN button without resetting HC, or touching code in any way.

     

    EDIT

    I was curious what is going on with this variable HomeTable so I made check by deleting it. After running code with missing variable I get this error:

    Please login or register to see this code.

    When I created variable but didn't run scene to put table to it then I always get this error:

    Please login or register to see this code.

    After running scene that puts table value in global variable HomeTable then scene start running OK.

    So, it is not enough to just add HomeTable variable to variable panel but you also have to write new scene with all your devices ID and scenes ID and RUN IT to put that table of ID numbers to HomeTable and then it will work OK!!!

     

    How to do that I already explained and above are links to forum threads where you can find that explanation.

    Edited by Sankotronic
    Link to comment
    Share on other sites

    • 0

    Hi @Sankotronic,

     

    I get this error when I start main scene

     

    Please login or register to see this code.

     

    Do you have any idea what could be wrong?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 minute ago, ivan said:

    Hi @Sankotronic,

     

    I get this error when I start main scene

     

    Please login or register to see this code.

     

    Do you have any idea what could be wrong?

    Hi @ivan and welcome to Fibaro forum!

     

    Just delete this lines of code and it will work:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    2 hours ago, Sankotronic said:

    Hi, @WimF,

     

    This line of code

    Please login or register to see this code.

    is just fine since it is present in all my scenes and VDs and they are working perfectly fine. Must be some other problem but I can't point finger since it happened to me only few times until now and scene continue to work after just pressing RUN button without resetting HC, or touching code in any way.

     

    EDIT

    I was curious what is going on with this variable HomeTable so I made check by deleting it. After running code with missing variable I get this error:

    Please login or register to see this code.

    When I created variable but didn't run scene to put table to it then I always get this error:

    Please login or register to see this code.

    After running scene that puts table value in global variable HomeTable then scene start running OK.

    So, it is not enough to just add HomeTable variable to variable panel but you also have to write new scene with all your devices ID and scenes ID and RUN IT to put that table of ID numbers to HomeTable and then it will work OK!!!

     

    How to do that I already explained and above are links to forum threads where you can find that explanation.

     

    @Sankotronic

     

    you are right ( offcourse you are..) theproblem was in my Hometable .

    the funny thing is that i did'nt change anything except adding a debug line at the end and run it.

    after that everything is running perfectly.

     

     

    now i van start understanding how to use iT effectively.

     

    THANKS very much for Your support.

    Link to comment
    Share on other sites

    • 0
    6 hours ago, Sankotronic said:

    Hi @ivan and welcome to Fibaro forum!

     

    Just delete this lines of code and it will work:

    Please login or register to see this code.

     

    Thanks @Sankotronic , now everything is working fine.

    Link to comment
    Share on other sites

    • 0

    [DEBUG] 20:05:41: Main scene for time events version 1.2.2 - © 2016 Sankotronic

    [DEBUG] 20:05:42: line 398: attempt to perform arithmetic on local 'DM' (a nil value)

    [DEBUG] 20:08:49: line 35: unexpected character @ character: 1 0:1 [T] line:

    [DEBUG] 20:08:49: T

    [DEBUG] 20:09:29: Main scene for time events version 1.2.2 - © 2016 Sankotronic

    [DEBUG] 20:09:29: line 398: attempt to perform arithmetic on local 'DM' (a nil value)
     

    was running perfectly well for me and then all of a sudden...

     

    looks like the sunrise/sunset VD has messed itself up.. will delete margin variables and see if that helps.

     

    Link to comment
    Share on other sites

    • 0
    13 hours ago, shaunfrost said:

    [DEBUG] 20:05:41: Main scene for time events version 1.2.2 - © 2016 Sankotronic

    [DEBUG] 20:05:42: line 398: attempt to perform arithmetic on local 'DM' (a nil value)

    [DEBUG] 20:08:49: line 35: unexpected character @ character: 1 0:1 [T] line:

    [DEBUG] 20:08:49: T

    [DEBUG] 20:09:29: Main scene for time events version 1.2.2 - © 2016 Sankotronic

    [DEBUG] 20:09:29: line 398: attempt to perform arithmetic on local 'DM' (a nil value)
     

    was running perfectly well for me and then all of a sudden...

     

    looks like the sunrise/sunset VD has messed itself up.. will delete margin variables and see if that helps.

     

    I've just had the global variables go berserk on this. Not able to enter : into a variable in the interface and some of the variables have lost leading zeros and minutes. Very odd.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 40 minutes ago, Tor Magnus said:

    I've just had the global variables go berserk on this. Not able to enter : into a variable in the interface and some of the variables have lost leading zeros and minutes. Very odd.

    Just read carefully my instructions for installation procedure and follow it to the letter and it will work perfectly. Due to some restrictions that Fibaro implemented in LUA programming of scenes and virtual devices it is necessary to follow installation instructions to the letter otherwise you will face problems. It would be much easier to share solutions if scenes and virtual devices could share some common procedures and variables (especially virtual devices) because then users will have to change their settings only on one place, but since that is not the case it is VERY necessary to follow installation and setup procedure VERY carefully to avoid problems that you have at the moment.

     

    I don't want to repeat myself thousand times over and over for the difficulties that are already explained. Give yourself enough time to read all this thread posts and understand them before any further actions! I have this code running on my HC2 for some time without any problems and I always run code for some time by playing with settings to see if any bug will surface and when everything looks good then I post. So this above errors that you have are purely problems with global variables not set properly most likely because not following latest installation instructions. Please follow installation instructions.  Thank you for understanding!

     

    Link to comment
    Share on other sites

    • 0
    1 hour ago, Sankotronic said:

    Just read carefully my instructions for installation procedure and follow it to the letter and it will work perfectly. Due to some restrictions that Fibaro implemented in LUA programming of scenes and virtual devices it is necessary to follow installation instructions to the letter otherwise you will face problems. It would be much easier to share solutions if scenes and virtual devices could share some common procedures and variables (especially virtual devices) because then users will have to change their settings only on one place, but since that is not the case it is VERY necessary to follow installation and setup procedure VERY carefully to avoid problems that you have at the moment.

     

    I don't want to repeat myself thousand times over and over for the difficulties that are already explained. Give yourself enough time to read all this thread posts and understand them before any further actions! I have this code running on my HC2 for some time without any problems and I always run code for some time by playing with settings to see if any bug will surface and when everything looks good then I post. So this above errors that you have are purely problems with global variables not set properly most likely because not following latest installation instructions. Please follow installation instructions.  Thank you for understanding!

     

    Agreed, and I have rectified my issue, but just for useful feedback.. I DID follow the installation procedure, and it was working beautifully for a few days but then..... I rebooted my HC2 and the margin globals went up the wall, quick deletion and reimport of sunrise VD and everything kicked in..

     

    my wife now thinks the Robot Overlords have take over my house :)

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 40 minutes ago, shaunfrost said:

    Agreed, and I have rectified my issue, but just for useful feedback.. I DID follow the installation procedure, and it was working beautifully for a few days but then..... I rebooted my HC2 and the margin globals went up the wall, quick deletion and reimport of sunrise VD and everything kicked in..

     

    my wife now thinks the Robot Overlords have take over my house :)

     

     

    Forced by your post I just restarted my HC2 and everything came back OK working just fine. But there is one thing that can make everything go mayhem and that is if you press SAVE button on variable panel!! As soon as you change some variable in variable panel and press SAVE button then all variables in upper part of the variable panel that contain values in string format will be DESTROYED and you will have to reinstall all VD that generate global variables automatically such as Sunrise & Sunset or Sonos remote... and some more!

     

    Since changing global variables in global variable panel will not have effect to any scene trigger I provided two more VD "Home status" and "Timers" to be used to change global variable value that are used by this scene.

     

    So thank you for your feedback which actually remind me to mention this REAL problem with using SAVE button in global variable panel.

    To conclude:

     

    REBOOTING HC is NOT DESTROYING global variables stored value!!

     

    USING SAVE BUTTON in global variable panel IS DESTROYING ALL variables in upper part if contain value that is NOT NUMERICAL!

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • UPDATE 1.2.3

     

    New version of Main scene for time base events v1.2.3 and new version of VD Sunrise & Sunset just released! Added location of your HC so that it properly sets seasons depending on your position also added possibility to track users GPS position and calculate their distance from home. First post updated accordingly so please check first post that is updated:

     

    Link to comment
    Share on other sites

    • 0
    49 minutes ago, Sankotronic said:

    USING SAVE BUTTON in global variable panel IS DESTROYING ALL variables in upper part if contain value that is NOT NUMERICAL!

     

    This! That is exactly what happened to me. Good to know I was not going insane. I would suggest putting this in bold at the top of the first post. :)

     

    Like @shaunfrost I had no trouble installing the stuff and it worked fine, but was completely unaware that the save button borked the setup.

    Link to comment
    Share on other sites

    • 0

    @Sankotronic - whats the best way to upgrade the LUA and VD code from one version to the next? 

     

    Users have to set all the language-specific stuff at the top of the LUA scene code - so can we safely copy that over from the old version to the new version?

    Can we just re-import the VD over the top of the old one, or do you need to delete the old version first?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 hour ago, clowg said:

    @Sankotronic - whats the best way to upgrade the LUA and VD code from one version to the next? 

     

    Users have to set all the language-specific stuff at the top of the LUA scene code - so can we safely copy that over from the old version to the new version?

    Can we just re-import the VD over the top of the old one, or do you need to delete the old version first?

    That is a good question. I updated my first post with upgrade procedure so please check. Thank yo for reminding me!

    Link to comment
    Share on other sites

    • 0
    On 12/21/2016 at 1:37 PM, Sankotronic said:

    UPDATE 1.2.3

     

    New version of Main scene for time base events v1.2.3 and new version of VD Sunrise & Sunset just released! Added location of your HC so that it properly sets seasons depending on your position also added possibility to track users GPS position and calculate their distance from home. First post updated accordingly so please check first post that is updated:

     

     

    Hi @Sankotronic

     

    This is an absolutely fantastic solution so well deserved kudos to you.

     

    I took the plunge over the weekend and implemented it as my current (very basic) solution for managing light and day finally gave up the ghost with the loss of my external Lux sensor. ( I also decided to implement cag014 solution for managing device and scene ID's in a global variable so also thanks to Cag014 for that) - never a good idea to have open heart surgery at the same time as brain surgery  but that's another story :-) 

     

    Apart from a few very small issues (mainly between the seat and the keyboard)  it is now up and running and working perfectly. It took a while to get my head around the various options and so far I have integrated the TimeOfDay, Sunset and Sunrise, SleepState and Darkness into my code base. I don't really use time based events but might start looking at this for dead node detection and other periodic system checks.

     

    For the moment It's working very well so thanks again

    -frank

     

     

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