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
Just now, Sankotronic said:

 

Hi @Bodyart,

 

I give up on further coding of that part since Fibaro location service was and still is not so usable. When location services are turned on for Fibaro app it just drains battery and occasionally it jumps for more than 100 meters and that is not good. Thanks for this code and I can incorporate it in next release.

 

This is in the first place mine LUA learning :-) That's why I'm "playing" with different scenes an devices published here in order to understand the code. Sometimes it gives result too :-)

 

Link to comment
Share on other sites

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

     

    This is in the first place mine LUA learning :-) That's why I'm "playing" with different scenes an devices published here in order to understand the code. Sometimes it gives result too :-)

     

     

    Yep, that is the best way to learn! I learn a lot form examples and others work and advices. But of course from time to time I also consult book Programming in LUA check here: 

    Please login or register to see this link.

     I have 3rd edition :) 

    Link to comment
    Share on other sites

    • 0
    Just now, Sankotronic said:

     

    Yep, that is the best way to learn! I learn a lot form examples and others work and advices. But of course from time to time I also consult book Programming in LUA check here: 

    Please login or register to see this link.

     I have 3rd edition :) 

    Is the implementation of Fibaro LUA a superset to std LUA, as far as you're aware?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Just now, Bodyart said:

    Is the implementation of Fibaro LUA a superset to std LUA, as far as you're aware?

     

    To be honest I didn't yet go that deep so don't know how much of standard LUA is included on FGHC.

    Link to comment
    Share on other sites

    • 0
    1 hour ago, Bodyart said:

    Is the implementation of Fibaro LUA a superset to std LUA, as far as you're aware?

    VDs run Lua 5.2 and scenes run 5.3. I don't know the exact list, but several parts of Lua have been disabled. Most notable ones: os.exec, debug, require, loadfile, coroutines. Extensions are http, setTimeout, the HC api and json.

    Link to comment
    Share on other sites

    • 0
    1 minute ago, petergebruers said:

    VDs run Lua 5.2 and scenes run 5.3. I don't know the exact list, but several parts of Lua have been disabled. Most notable ones: os.exec, debug, require, loadfile, coroutines. Extensions are http, setTimeout, the HC api and json.

    Wow, You must be highly educated!

    Thank you very much.

    Link to comment
    Share on other sites

    • 0
    4 minutes ago, Bodyart said:

    Wow, You must be highly educated!

    Thank you very much.

    Thank you for the compliment...

    Link to comment
    Share on other sites

    • 0

    Another example

    I save calendar event into variable and then using this code in function extraUserCodeFirst()

    Variable does look like this:

    Please login or register to see this code.

     Code will split the date, time and event to 3 parts

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
    On ‎10‎/‎12‎/‎2016 at 8:09 PM, Sankotronic said:

    "HomeTable"       - predefined global variable table with device and scene IDs. Recommended to use since z-wave devices can change their ID with re-inclusion and then is necessary  to edit only scene which make this table and only device ID in scene headers. Much less time and effort is needed than without that option! So if you use this table then uncomment line bellow:

     Hi

    Please login or register to see this link.

    ,

    I warn you that you need patience with me please <grin>.  I am just no good at coding languages. From your statement above, I understand to go to the lower section on the Variable Panel and I have to create the "HomeTable".  But what the content of the table should look like is where I hit a blank.  Can you please show me an example with a few "records" in it.

    Thanks for all the work you put into helping rookies like me.

     

    On ‎10‎/‎12‎/‎2016 at 8:09 PM, Sankotronic said:

    - INSTALLATION INSTRUCTIONS

    IMPORTANT!

    1) Please first download "Sunrise & Sunset" VD and import to your HC.

    2) Create new LUA scene and copy and paste code. Save to start scene and check debug window for any errors. If all good it should look like this:

    Please login or register to see this attachment.

     

    Your look like the snapshot above and mine is as per my snapshot

    I apologise if it has been dealt with in the following 15/16 pages of posts.  If so, then I will just have to hunt for it

     

    Please login or register to see this attachment.

     

    Thanks a stack

     

    Link to comment
    Share on other sites

    • 0

    @lennypenny, for HomeTable concept you have link there: 

     

     

    Generally you create global variable ( deep structure ), where you name each device, scene, controller. This way you do not have to remember ID`s or change code if device is reconfigured (new ID). You use only structure path to point device.

    Of course scene "HomeTable" should be executec after HC start so it can load variables.

    Below part of by code so you can get idea:

     

     

    Please login or register to see this code.

     

     

     

    Can you post what exactly you have in line 924 ? Please past few lines before and after it.

     

    Edited by Bezan
    Link to comment
    Share on other sites

    • 0
    4 hours ago, Bezan said:

    Can you post what exactly you have in line 924 ? Please past few lines before and after it.

     

    Something odd.........  I followed the instructions to set up HomeTable and then came back to your question.  It has changed without me doing anything in that scene.

    see:

    Please login or register to see this attachment.

    I have not seen so many feedback lines and also not seen the "DEACTIVATE" button

     

    I also cannot seem to change the Weekday and Month.  It simply does not tick over

    see:

    Please login or register to see this attachment.

     

    Any ideas?

    Thanks

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @lennypenny,

     

    Main scene is running but since Demo mode is turned On scene is not changing any global variables or running any scenes or VD that are setup to run repeatedly or scheduled. You need to use Home Status VD to turn off Demo mode.

     

    Regarding Timers VD, do you mean that pressing button does not change weekday and month?

     

    Anyway, I just finished and posted New Weather State VD and Netatmo scene so now I'm working on new version of Main scene and accompanying VD(s) since ti is core of the system and needs refreshment! :) 

     

     

    Link to comment
    Share on other sites

    • 0
    3 hours ago, Sankotronic said:

    Regarding Timers VD, do you mean that pressing button does not change weekday and month?

    Hi Sankotronic,

    Thanks for the info.  I have changed Demo mode to "NO"

    Yes I click on the buttons and it does not change weekday and month.

    Please see the new snapshots after I changed the Demo Mode

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

    Thanks for your help

    Link to comment
    Share on other sites

    • 0

    hi @lennypenny,

    i had the same issues like you. In 99% of the cases I had wrong or missing Variables.

    Go through again the install instructions, some of the variables are only mentioned in the text. Also the update notes at the beginning of the 1 post.

    Not all Variable are mentioned in the list 1 - 6!

     

    Also the VDs you installed need attention. In the Timers VD i adjusted the slowakian(?) names for Days, Month and so on.

    Just go through the code in advanced tab. you will see it quite fast there.

     

    Again: check the variables and their content. Names and values have to match 100%.

    I add a screenshot all of them are needed for Time based szene + timers VD + sunrise VD + home status VD.

     

    Very important: you can't set the values of the upper part correctly using the variables screen. they have to be set using the VDs / scenes.

    Therefor your timers + sunrise VDs have to work properly. Only then the time is set correctly into the variables. (E.g. DayTime = 09:00 instead of 09)

     

    good luck, kro

    ps: @Sankotronic: genius

     

     

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Edited by kroeatschge
    Link to comment
    Share on other sites

    • 0
    Quote

     

    Hi @

    Please login or register to see this link.

    ,

    Thanks for the pointers.  I will chuck it and begin again I think

    L

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Working hard on new version of Sunrise & Sunset VD and Main scene for time based events. I just can't leave it like this that global variables are destroyed if user press Save button in variable panel so next version will not have that very big disadvantage.

     

    Also if I manage to use new solution for setting up predefined variables using different languages, then setup will be even more simple. 

    Link to comment
    Share on other sites

    • 0

    Great @Sankotronic, keep up the good work! Your scene for time based events is a beauty, a real beating heart!

     

    Hvala liepa

    Link to comment
    Share on other sites

    • 0
    19 minutes ago, lennypenny said:

    Hi @

    Please login or register to see this link.

    ,

    Thanks for the pointers.  I will chuck it and begin again I think

    L

     

    Hi @lennypenny

     

    I posted this on another topic but I thunk it's good advice and worked well for me

     

    Please login or register to see this code.

    my mantra always is 'keep it simple' if possible...

    Link to comment
    Share on other sites

    • 0

    Testing this nice Main scene for time based events control, but just ran into a question. 
    Is it possible to setup to run a scene every 5 min between a defined clock interval like 21:00 to 23:00?

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