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
  • 29 minutes ago, jompa68 said:

    I found blind time in this VD, how do you use that and how-to setup in you main scene?

     

    Hi @jompa68,

     

    I removed blinds control from Sunrise & Sunset VD in new version I'm testing now since I'm making separated controls for blinds that should be easy for users to setup regardless of number of rooms and blinds. Of course for that one I will need testers since I have six blinds only in living room and dining room. I plan to add more in future but first things first.

    Link to comment
    Share on other sites

    • 0

    I have a problem with the main scene. Every day I get this error and the scene does not work anymore.

    Please login or register to see this attachment.

     

    The scene is very convenient for me. What can I do to make it work?

     

    Link to comment
    Share on other sites

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

    The scene is very convenient for me. What can I do to make it work?

     

     

    Hi @Flash226,

     

    Try not to use SAVE button in variable panel until I release new version of the scene. Pressing button in variable panel unfortunately destroys values of some of the global variables and that makes scene to stop with error. To correct global variables you need to open Sunrise & Sunset VD for editing and press save button there. It will rebuild variables but you will have to adjust times after that.

     

    New version of Main scene and Sunrise & Sunset VD will not have that problem anymore. I'm working hard to finish new version that will have some nice features that you can check here:

     

    Link to comment
    Share on other sites

    • 0

    Hello,

     

    this evening my variable timeofday automaticaly switched to "night" even before 22:00. In the VD Timers v1.0.1 I switched timeofday back to "evening" manually but it moved to "night"  approx 10 sec.later.

    Any idea what  went wrong?

    Usually time of day switches to "night" after 0:00

     

    Thanks Marco

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 hours ago, MarcoT said:

    Hello,

     

    this evening my variable timeofday automaticaly switched to "night" even before 22:00. In the VD Timers v1.0.1 I switched timeofday back to "evening" manually but it moved to "night"  approx 10 sec.later.

    Any idea what  went wrong?

    Usually time of day switches to "night" after 0:00

     

    Thanks Marco

     

    Hi @MarcoT,

     

    Check settings in Sunrise & Sunset VD and status of SleepState.

    Link to comment
    Share on other sites

    • 0

    Hi @Sankotronic,

     

    The sleepstate is "awake" an the settings in Sunrise & Sunset VD you find in the attached screenshot.The settings looking OK and have not been changed.

     

    Thanks

    Marco

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 hours ago, MarcoT said:

    Hi @Sankotronic,

     

    The sleepstate is "awake" an the settings in Sunrise & Sunset VD you find in the attached screenshot.The settings looking OK and have not been changed.

     

    Thanks

    Marco

     

     

    Well then, what happened at that time when TimeOfDay was changed to Night? Something was changed at that time so logic, which never mistakes, changed it to Night.

     

    Oh, you can change TimeOfDay to other time with Home Timers VD, but if Demo mode is not turned On then scene will set it back to the time defined by settings on next run.

    Link to comment
    Share on other sites

    • 0

    Hi @Sankotronic 

    when it set the Demo mode  "on" and change manually the status of TimeOfDay to "evening" it stays at evening. but directly after switching the Demo mode off, TimeOfDay change to night.

     

    I watched the state of TimeOfDay tonight and it changed from day to night immediately.

    After disabling the Main scene for time based events the variable TimeofDay stays at "evening".

    I didn't change anything in all configuations before this behaviour occurred.

     

    I already removed the variable TimeOfDay and created a new one but this even did not change anything.

    Is there any way to find out which script change the state of a variable?

     

    Thank you

    Marco

    Link to comment
    Share on other sites

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

    when it set the Demo mode  "on" and change manually the status of TimeOfDay to "evening" it stays at evening. but directly after switching the Demo mode off, TimeOfDay change to night.

     

    Hi @MarcoT,

     

    That part is then working as expected. Demo mode with Home Status and Home Timers VD is provided for testing.

     

    26 minutes ago, MarcoT said:

    I watched the state of TimeOfDay tonight and it changed from day to night immediately.

    After disabling the Main scene for time based events the variable TimeofDay stays at "evening".

    I didn't change anything in all configuations before this behaviour occurred.

     

    Problem is that you set night time to start at midnight. Midnight is "00:00" what is then less or smaller than sunsettime and that is why day goes directly to night time. Try to set night to start at "23:59" and then there will be evening time. If you want night to start at midnight or even later then script has to be changed. I just didn't predict that there will be anyone to set night to start after 23:59. Thanks for pointing this out. In new version I will do smarter script with better checks and more liberty with settings.

     

    Link to comment
    Share on other sites

    • 0

    Hi, new problem...

    After exclusion and re-inclusion of some devices I decided to use the HomeTable. Seems convenient and works fine.

    however, in a virtual device which has a few buttons and sliders, the buttons work fine but the sliders do not. And I get these error messages when I test in debug of the sliders or buttons:

    [ERROR] 17:25:57: line getGlobalValue("HomeTable"))..."]:49

    49 is 27 in other occasions.

    I removed all references to the HomeTable (so it is just as before I introduced HomeTable, but the error messages keep appearing in debug.

    Any ideas what could be wrong? Thanks for suggestions.

    Link to comment
    Share on other sites

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

    Hi, new problem...

    After exclusion and re-inclusion of some devices I decided to use the HomeTable. Seems convenient and works fine.

    however, in a virtual device which has a few buttons and sliders, the buttons work fine but the sliders do not. And I get these error messages when I test in debug of the sliders or buttons:

    [ERROR] 17:25:57: line getGlobalValue("HomeTable"))..."]:49

    49 is 27 in other occasions.

    I removed all references to the HomeTable (so it is just as before I introduced HomeTable, but the error messages keep appearing in debug.

    Any ideas what could be wrong? Thanks for suggestions.

     

    Hi @ErnstH,

     

    Can you post code from slider?

     

    Link to comment
    Share on other sites

    • 0

    Below is my code.

    I entered it step by step, first using Id numbers, later selfId and the hometabel references.

    It seems to work fine.

    Then I removed all comments and debugs, and then it goes wrong. Why?

     

    local debug = true
    local jT = json.decode(fibaro:getGlobalValue("HomeTable"))

    --fibaro:debug('ID = '..fibaro:getSelfId())
    local selfID = fibaro:getSelfId()
    if debug then fibaro:debug('ID = '..selfID) end
    local LfGewenstePositie =
        --tonumber(fibaro:getValue(159, "ui.Slider1.value"))
        tonumber(fibaro:getValue(selfID, "ui.Slider1.value"))
    if debug then
        fibaro:debug('eindpositie = '..LfGewenstePositie)
    end

    --fibaro:call(125, "setValue", LfGewenstePositie)
    fibaro:call(jT.Serre.Luxaflex, "setValue", LfGewenstePositie

     

    After stripping, it is like this, and then the errors comes in:

    local selfID = fibaro:getSelfId()
    local LfGewenstePositie =
        tonumber(fibaro:getValue(selfID, "ui.Slider1.value"))
    fibaro:call(jT.Serre.Luxaflex, "setValue", LfGewenstePositie)

     

    Hope you'll find it....

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @ErnstH,

     

    Try this code:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0

    Brilliant, that works!

     

    I still don't understand why the other code didn't do it, but I'm fine with this one.

    Thanks, Sankotronic!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • If above code you posted is correctly copied then in stripped version you stripped too much and removed line where you are getting HomeTable:

    Please login or register to see this code.

    That line must be in each code of each button, slider, main loop and scene where you need reference to the devices.

    Link to comment
    Share on other sites

    • 0

    Simple. By editing I deleted that I'm afraid.

    Now I need to find out how to adjust the slider when the blinds have been changed by another command.

    I suppose need to put that in the main loop.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 28 minutes ago, ErnstH said:

    Simple. By editing I deleted that I'm afraid.

    Now I need to find out how to adjust the slider when the blinds have been changed by another command.

    I suppose need to put that in the main loop.

     

    You can use this code to change slider value:

    Please login or register to see this code.

    First one is also executing code for the slider so if you want only to update position of the slider then use second one. When you test code, use mobile app to check because changing slider value or position is not properly updated on the web GUI interface! It is shown only after refreshing page in browser.

    Link to comment
    Share on other sites

    • 0

    Both don't work. I put it in de Main Loop.

    Shouldn't I first need to state a definition of id and position?

    Moreover, I have 2 sliders: one for up and down and one for turning the blinds.

    I'll be back tonight.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 5/11/2017 at 7:06 AM, ErnstH said:

    Both don't work. I put it in de Main Loop.

    Shouldn't I first need to state a definition of id and position?

    Moreover, I have 2 sliders: one for up and down and one for turning the blinds.

    I'll be back tonight.

     

    Hi @ErnstH,

     

    Those above are examples and of course you need to define id and give some value between 0 and 100. If you put code in Main loop then it can look something like this:

    Please login or register to see this code.

    In above code you need to change ui.Slider1.value if your slider has different ID, jT.living.blinds1 with reference to your desired device which value you want to put on slider.

    Remember, slider position will not show correctly in web GUI interface after it is updated with main loop, only after you refresh page. Also if you move slider to a new value it will jump back, depending on the time needed for blinds to reach desired position. Also in above example loop will execute every 3 seconds "fibaro:sleep(3000)". 

    Edited by Sankotronic
    Rectified code
    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...