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
On 8/1/2018 at 12:56 PM, Sankotronic said:

Maybe there are users or admins that know more about [ error] API: Host not found (authoritative) ??

 

 

Link to comment
Share on other sites

  • 0

 

Same error message here.

 

Installed a brand new HC2 with software 4.510, with no devices yet, just two scenes "Sunrise & Sunset v1.3" and "Main scene for time based events control v1.2.5".

When I start the scene everything looks good, but after some hours running good it stop/crashes with error:

 

Please login or register to see this image.

/monthly_2018_08/MSFTBEC.PNG.e857b2e1fd19cfcba01ff078125e90b7.PNG" alt="MSFTBEC.PNG.e857b2e1fd19cfcba01ff078125e90b7.PNG" />

 

When I click on "start" button the scene start running again, but after some random time it stops again.

tried it three times, first time it was running for hours before it crashed, second time it stopped after some minutes, third time it was running good for hours until it crashed again.

 

 

 

 

 

Link to comment
Share on other sites

  • 0

I have the same. Scene stops.

I`m wondering if adding code like:

 

local mainLoopSceneID = XX
fibaro:startScene(mainLoopSceneID);

 

Added to reaction on one of motion sensors will help. Assuming this motion sensor is breached few times per hour it can be good "starter" just in case MainLoop fails.

I`m not expecting Fibaro to resovle this issue too fast :)

 

 

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi @drivex@Remi@domin12@Bezan ,

     

    Sorry for late answer but I was not at home for last five weeks. Since I don't have such problems on my HC2 with latest firmware can you please send me complete scene code as plain text document to private message so I can analyze and find out what is causing this errors?

     

    Thank you!

     

     

     

    Link to comment
    Share on other sites

    • 0
    2 hours ago, Sankotronic said:

    Since I don't have such problems on my HC2 with latest firmware can you please send me complete scene code as plain text document to private message so I can analyze and find out what is causing this errors?

    3

     

    unplug jack RJ45 from WAN (!) interface where your ISP live :) just un-plug... and you will see....

    Edited by 10der
    • Like 1
    Link to comment
    Share on other sites

    • 0

    Hello Sankotronic, in the introduction you describe a variable called "HolidayTime".

    Am I correct in assuming that you are using this variable but nowhere?

     

    Geetings and thanks for the answer

    Link to comment
    Share on other sites

    • 0
    On 9/15/2018 at 3:22 PM, 10der said:

      

    unplug jack RJ45 from WAN (!) interface where your ISP live :) just un-plug... and you will see....

     

    thats true, when there is no WAN connection, script die

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I have tested Main scene FTBE and found following:

     

    If network cable is disconnected from HC2 or network connection is lost then in some cases all functions that depend on API Local Host calls fail. I'm not expert but I thought that all calls to API through local host (127.0.0.1) don't need network connection since those calls are local on the device check:

    Please login or register to see this link.

     

    For some reason HC2 local host calls sometimes don't work when network connection is lost. Or these call are then not done through local host? I tested the way I disconnected HC2 network cable from my network switch. With one of the cable disconnections I get this in debug window:

     

    Please login or register to see this image.

    /monthly_2018_09/207776950_APIHostnotfound.jpg.434cf6d16585e8b0d5b5643810878de9.jpg" alt="207776950_APIHostnotfound.jpg.434cf6d16585e8b0d5b5643810878de9.jpg" />

     

    I added some more debug lines just to better understand where is actual problem.

    So after debug line "Get actual time" there are two calls to get sunrise and sunset times and those fail. After that All functions that are getting values from global variable fails so ultimately function that calculate times fail since it can't calculate with NIL values.

     

    Interestingly this doesn't happen every time when network connection is lost and I did try to disconnect network cable several times and keep it disconnected for different time length.

     

    SOLUTION

    I'm really tired to change every bit of my code every time when Fibaro developer team introduce new bugs or "features" in their software. I have to do that every time when new "stable" firmware is released. I'm working on new solution anyway, but it is difficult to say when I will publish it due to the situation with new releases.

     

    Link to comment
    Share on other sites

    • 0

    It might be difficult to work around this. You can try to make it go into a "retry loop" so it continues when that error disappears.

     

    This error was mentioned a few times but unfortunately there are two "errors" which sound very similar and this causes confusion. Let me try to explain

     

    1) API: Not found - this one is *probably* quite harmless because code continues to run. It happens, for instance, if your script uses a non-existent global variable.

    2) API: Host not found (authoritative) - this one means name resolution failed. It is quite bad, because it crashes code if your code does not expect "nil".

     

    The bug exists on HC FW between 4.500 and FW 4.510 (the one available at the time of this post).

     

    Issue it was discussed here.

     

    I agree with @tinman's diagnosis and I can reproduce the issue (on one of my scenes, not @Sankotronic's scene, but that is not important):

     

    Please login or register to see this code.

    My scene crashes at line 106, because fibaro:getValue(10, 'value') returns nil, which is unexpected. You could argue, we should always check if this code returns nil but (1) it actually never happens as long as device 10 exists (on pre 4.5XX firmware) (2) I see no reason why the scene should depend on the availability of the LAN connection.

     

    Similar cases:

     

     

     

    TIP: Search for the word "authoritative" in the error message, to distinguish it from the totally different "API: Not found" error (which is less harmful).

     

    • Like 1
    Link to comment
    Share on other sites

    • 0

    Please login or register to see this image.

    /monthly_2018_09/image.png.8d9f98d4c69ec742b4f3fdd80a7c3572.png" />

     

    Can someone please help me, my changes to "MarginBlinds", "MarginDay" and "MarginNight" always gets back to default after restarting the HC2, my question is how I can keep my changes permanent, I want the figures to be like this:

     

    image.png.717a6234d7802f09a87b639417c0c74e.png

     

    Thanks in advance 

    Edited by JEAU
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @JEAU ,

     

    Whenever Sunrise & Sunset VD main loop is restarted it resets margin times to default. If you often reboot HC2 then you can change this defaults in main loop code.

    Open VD for editing and scroll in main loop code to line 146. You will see this code:

    Please login or register to see this code.

    Now you can enter your default settings and Save.

    Link to comment
    Share on other sites

    • 0
    4 hours ago, Sankotronic said:

    Hi @JEAU ,

     

    Whenever Sunrise & Sunset VD main loop is restarted it resets margin times to default. If you often reboot HC2 then you can change this defaults in main loop code.

    Open VD for editing and scroll in main loop code to line 146. You will see this code:

    Please login or register to see this code.

    Now you can enter your default settings and Save.

    Hi Sankotronic, 

     

    You are great thank you very much, that worked 

    Link to comment
    Share on other sites

    • 0

    I have used this now for a while and runs great but now after a restart of the controler I get the following error:

    [DEBUG] 22:07:45: [1;31m2010-01-03 22:07:45.708449{fatal] Unknown exception:

    /opt/fibaro/scenes/20.lua:454: attempt to perform arithmetic on local 'diffMinute'(a nil value).

     

    Why is this happening, now all my automated scripts won't run correctly no more.

    Link to comment
    Share on other sites

    • 0
    On 10/19/2018 at 12:24 PM, tangkaufw said:

    I have used this now for a while and runs great but now after a restart of the controler I get the following error:

    [DEBUG] 22:07:45: [1;31m2010-01-03 22:07:45.708449{fatal] Unknown exception:

    /opt/fibaro/scenes/20.lua:454: attempt to perform arithmetic on local 'diffMinute'(a nil value).

     

    Why is this happening, now all my automated scripts won't run correctly no more.

     

    Idem

    Link to comment
    Share on other sites

    • 0

    Looks like I have found out what the problem is.

    After a Power failure I had to restart/reset the HC2 controler and because of this the configuartion of "Set Date and Time" was set to manual.

    After setting this to "Download time from the Internet" everything working normally, even possible to make "Cloud backups" again and see which backup are there already.

    Everything for me is running smothely again.

    Sorry just checked again after making the changes yesterday and it ran fine.

    At the moment again get the same error.

    Sorry folks.

    Al the other is fine but all scripts depending on mainscene are not running fine because of this issue.

    Link to comment
    Share on other sites

    • 0
    Guest andyhud
    On 10/21/2018 at 10:11 AM, tangkaufw said:

    Looks like I have found out what the problem is.

    After a Power failure I had to restart/reset the HC2 controler and because of this the configuartion of "Set Date and Time" was set to manual.

    After setting this to "Download time from the Internet" everything working normally, even possible to make "Cloud backups" again and see which backup are there already.

    Everything for me is running smothely again.

    Sorry just checked again after making the changes yesterday and it ran fine.

    At the moment again get the same error.

    Sorry folks.

    Al the other is fine but all scripts depending on mainscene are not running fine because of this issue.

     

    I'm having the exact same problem.. changed my Set Date and Time back to "download from internet" and now my HC2 is rebooting, but its been "rebooting" now for 10 minutes or so! Its not going back to login prompt!

     

    :(

    Link to comment
    Share on other sites

    • 0
    Guest andyhud
    27 minutes ago, Jamie mccrostie said:

    Have you refreshed your browser?

     

    :)

     

    Yes, I did everything and it didnt come back. I ended up pulling the power from HC2 and now its back and running again and the new "Download time from internet" seems to be working". The Scene now runs but I get a new error 

     

    "[ error] API: Not Found"

     

     

    Please login or register to see this attachment.

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