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

Hi @Sankotronic

 

One more question. if I am using the variable sunsettime I assume I need to put it in curly brackets but not double quotes. Is that correct ?

 

Thanks

 

Andy

Link to comment
Share on other sites

  • 0

Hi @Sankotronic,

 

Just thought I'd contribute some simplifications of a couple of your functions. Hope you don't mind. :)

Please login or register to see this code.

Please login or register to see this code.

The simplified time calculation is quite useful in the VD's too.

 

Regards,

Tor Magnus

Edited by Tor Magnus
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 33 minutes ago, andyp said:

    Hi @Sankotronic

     

    One more question. if I am using the variable sunsettime I assume I need to put it in curly brackets but not double quotes. Is that correct ?

     

    Thanks

     

    Andy

    That is correct.

    Link to comment
    Share on other sites

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

    Hi @Sankotronic,

     

    Just thought I'd contribute some simplifications of a couple of your functions. Hope you don't mind. :)

    The simplified time calculation is quite useful in the VD's too.

     

    Regards,

    Tor Magnus

     

    Thank you @Tor Magnus! Will implement in next release!

    Link to comment
    Share on other sites

    • 0

    Hi @Sankotronic,

    I hope you don't mind me sharing a few icons that some users may like to consider if they are using for your VD's

     

    Sunset/Sunrise

    Please login or register to see this attachment.

     

    Main Scene

     

    Please login or register to see this attachment.

    and I use the following one for Timer

     

     

    Please login or register to see this attachment.

    Edited by AutoFrank
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 5 minutes ago, AutoFrank said:

    Hi @Sankotronic,

    I hope you don't mind me sharing a few icons that some users may like to consider if they are using for your VD's

     

    Sunset/Sunrise

    Please login or register to see this attachment.

     

    Main Scene

     

    Please login or register to see this attachment.

    and I use the following one for Timer

     

     

    Please login or register to see this attachment.

    Hi @AutoFrank,

     

    on the contrary, thank you very much for this nice icons! I will use them!

     

    Link to comment
    Share on other sites

    • 0

    Hi,

     

    I have an issue when running the LUA script. I get this error:

    Please login or register to see this code.

    I have added the global variables you mentioned. Any ideas?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 36 minutes ago, remcoploeg said:

    Hi,

     

    I have an issue when running the LUA script. I get this error:

    Please login or register to see this code.

    I have added the global variables you mentioned. Any ideas?

     

    Hi @remcoploeg, you probably used SAVE button in variable panel. After that some of global variables get corrupted due to bug in HC firmware. I refer to global variables that save margin times in format "00:00". After using save button they are destroyed. Cure to this is to delete those variables and recreate them with Sunrise & Sunset VD by clicking on SAVE button while you are on advanced tab of the VD. More info you can find here in this thread because this problem was already discussed.

     

    Link to comment
    Share on other sites

    • 0

    Everything works which is cool, but after few hours the main scene stops working on my HC2 (no active instances). Why is this happening? Is there some sort of a time limit, after which one a scene will stop working?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 10 minutes ago, virgojavier said:

    Everything works which is cool, but after few hours the main scene stops working on my HC2 (no active instances). Why is this happening? Is there some sort of a time limit, after which one a scene will stop working?

    Hi @virgojavier,

     

    your asumption is wrong and based on misunderstandig the obvious purpose of this scene. There is no time limits in a scene that should run endlessly. I can tell you why is this happening if you give me more information like what error was listed in debug window and maybe what you were playing with on your HC before scene stopped workig.

    Link to comment
    Share on other sites

    • 0

    @virgojavier by any chance do you have alarms.  When you first create a scene the default value for "Do not allow alarm to stop scene while alarm is running" will be set to off (no tick), so if an alarm has gone off it will disable the scene.

     

    @Sankotronic thanks again for this great work.

    I've gone through every post in this as well as checking over my setup many times and just have one issue left (I think) that i'm hoping you might be able to point me in the right direction;

    Things I have done/fixed

    1. the 'save' in the variable panel screwed me up.  Deleted them all and re imported the sunrise/sunset and that all fixed.

    2. Changed the capitalisation of line 825 (TimeOfDay: " .. fibaro:getGlobalValue(TimeOfDay)) end)  The global variable in your instructions was "TimeOfDay" whereas the code originally had timeOfDay in the getGlobalValue :)

    3. Have demo mode turned on.

    4. checked about 3 times now my spelling in the global variables I've set, such as Janurary, Feb etc.  Which I had made a number of errors (silly me).  But even though it matches the spelling I keep getting an error at line 150 (see below)

    [DEBUG] 12:57:47: Main scene for time events version 1.2.3 - © 2016 Sankotronic
    [DEBUG] 12:57:47: Day time: 07:59, Night time: 22:44, Time to raise blinds: 06:59
    [DEBUG] 12:57:47: DEMO MODE is turned On! No globals will be changed or scene/VD executed!
    [DEBUG] 12:57:47: line 150: Assertion failed: Expected string

    5. Rebooted the HC2 (just incase it was being cached somewhere.
     

    Any thoughts?

     

    Mobbie.

    Link to comment
    Share on other sites

    • 0

    @mobbie You are the man, can't believe I missed something obvious like this. I still have a lot's to learn.

    @Sankotronic There was no bugs in the log. Everything is working now and I will keep an eye on it. Your piece of work is fantastic. Are you ok with donations? I think your work should ba rewarded:)

    Regards

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 6 hours ago, mobbie said:

    @Sankotronic thanks again for this great work.

    I've gone through every post in this as well as checking over my setup many times and just have one issue left (I think) that i'm hoping you might be able to point me in the right direction;

    Things I have done/fixed

    1. the 'save' in the variable panel screwed me up.  Deleted them all and re imported the sunrise/sunset and that all fixed.

    2. Changed the capitalisation of line 825 (TimeOfDay: " .. fibaro:getGlobalValue(TimeOfDay)) end)  The global variable in your instructions was "TimeOfDay" whereas the code originally had timeOfDay in the getGlobalValue :)

    3. Have demo mode turned on.

    4. checked about 3 times now my spelling in the global variables I've set, such as Janurary, Feb etc.  Which I had made a number of errors (silly me).  But even though it matches the spelling I keep getting an error at line 150 (see below)

    [DEBUG] 12:57:47: Main scene for time events version 1.2.3 - © 2016 Sankotronic
    [DEBUG] 12:57:47: Day time: 07:59, Night time: 22:44, Time to raise blinds: 06:59
    [DEBUG] 12:57:47: DEMO MODE is turned On! No globals will be changed or scene/VD executed!
    [DEBUG] 12:57:47: line 150: Assertion failed: Expected string

    5. Rebooted the HC2 (just incase it was being cached somewhere.
     

    Any thoughts?

     

    Mobbie.

     

    My dear friend @mobbie,

     

    ad 1) already discussed this here in this thread and many others. That is unfortunate part of the HC and Fibaro team should do some corrections

     

    ad 2) If I make mistake in my scenes, then they can't be that trivial! I didn't make mistake with capitalization but you with setting this global variable! You see this part of code:

    Please login or register to see this code.

    As you can see your setting between quotes "TimeOfDay" should reflect your name in variable panel to the letter! If you make typo there it won't work. My timeOfDay is local variable that must contain correct name of your global variable. It is local variable name, not global! So if you change name of this local variable anywhere in the script you will just make things more worst! There is a clear border marked where users should NOT change anything bellow:

    Please login or register to see this code.

    and if ti is not working you should look for mistakes above this lines NOT bellow because I'm testing this scene for months now and I believe that is mostly cleaned from MY bugs. For users bugs I can't be responsible. So I will not comment other points because they are consequence of your doings not mine.

     

    I can only suggest you to take clean copy of this scene and do settings all over again, but this time with reading all my comments carefully and typing your settings carefully and checking 3 times before going to the next settings. Thank you for understanding!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 12/31/2016 at 8:09 AM, virgojavier said:

    @mobbie You are the man, can't believe I missed something obvious like this. I still have a lot's to learn.

    @Sankotronic There was no bugs in the log. Everything is working now and I will keep an eye on it. Your piece of work is fantastic. Are you ok with donations? I think your work should ba rewarded:)

    Regards

    Hi @virgojavier,

     

    There are always something in this window bellow:

     

    As you can see from above picture my Main scene is running happily already for long time! One thing can stop it and it is playing with variable panel and pressing SAVE button there. I have my HC2 now for more than one year and not once I needed to press that button there!

     

    Regarding DONATIONS. I was never thinking really about donations in money. I'm doing this voluntarily because I just like to help people. To me greatest donation is happiness and satisfaction that I can give others and two words in return THANK YOU! Money would just corrupt that so no thank you. I will continue to volunteer here sharing solutions that make my home better in hope that will do same to yours. Cheers!

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

    • 0

    @Sankotronic thanks for explaining that.  That is what I've assumed so far is I've made a spelling mistake somewhere.  

     

    I was questioning the unlikely case that I'd pick up something like that considering how may others and your code/explanations are always spot on, so sorry for that.  Im learning :)

     

    And thanks for the suggestion on refreshing the code now thats a great suggestion.  Its always when you check spelling a few times it starts to look right even though probably wrong.

     

    Mobbie.

    Link to comment
    Share on other sites

    • 0

    @Sankotronic THANK YOU! that worked, I missed adding the variable 'Darkness' as I added all the other variables and never came back to the step to add Darkness.

    Link to comment
    Share on other sites

    • 0

    Good morning all, Happy new year, and hope the hangovers aren't to bad!

     

    I want to switch to this time based scene and leave GEA behind, is there a way to set a variable at a specific time without the need of using a scene or VD?

    I get up much earlier then my wife and kids, my lights work different as long as that var is set to 1. Just before my wife wakes up the var is set back to 0

     

    If this is not possible I'll maybe add a big vd that gets triggered by this scene.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 24 minutes ago, jimicr said:

    Good morning all, Happy new year, and hope the hangovers aren't to bad!

     

    I want to switch to this time based scene and leave GEA behind, is there a way to set a variable at a specific time without the need of using a scene or VD?

    I get up much earlier then my wife and kids, my lights work different as long as that var is set to 1. Just before my wife wakes up the var is set back to 0

     

    If this is not possible I'll maybe add a big vd that gets triggered by this scene.

     

    Good morning @jimicr,

     

    When I was writing this scene there was a plan to add also possibility to just change value of global variable at specified time, but then I leave it out since for all important global variables I use VD to change their value. Besides, since there is possibility to run scenes directly I thought that it is not necessary to have triggering of scenes by changing global variable.  But now when you ask for that option I can see that my thinking was wrong.

     

    There are situations when would be very handy to have possibility to just change value of global variables so I'm going to add this option immediately. As soon as I test it I will update my first post and inform you about that. I believe that scheduled change of global variable should be sufficient.

    Link to comment
    Share on other sites

    • 0

    I don't think your thinking was wrong, you wrote the scene for your needs and our home.

    Everyone has their own idea of a smart home and we just can be greatfull that A) you are sharing and B) add functions to needs of other people.

     

    And of course thanks in advance! 

    Link to comment
    Share on other sites

    • 0

    Hi Sancotronic! I got all running thanks to your exellent guide but I´m not clear about how to schedul scenes....

     

    I was looking through all posts and my first try was this....

     

    -- SCHEDULED SCENES SETUP ------------------------------------------------
    -- here you can setup scenes that will be executed at predefined time of
    -- day in format "00:00". You can set up more than one time during day.
    -- Also you can enter flag for each day of the week when scene will be
    -- executed or not. See more details bellow.
    local runSceneSchedName        = {test}
    -- enter scene IDs that will run at scheduled time separated by comma.
    local runSceneSchedID          = {39};
    -- enter at what time of day will scenes run separated by comma.
    -- You can define more than one time in format "00:00" for one scene
    -- or even use local or global variables like sunsettime or sunrisetime
    -- Example: {{"13:30", "19:20"}, {sunrisetime, "13:00", sunsettime}}
    -- in above example first scene will run at 13:30 and 19:20 while
    -- second scene will run at sunrisetime, 13:00 and at sunsettime
    -- IMPORTANT NOTE - if you use variable to set time then make sure that
    -- you add refreshing of value in function extraUserCodeFirst() like
    -- this for above example:
    -- runSceneSchedHour[2][1] = sunrisetime
    -- runSceneSchedHour[2][3] = sunsettime  where first square brackets
    -- [2] with number inside refers to second scene and second square
    -- brackets [1] with number inside refers to time in order which means
    -- sunrisetime is 1st time [1] for 2nd [2] scene and sunsettime is
    -- 3rd [3] time for 2nd [2] scene in a row added to the variable.
    local runSceneSchedHour        = {{"20:00"}};
    -- enter here flag for each day of the week for scene to run at above
    -- scheduled time. if flag 1 the scene will run and if flag 0 then
    -- will not be run for that day. Remeber, Sunday is first day of the
    -- week on HC2! Example for two scenes:
    -- {{1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0}} - in this example
    -- first scene will run only on Sunday, and second scene will run on
    -- weekdays byt not on weekends (Saturday and Sunday).
    local runSceneSchedWeek        = {1, 1, 1, 1, 1, 1, 1};
    -- enter here flag for sending push message when scene is executed
    -- 1 for sending message, 0 no messages
    local runSceneSchedPushFlag    = {};
    -- enter here message content that will be sent to you when scene is
    -- executed. If above flag is 0 for any of the scenes then just put
    -- empty "" for it.
    local runSceneSchedPushMessage = {};
     

    ...And it gave me this...

     

    Scheduled scene setup error! Missing argument. Scene is stopped.

     

    Then I excluded the quotes... {{20:00}};

     

    And it gave me....

     

    Debug: Line 274: "}" expected near ":"

     

    Next I tested just a pair of brackets {20:00};

     

    ... And it led me to same....

     

    Debug: Line 274: "}" expected near ":"

     

    ... And finally I tsted the last combination I could see. {"20:00"};

     

    Scheduled scene setup error! Missing argument. Scene is stopped.

     

    Now Im a bit Dizzy and cant figure out what I can do more.... Can u help me pleaze?

     

    Happy New Year from Sweden!

     

    Ps. I´m also a little bit curious about that variable "HomeTable"... I saw in your guide that "HomeTable" should be a predefinable variable but in your screenpic over your own variables I can see that u´ve set it up like an ordinary variable... What is right?

    Edited by pettzon
    typo
    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...