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
  • 1 minute ago, necrosis said:

    @Sankotronic

     

    Maybe due to the new time calculation that has been adjusted couple of pages back?

     

    Screenshot looks good, right?

    Please login or register to see this link.

     

    @necrosis,

     

    Well, you are right, all times look good. Since I'm using completely same code as the posted one and is running for long time without problems, then there must be something in your code. I also setup same times as you on VD and still running without errors. You can send me scene code to my PM to check.

    Link to comment
    Share on other sites

    • 0

    Hi @Sankotronic,

     

    Is this possible?:

    set global "SleepState", "Awake", "06:45" "weekdays",  "08:00" "weekend"?

    At the moment I have declared sleepstate twice, one for weekdays and one for the weekend. Was wondering if it's possible in one go.

     

    To make things easier for myself I've added this to the scene:

    Please login or register to see this code.

    Because I usually add a number to much or to little and run into all kinds off errors :)

    Link to comment
    Share on other sites

    • 0

    @Sankotronic,

     

    Your "Main scene for time based events control" is great project. I appreciate and thank you very much for this.

     

    After two days of (little) frustrations I made it working. I love the clean approach you made for the timers concept.

     

    The delay and "frustration" was caused by first creating manually the variables and pressing "save" while in the Variables Panel of HC2.

    When I read later posts carefully I corrected it quickly.

     

    You well deserved good beer from my end   :)

     

     

     

     

     

    Link to comment
    Share on other sites

    • 0
    Guest fstae

    Hello, I have a question: In the VD "Sunrise & Sunset v1.2" I have changed  the beginning of the time night, as you can see from the second
    screenshot . The scene has adopted the change, but after one minute the scene sets the beginning of the night time to the time of the sunset (first screenshot). What is wrong?

    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 @Sankotronic

     

    Quick syntax check with you

     

    I am looking to run a scene at time.

     

    If I put a time into line 282 (as below) it all works fine

    local runSceneSchedHour        = {{"06:30"},{"07:55"}};

     

    executing the following

    local runSceneSchedName        = {"good morning sequence","Sunrise Light"}; -- line 263

    local runSceneSchedID          = {jT.scene.goodMorning,jT.scene.SunriseLight}; -- line 265

     

    I want to pull it from a global variable so I added in the "own code" section (after line 416) I added

    local wakeup_time = tonumber(fibaro:getGlobalValue("WakeUp_time"))

     

    and then adjust the schedule hour (line 282)

    local runSceneSchedHour        = {{"wakeup_time"},{"07:55"}};

     

    .. but it doesn't execute 

    I thought the syntax around wakeup_time should have been

    local runSceneSchedHour        = {{wakeup_time},{"07:55"}}; or

    local runSceneSchedHour        = {wakeup_time,{"07:55"}}; 

     

    but the scene won't save error free

     

    any idea ?

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 4 hours ago, fstae said:

    Hello, I have a question: In the VD "Sunrise & Sunset v1.2" I have changed  the beginning of the time night, as you can see from the second
    screenshot . The scene has adopted the change, but after one minute the scene sets the beginning of the night time to the time of the sunset (first screenshot). What is wrong?

     

     

    Hi @fstae,

     

    Can you please check to what value is set global variable SleepState? I know it was set to Sleep and that is why TimeOfDay jumped from Day to Night. Do you have VD or scene that is taking care of global variable SleepState?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 4 hours ago, AutoFrank said:

    Hi @Sankotronic

     

    Quick syntax check with you

     

    I am looking to run a scene at time.

     

    If I put a time into line 282 (as below) it all works fine

    local runSceneSchedHour        = {{"06:30"},{"07:55"}};

     

    executing the following

    local runSceneSchedName        = {"good morning sequence","Sunrise Light"}; -- line 263

    local runSceneSchedID          = {jT.scene.goodMorning,jT.scene.SunriseLight}; -- line 265

     

    I want to pull it from a global variable so I added in the "own code" section (after line 416) I added

    local wakeup_time = tonumber(fibaro:getGlobalValue("WakeUp_time"))

     

    and then adjust the schedule hour (line 282)

    local runSceneSchedHour        = {{"wakeup_time"},{"07:55"}};

     

    .. but it doesn't execute 

    I thought the syntax around wakeup_time should have been

    local runSceneSchedHour        = {{wakeup_time},{"07:55"}}; or

    local runSceneSchedHour        = {wakeup_time,{"07:55"}}; 

     

    but the scene won't save error free

     

    any idea ?

     

     

     

    Hi @AutoFrank,

     

    First you need to declare local variable under section -- LOCAL VARIABLES DEFINITIONS ---- like this:

    Please login or register to see this code.

    Then you need to add this line to function extraUserCodeFirst():

    Please login or register to see this code.

    Now you can use this variable to run scheduled action. In your case you can define like this:

    Please login or register to see this code.

    Of course wakeup_time must be formatted as "00:00".

     

    Link to comment
    Share on other sites

    • 0

    Good afternoon @Sankotronic,

     

    I'm trying to make the most of your scenes and want to rewrite my alarm scenes. I use the main scene for time based events and all it's vd's.

    Do you use globals to trigger your alarm scenes? like set global disarming and a scene is triggered by that global?

    I have a rfid keypad to arm and disarm I am wondering if I can use that to set a global to run a scene that disarms the alarm.

     

    Thanks for your time!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 32 minutes ago, fstae said:

    Hi @Sankotronic

     

    now TimeOfDay=night and SleepState=awake! 

     

    The global variable SleepState is changed by a scene.

     

     

    @fstae,

     

    That just cannot be except if you wrongly mapped SleepState global variable? Check your settings again. it should be like this:

    Please login or register to see this code.

    In above example global variable SleepState has two values "Spava" for sleep and "Budan" for awake.

    Link to comment
    Share on other sites

    • 0

    @Sankotronic, I have checked your scene and goind to put it in my HC - thank you for great work!

     

    I`m on 4.110 and have problem in first step "Please first download "Sunrise & Sunset" VD and import to your HC. " Duing VD import I have popup with "403 Forbidded Access" error.

    Any idea what to do? :)

     

    Right now I`m trying using remote access.

     

     

     

     

    Edited by Bezan
    Link to comment
    Share on other sites

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

    Good afternoon @Sankotronic,

     

    I'm trying to make the most of your scenes and want to rewrite my alarm scenes. I use the main scene for time based events and all it's vd's.

    Do you use globals to trigger your alarm scenes? like set global disarming and a scene is triggered by that global?

    I have a rfid keypad to arm and disarm I am wondering if I can use that to set a global to run a scene that disarms the alarm.

     

    Thanks for your time!

     

    @jimicr,

     

    For arming and disarming alarm I use scenes that are called from another scenes so I don't use global variables to trigger them. 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 48 minutes ago, Bezan said:

    @Sankotronic, I have checked your scene and goind to put it in my HC - thank you for great work!

     

    I`m on 4.110 and have problem in first step "Please first download "Sunrise & Sunset" VD and import to your HC. " Duing VD import I have popup with "403 Forbidded Access" error.

    Any idea what to do? :)

     

    Right now I`m trying using remote access.

     

     

    Hi @Bezan,

     

    I am also on 4.110 and just imported one VD successfully but I'm connected locally as superuser. It is possible that you are getting "403 Forbidden Access" error because you are not logged in as superuser or because you are logged in remotely. Can you try to import VD when you are connected to HC locally?

     

    Link to comment
    Share on other sites

    • 0
    4 hours ago, Sankotronic said:

     

    Hi @AutoFrank,

     

    First you need to declare local variable under section -- LOCAL VARIABLES DEFINITIONS ---- like this:

    Please login or register to see this code.

    Then you need to add this line to function extraUserCodeFirst():

    Please login or register to see this code.

    Now you can use this variable to run scheduled action. In your case you can define like this:

    Please login or register to see this code.

    Of course wakeup_time must be formatted as "00:00".

     

     

    Hi @Sankotronic

     

    Quick syntax check with you

     

    I am looking to run a scene at time.

     

    If I put a time into line 282 (as below) it all works fine

    local runSceneSchedHour        = {{"06:30"},{"07:55"}};

     

    executing the following

    local runSceneSchedName        = {"good morning sequence","Sunrise Light"}; -- line 263

    local runSceneSchedID          = {jT.scene.goodMorning,jT.scene.SunriseLight}; -- line 265

     

    I want to pull it from a global variable so I added in the "own code" section (after line 416) I added

    local wakeup_time = tonumber(fibaro:getGlobalValue("WakeUp_time"))

     

    and then adjust the schedule hour (line 282)

    local runSceneSchedHour        = {{"wakeup_time"},{"07:55"}};

     

    .. but it doesn't execute 

    I thought the syntax around wakeup_time should have been

    local runSceneSchedHour        = {{wakeup_time},{"07:55"}}; or

    local runSceneSchedHour        = {wakeup_time,{"07:55"}}; 

     

    but the scene won't save error free

     

    any idea ?

     

    =============================================================

     

    Hi @Sankotronic

    I defined the variable and spent the last hour trying to debug but I cant seem to get it working 

    Would you mind giving it the once over (sorry, it's prob some thing stupid :-( but I cant seem to see it.)

     

    If I replace the second wakeup_time on line284 with an actual time it works

    the global variable is in the format 00:00 and can be read back okay

    Do I need to declare the format some where

    I added 419 as extra code to get the global variable value

     

    thanks

    -f

     

    my code is below.. 

     

    Please login or register to see this code.

     

    Edited by AutoFrank
    Link to comment
    Share on other sites

    • 0
    1 hour ago, Sankotronic said:

     

    @jimicr,

     

    For arming and disarming alarm I use scenes that are called from another scenes so I don't use global variables to trigger them. 

    Okay thanks, your VD threw me off a littel :)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @AutoFrank

     

    You declared wakeup_time as table:

    Please login or register to see this code.

    and it should be declared as string (see my previous post):

    Please login or register to see this code.

    Also you don't need to use tostring function when reading global variable since that function always gives string, so instead of:

    Please login or register to see this code.

    it is ok to write as:

    Please login or register to see this code.

    The rest is ok. If you want to try with table then you should do like this:

    Please login or register to see this code.

    I didn't try this way with declaring local table variable but it might work. Just copy and paste, don't change what I suggested! :) 

    Oh, and when you use table then you have to tell LUA to which position in table to store value thats why there are square brackets with number of position [1] in table.

     

    Edited by Sankotronic
    Link to comment
    Share on other sites

    • 0
    48 minutes ago, Sankotronic said:

     

    Hi @Bezan,

     

    I am also on 4.110 and just imported one VD successfully but I'm connected locally as superuser. It is possible that you are getting "403 Forbidden Access" error because you are not logged in as superuser or because you are logged in remotely. Can you try to import VD when you are connected to HC locally?

     

     

    The only account is superuser. Tomorrow will try locally.

     

     

    Link to comment
    Share on other sites

    • 0
    Guest fstae

    Hi @Sankotronic

     

    I have checked the variable and everything is ok. But it doesn't work, I don´t know why. Now I have changed your code, so that the variable SleepState isn´t necessary for checking the variable TimeOfDay. Now it's working!

    Thanks for your time and great scenes!!!!

    Link to comment
    Share on other sites

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

    Hi @Sankotronic

     

    I have checked the variable and everything is ok. But it doesn't work, I don´t know why. Now I have changed your code, so that the variable SleepState isn´t necessary for checking the variable TimeOfDay. Now it's working!

    Thanks for your time and great scenes!!!!

     

    @fstae,

     

    Still something was not ok with SleepState since I use it and I don't have that problem with same scene code. But it is important that you found solution and that it is working now as expected!!

     

    Enjoy coding! :) 

    Link to comment
    Share on other sites

    • 0
    Guest fstae

    I think so, too. In the next days I will try to find a solution for the problem!!!

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