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
  • 4 hours ago, oceank said:

    Hello again!

     

    I got som help yesterday regarding changing of SleepState with this:

     

    I do this using the SCHEDULED GLOBAL VARIABLE CHANGE SETUP section. 

    local chgGlobalSchedName   = {"SleepState"};
    local chgGlobalValue       = {{"Awake", "Sleep"}};
    local chgGlobalHour        = {{"07:00", "23:55"}};
    local chgGlobalWeek        = {{1, 1, 1, 1, 1, 1, 1}}; 

     

    But this morning nothing happend to my SleepState, anything else I should change or do? I have the global variable SleepState with "Awake and Sleep"

     

    Hi @oceank,

     

    this setting should work:

    Please login or register to see this code.

    If still not working then can you please post here screenshot of debug window from time when global variable change should happen.

    Link to comment
    Share on other sites

    • 0
    9 minutes ago, Sankotronic said:

     

    Hi @oceank,

     

    this setting should work:

    Please login or register to see this code.

    If still not working then can you please post here screenshot of debug window from time when global variable change should happen.

     

     

    I Will try when I get home. Thank for the feedback! 

     

    Morning, day, evening and night workes like a charm! 

     

    I'll be back with a screenshot

    Link to comment
    Share on other sites

    • 0

     

    Sunrise & sunset module, I think I still need som help with that because I get wrong settinsg for when its evening and night.

     

    Sunrise is at 08:09

    difference:0

    you want at 08:09, does this mean its TimeOfDay = Morning?

     

    Sunset is at 1641:

    difference :0

    you want at 16:41, does this mean its TimeOfDay = Evening?

     

    Time to Day 03:49, what does this mean?

    Day starts at 11:58, does that mean TimeOfDay = Day at 12:00??

     

    Time to Night says 0600,or does this mean night starts at 06:00?? 

    Night starts at 22:41,  does that mean night starts at 22:41? I cant change this so Night is at 00:00??, maximum I can set is 23:40 ???

     

     

     

    sorry beeing so newbie =( Im so confused

    Edited by oceank
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @oceank,

    34 minutes ago, oceank said:

    Sunrise is at 08:09

    difference:0

    you want at 08:09, does this mean its TimeOfDay = Morning?

    Yes that is correct

     

    35 minutes ago, oceank said:

    Sunset is at 1641:

    difference :0

    you want at 16:41, does this mean its TimeOfDay = Evening?

    Yes, that is also correct!

     

    35 minutes ago, oceank said:

    Time to Day 03:49, what does this mean?

    Day starts at 11:58, does that mean TimeOfDay = Day at 12:00??

    If sunrise is at 08:09h and time to day is set to 02:00 then 08:09 + 02:00 = 10:09, so Day will start at 10:09h (TimeOfDay will be set to Day at 10:09h)

     

    38 minutes ago, oceank said:

    Time to Night says 0600,or does this mean night starts at 06:00?? 

    Night starts at 22:41,  does that mean night starts at 22:41? I cant change this so Night is at 00:00??, maximum I can set is 23:40 ???

    Time to Night is set to 06:00 and that means that Night will start 6 hours after sunset time. If sunset is at 16:41 and time to Night is set to 06:00 then 16:41 + 06:00 = 22:41 so TimeOfDay will be set to Night at 22:41h.

    So, time to Day defines how long Morning will last before it changes to Day time and time to Night defines how long will Evening last before it changes to Night.

     

    Link to comment
    Share on other sites

    • 0
    19 hours ago, clowg said:
    34 minutes ago, Sankotronic said:

    Hi @oceank,

    Yes that is correct

     

    Yes, that is also correct!

     

    If sunrise is at 08:09h and time to day is set to 02:00 then 08:09 + 02:00 = 10:09, so Day will start at 10:09h (TimeOfDay will be set to Day at 10:09h)

     

    Time to Night is set to 06:00 and that means that Night will start 6 hours after sunset time. If sunset is at 16:41 and time to Night is set to 06:00 then 16:41 + 06:00 = 22:41 so TimeOfDay will be set to Night at 22:41h.

    So, time to Day defines how long Morning will last before it changes to Day time and time to Night defines how long will Evening last before it changes to Night.

     

    Now it makes sense, cool thanx!, but maximum time to night is only 6h why is that? because it says sunset 16:41 +6 will be 22:41, I would like this to be 24:00 = Night,  can I do that somehow?

     

    Link to comment
    Share on other sites

    • 0

    I have som more questions regarding 1x fibaro wall plugg. I have a heatingfan connected to a fibaro wallplugg. I would like this to start at 06:00 to 07:00 weekdays only, how would I set that upp in this scene for time based events?

     

    In what section do I do this?

    Edited by oceank
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 30 minutes ago, oceank said:

    I have som more questions regarding 1x fibaro wall plugg. I have a heatingfan connected to a fibaro wallplugg. I would like this to start at 06:00 to 07:00 weekdays only, how would I set that upp in this scene for time based events?

     

     

     

    Hi @oceank,

     

    In this version scene can start other scene, press button on virtual device and change value of global variable, but can't control devices directly. You are first who asked for this feature and I can add it in next release.

     

    For now, you will need to make either scene or VD which turns On/Off that smart plug and then you can setup Main scene to either start scene or press button on VD.

    Link to comment
    Share on other sites

    • 0
    20 hours ago, clowg said:

    This is a 'temporary' work around until we get the formal release of @Sankotronic's virtual device/scene for managing the 'wake up' & 'go to sleep' events that integrates with this scene and others l

    14 minutes ago, Sankotronic said:

     

    Hi @oceank,

     

    In this version scene can start other scene, press button on virtual device and change value of global variable, but can't control devices directly. You are first who asked for this feature and I can add it in next release.

     

    For now, you will need to make either scene or VD which turns On/Off that smart plug and then you can setup Main scene to either start scene or press button on VD.

    I see! I used to use Lua scheduler and thats why I as asking for this. In Lua scheduler it could start the fibaro wall plugg at any given time/weekday/weekend and so on. I really like your master script and I want to use it instead. I would rather have everything in one place instead of making many small scenes and VDs. Hope you will have this function in the future =)

    GREAT work!

    Link to comment
    Share on other sites

    • 0
    4 hours ago, Sankotronic said:

     

    Hi @oceank,

     

    this setting should work:

    Please login or register to see this code.

    If still not working then can you please post here screenshot of debug window from time when global variable change should happen.

    Ok so I tryed again but no changed in SleepState:

     

     Main scene for time events version 1.2.5 - © 2016 Sankotronic
    [DEBUG] 21:32:12: Day time: 12:00, Night time: 23:40, Time to raise blinds: 13:09
    [DEBUG] 21:32:12: kimxxxx distance from home is: 650890.69435764 meters
    [DEBUG] 21:32:12: Time of day set to: Evening - Day of week is Thursday
    [DEBUG] 21:32:13: Season is Winter, Month is February
    [DEBUG] 21:32:13: Darkness: 1 Sunset: 16:41 (set:17:40) Sunrise: 08:09 (set:08:09) TimeOfDay: Evening
    [DEBUG] 21:33:13: Day time: 12:00, Night time: 23:40, Time to raise blinds: 13:09
    [DEBUG] 21:33:13: kimxxxx distance from home is: 650890.69435764 meters
    [DEBUG] 21:33:13: Time of day set to: Evening - Day of week is Thursday
    [DEBUG] 21:33:13: Season is Winter, Month is February
    [DEBUG] 21:33:13: Darkness: 1 Sunset: 16:41 (set:17:40) Sunrise: 08:09 (set:08:09) TimeOfDay: Evening
    [DEBUG] 21:34:13: Day time: 12:00, Night time: 23:40, Time to raise blinds: 13:09
    [DEBUG] 21:34:13: kimxxxx distance from home is: 650890.69435764 meters
    [DEBUG] 21:34:13: Time of day set to: Evening - Day of week is Thursday
    [DEBUG] 21:34:13: Season is Winter, Month is February
    [DEBUG] 21:34:13: Darkness: 1 Sunset: 16:41 (set:17:40) Sunrise: 08:09 (set:08:09) TimeOfDay: Evening
    [DEBUG] 21:35:13: Day time: 12:00, Night time: 23:40, Time to raise blinds: 13:09
    [DEBUG] 21:35:13: kimxxxx distance from home is: 650890.69435764 meters
    [DEBUG] 21:35:13: Time of day set to: Evening - Day of week is Thursday
    [DEBUG] 21:35:13: Season is Winter, Month is February
    [DEBUG] 21:35:13: Darkness: 1 Sunset: 16:41 (set:17:40) Sunrise: 08:09 (set:08:09) TimeOfDay: Evening

     

     

    this is my settings:

     

    local chgGlobalSchedName   = {SleepState};
    -- enter here what value will be set to global variable for each time that
    -- is entered bellow
    local chgGlobalValue       = {{"Awake", "Sleep"}};
    -- enter at what time of day will global value change separated by comma.
    -- You can define more than one time in format "00:00" for one VD
    -- or even use local or global variables like sunsettime or sunrisetime
    -- Example: {{"13:30", "19:20"}, {sunrisetime, "13:00", sunsettime}}
    -- in above example first global variable value will be changed at 13:30
    -- and another value at 19:20 while second global variable value will be
    -- changed at sunrisetime, 13:00 and at sunsettime
    local chgGlobalHour        = {{"07:00", "21:34"}};
    -- enter here flag for each day of the week for VD to press button
    -- at above scheduled time. if flag 1 the VD button will be pressed and
    -- if flag 0 then will not be pressed for that day. Remeber, Sunday is
    -- first day of the week on HC2! Example for two VDs:
    -- {{1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0}} - in this example
    -- first VDs button will be pressed only on Sunday, and second VDs
    -- button will be pressed on weekdays but not on weekends (Saturday
    -- and Sunday).
    local chgGlobalWeek        = {{1, 1, 1, 1, 1, 1, 1}};
    -- enter here flag for sending push message when VD buttons is pressed
    -- 1 for sending message, 0 no messages
    local chgGlobalPushFlag    = {0};
    -- enter here message content that will be sent to you when VD is
    -- executed. If above flag is 0 for any of the VDs then just put
    -- empty "" for it.
    local chgGlobalPushMessage = {};

     

     

     

    what am I doing wrong herre, looks like it just ignores it? I had  sleep to 21:34 fo testing and nothing happens as seen in the log. Or do I have to set anything so it presses some buttons in a vd?

    Edited by oceank
    Link to comment
    Share on other sites

    • 0

    It looks like you are missing the quotes around SleepState on the first line.

    Link to comment
    Share on other sites

    • 0
    2 minutes ago, clowg said:

    It looks like you are missing the quotes around SleepState on the first line.

    So I changed it to this: 

    Please login or register to see this code.

    then I get:

     

    [DEBUG] 21:53:54: Main scene for time events version 1.2.5 - © 2016 Sankotronic
    [DEBUG] 21:53:54: Scheduled global variable setup error! Missing argument. Please check. Scene is stopped!

    Link to comment
    Share on other sites

    • 0
    Guest fstae

    ... and the qotes in the last line: 

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    1 minute ago, fstae said:

    ... and the qotes in the last line: 

    Please login or register to see this code.

    BINGO!

     

     

    thanx man! Im such a newbie to this!

    Link to comment
    Share on other sites

    • 0

    Ive been meaning to ask - has anyone got the chgGlobalPushMessage to work?

     

    I have defined it, but never get a message on my iPhone.  I realise I don't know how the connection is made between the message settings in Main Scene, and my particular iOS device.

    Link to comment
    Share on other sites

    • 0
    19 hours ago, Sankotronic said:

     

    Hi @zaanhoeve,

     

    I can see from your picture that global variable TimeOfDay is defined in upper part of variable panel and has value 0 (zero). You need to define this global variable in lower part of variable panel where are predefined variables and with this four values: Morning, Day, Evening and Night. You can also give values in your language but then you need to map your values to english values in scene.

    [DEBUG] 11:55:24: Main scene for time events version 1.2.5 - © 2016 Sankotronic
    [DEBUG] 11:55:24: Day time: 10:09, Night time: 20:22, Time to raise blinds: 13:09
    [DEBUG] 11:55:24: DEMO MODE is turned On! No globals will be changed or scene/VD executed!
    [DEBUG] 11:55:24: line 924: attempt to concatenate a nil value

     

    Still the same problem after edit. I will keep it in English till it's working.

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    Hello @Sankotronic

    I did delete the scene, VD sunrise and emptied all data except the table for Hometable. (see picture)

    running hometable gives no errors (see picture)

    added Sunrise_&_Sunset_v1.3.1.vfib changed room and added ip from FHC en port 80

    added scene with config (see picture MSFT)

    and still the same problem:

    [DEBUG] 11:22:27: Main scene for time events version 1.2.5 - © 2016 Sankotronic
    [DEBUG] 11:22:27: Day time: 10:07, Night time: 20:24, Time to raise blinds: 13:07
    [DEBUG] 11:22:27: DEMO MODE is turned On! No globals will be changed or scene/VD executed!
    [DEBUG] 11:22:27: line 924: attempt to concatenate a nil value

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    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
  • Inquirer
  • Hi @zaanhoeve,

     

    Please check that you declared properly TimeOfDay global variable on this two lines (it is case sensitive so be careful with capital and small letters):

    Please login or register to see this code.

    Also I hope that you didn't change line where you have error! It must be like this:

    Please login or register to see this code.

    This scene is  working if global variables are properly defined. Most of them are defined by VD Sunrise & Sunset so there can't be mistake. Few other that user have to make you must be careful with capital and small letters and do exactly as explained in my first post.

     

    From your picture you are missing following global variables:

    2) Darkness - global variable (upper part of variable panel) with possible values 0 for day time (Light) and 1 for night time (Dark). Value is changed at adjusted time for sunrise and sunset time. This variable is also used in "Very Smart Lights"™ scene.

    3) WeekDay - is predefined global variable (lower part of variable panel) possible values are name of days in your language with possibility to map names so no need to change scene code. This can be used to display week day on tablet controller or even use for triggering some events that must happen at midnight of each or some days of the week.

    4) Month - is predefined global variable (lower part of variable panel) possible values are names of months in your language with possibility to map names so no need to dig into scene code.

    5) SeasonState - is predefined global variable (lower part of variable panel) possible values are names of four seasons in your language with possibility to map names.

     

    Also this global variable must be defined in global variable panel or you can map your existing global variable to this one in scene code:

    6) "SleepState" - is predefined global variable (lower part of variable panel) with values "Awake", "Sleep" or values in your language that you can map in scene code. Value is changed by other scenes or VD

     

    This scene will not work properly without them so can you please add them to variable panel as explained in my first post.

    Link to comment
    Share on other sites

    • 0

    I did no change in the Lua code before. So did not do it now.

     

    Added "Darkness", run debug and works now.

    [DEBUG] 16:35:34: Main scene for time events version 1.2.5 - © 2016 Sankotronic
    [DEBUG] 16:35:34: Day time: 10:07, Night time: 20:24, Time to raise blinds: 13:07
    [DEBUG] 16:35:34: DEMO MODE is turned On! No globals will be changed or scene/VD executed!
    [DEBUG] 16:35:34: Darkness: 0 Sunset: 17:24 (set:17:24) Sunrise: 08:07 (set:08:07) TimeOfDay: Morning

     

    Added the other variables. Why where they not added? not in VD during install? because i did not read it in any install text.

     

    edit: grin it's the next line of text after i did crash :oops:

     

    tnx for helping. tomorrow next step.

    Edited by zaanhoeve
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 47 minutes ago, zaanhoeve said:

    Added the other variables. Why where they not added? not in VD during install? because i did not read it in any install text.

     

    Here is quote from my first post with explanation for global variables with bolded instructions:

     

    - GLOBAL VARIABLES FOR TIME BASED EVENTS

    It is taking care that these global variables change their values at proper time and must be added to global variable panel before start using scene:

     

    1) TimeOfDay - is predefined global variable (lower part of variable panel) with possible values "Morning", "Day", "Evening", "Night" or equal values in your language which then you can map to english values used by this scene. Time of day will be changed as follows:

       - Night to Morning - at adjusted sunrise time or when global SleepState change to Awake.

       - Morning to Day   - after defined time interval from adjusted sunrise time.

       - Day to Evening   - at adjusted sunset time.

       - Evening to Night - after defined time interval from adjusted sunset time or when global SleepState change to Sleep.

    I also posted here virtual device "Sunrise & Sunset" with which you can adjust sunrise and sunset times for +/- 59 (New 17 Jan 2017) minutes and also define time intervals after which will be set Day or Night time. I use two scenes to change Global variable SleepState. Scene "Good night" is started by FIBARO swipe or switch 2 on dimmer in our bedroom and sets this variable to Sleep after checking that selected doors and windows are closed, all lights are turned off, etc. Scene "Good morning" is either started by Alarm clock or manually with swipe or switch 2 in our bedroom and after turning on slowly selected lights and starting and slowly raising volume of our Sonos and starting coffee machine changes value of variable SleepState to Awake. This variable is also important for "Very Smart Lights"™ scene.

    2) Darkness - global variable (upper part of variable panel) with possible values 0 for day time (Light) and 1 for night time (Dark). Value is changed at adjusted time for sunrise and sunset time. This variable is also used in "Very Smart Lights"™ scene.

    3) WeekDay - is predefined global variable (lower part of variable panel) possible values are name of days in your language with possibility to map names so no need to change scene code. This can be used to display week day on tablet controller or even use for triggering some events that must happen at midnight of each or some days of the week.

    4) Month - is predefined global variable (lower part of variable panel) possible values are names of months in your language with possibility to map names so no need to dig into scene code.

    5) SeasonState - is predefined global variable (lower part of variable panel) possible values are names of four seasons in your language with possibility to map names.

     

    Also this global variable must be defined in global variable panel or you can map your existing global variable to this one in scene code:

    6) "SleepState" - is predefined global variable (lower part of variable panel) with values "Awake", "Sleep" or values in your language that you can map in scene code. Value is changed by other scenes or VD

     

    - OTHER GLOBAL VARIABLES

    NEW from version 1.2.2

    Following global variables are automatically added to global variable panel and set to defaults by "Sunrise & Sunset" virtual device when imported so you don't need to add them yourself:

    "MarginSunrise"  - global variable with possible values from -59 to +59 Min, used to adjust sunrise time
    "MarginSunset"   - global variable with possible values from -59 to +59 Min, used to adjust sunset time
    "MarginDay"        - difference time from sunrise when morning starts until time when day time starts in format "00:00", minimum 1:00h, maximum 6:59h difference
    "DayTime"           - exact time when morning time changes to day time in format "00:00", shows exact time when Morning will change to Day time
    "MarginNight"     - difference time from sunset when evening starts until time when night time starts in format "00:00", minimum 1:00h, maximum 6:59h difference
    "NightTime"        - exact time when evening time changes to night time in format "00:00", shows exact time when Evening will change to Night time.
    "MarginBlinds"    - difference time from sunrise until time to open selected blinds in format "00:00", minimum 00:00h (New 17 Jan 2017), maximum 12:59h difference
    "OpenBlindTime" - exact time when blinds will open in format "00:00", shows exact time when blinds will be open

    Since version 1.2.3 - new global variables same as above, added to variable panel by Sunrise & Sunset VD:

    "Latitude"             - Position of your HC

    "Longitude"          - Position of your HC

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