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 16
  • Thanks 6
Link to comment
Share on other sites

Recommended Posts

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

    So in your setup you have to remember to push the away button when you leave your house to set global variable.

    It is enough to say that our situation does not require us to change those variables every day but just once a month due to the nature of our jobs.

    Link to comment
    Share on other sites

    • 0

    I appear to have done something a little wrong with the VD sunrise and sunset..

    I am sure it was working last night, but now some of the margins and timetoday/night are missing  minutes..

    Any ideas how I messed this up? maybe the Global Variables are supposed to be Predefined Globals? I presume not...

    oh, and in the Christmas spirit, if you happen to have an alarm scene ;)

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

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

    I appear to have done something a little wrong with the VD sunrise and sunset..

    I am sure it was working last night, but now some of the margins and timetoday/night are missing  minutes..

    Any ideas how I messed this up? maybe the Global Variables are supposed to be Predefined Globals? I presume not...

    oh, and in the Christmas spirit, if you happen to have an alarm scene ;)

     

     

    Hi @shaunfrost,

     

    Please check first in code of all buttons and main loop that you properly named global variables. Then you can delete and recreate MarginNight global variable with default value 0. Then go again to Sunrise & Sunset VD and before changing sunrise and sunset time change Time to Night and it should be ok.

     

    It is my mistake because I didn't add format check for MarginDay and MarginNight in Sunrise and Sunset time buttons. It is only important at first time change, after that is ok.

    I will correct that bug and post new "Sunrise & Sunset" VD but you don't need to update.

     

    EDIT

    I have many solutions but still need to work on them. By Alarm scene what do you refer to? Scene to arm/disarm alarm?

    Edited by Sankotronic
    Link to comment
    Share on other sites

    • 0

    Hi.

     

    I'm trying to use this scene but being new to LUA (and Fibaro) I'm not getting very far. So far I have setup the Global and Predefined Global variables. I've run the Sunrise/Sunset VD and then tried to run this scene. I keep getting the following error:

     

    Error Line 150: Assertion failed: expected string.

     

    Line 150 is this:

     

    Line 147           local weekDayMapping      = {Sunday    ="Sunday",
    Line 148                                                         Monday    ="Monday",
    Line 149                                                        Tuesday   ="Tuesday",
    Line 150                                               Wednesday ="Wednesday",

     

     

    Can you help please, I expect this wont be the last unfortunately :(

    Please login or register to see this attachment.

    Edited by Bash
    Add Picture
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • UPDATE

     

    I realize what problems you are facing with installation of this VD's and scene so I made modifications. Please read my first post that is updated and reinstall scene and VD as necessary. Sorry for any inconvenience and thank you for you're understanding!

     

    Please go to first post that is updated:

     

    Link to comment
    Share on other sites

    • 0

    @Sankotronic No need to apologise, you're helping a lot of people with your code and support. Thank you for your continued efforts, I for one definitely appreciate it. 

    Link to comment
    Share on other sites

    • 0

    Got it up and running, and it really works as hoped, thanks.

     

    Two questions:

    1) Can you please share your SyncTime code

    2) I think I understand your thoughts with HomeTable, but I'm not sure I understand how you define the values in that table. Is it manually defined or the HC create the table for you?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @rasmusaabo,

     

    1) Sync time is developed by @Krikroff and you can find more about this VD here: 

    Link to download VD will take you to French forum where you need to create account and leave introduction post and then you will be able to download it.

     

    2) HomeTable you have to create yourself. First you need to add predefined global variable (lower pane on variable panel) and give it some name like "jsonTable" or "HomeTable" and rename first value to table and leave Value 2 as it is since it is not possible to delete it when you adding variable. Save global variable and then open it again to edit. Now you can delete Value 2 and leave only table. The rest of the story you can find here:

    or here:

     

    This feature greatly reduces time needed to correct code if some of the devices where excluded and included back with other device ID because then you only need to correct device ID in scene headers under %% properties. 

    Link to comment
    Share on other sites

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

    thanks @Sankotronic. Just to be sure that I understand it correct. Very time you make a new VD you update the scene and run it to set the table values?

    Yes that is correct. Whenever you add scene or VD or new device and want to have their ID in the table or re-include old device you need to update scene and save to run it.

    Link to comment
    Share on other sites

    • 0

    Hey, I am getting this in scene:

     


    [DEBUG] 15:57:18: line 399: attempt to perform arithmetic on local 'DM' (a nil value)

    I am almost sure it is related to sunset sunrise VD, check the picture.

     

    In Variable panel it looks like the VD can not use the ":" and that seems to be the issue in my opinion. Strange enough it is possible for sunset and sunrise time.

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

     

    Edit: I think it helped to delete the sunset VD, all the variables and add it again. I did it 3 times, so lets see how long it will work

    Edited by HomeSystem.sk
    solved?
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @HomeSystem.sk,

     

    Problem is in missing semicolon in some of the global variables. Did you generate this variables with new version of Sunrise & Sunset VD or they are from before? Last version of S&S VD I tested in way that I deleted all global variables and then imported VD. It worked fine on my HC with 4.100 firmware. Here are all my global variables:

     

     

    Edited by Sankotronic
    Attachment quota filled up / deleting older stuff sorry :-(
    Link to comment
    Share on other sites

    • 0

    Yes I thought so, I got them created by this version of the VD, I did not have them before. Strainge thing is that on the third attempt it works. I m on 4.102 beta, maybe that was the reason.

    But as I said, 2x deleting them all and the VD and doing it over again helped.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Just now, HomeSystem.sk said:

    Yes I thought so, I got them created by this version of the VD, I did not have them before. Strainge thing is that on the third attempt it works. I m on 4.102 beta, maybe that was the reason.

    But as I said, 2x deleting them all and the VD and doing it over again helped.

    That is interesting. I succeeded on first attempt on 4.100. I will skip betas for now and will test again when final release came out.

    Link to comment
    Share on other sites

    • 0

    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
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 hour 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

    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.

    Link to comment
    Share on other sites

    • 0

    OK , Thanks.

    I'm going to try that.

     

    and Thanks you again for making this code available.

    Link to comment
    Share on other sites

    • 0
    53 minutes 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'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.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 13 minutes 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.

    I'm happy that you solved the problem and it is good to know that restart can help in case of this strange error.

    Link to comment
    Share on other sites

    • 0

    @Sankotronic - how do you find the Fibaro ID of the iOS devices (iPhone/iPad).  I see them listed on the 'Users' page, but the ID isn't obvious.

     

    I have got your scenes & VD in place now.

     

    Cheers,

    G.

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