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


  • 0

Automatically detect corrupt scenes


Do you want to get messages if something is wrong?  

25 members have voted

  1. 1. Do you want to get messages if something is wrong?

    • Yes.
      25
    • No.
      0


Question

Posted

We can automate a lot with HC2 but I haven't found a way to find out if there is any scene or virtual device with an error (aka red font message in debug).

This means a scene can fail simply because a global variable is nil and you will never know until something bad happens.

Wouldn't it be nice to have a message if one scene/virtual device fails during "non programming time"?

Is this already possible?

If not would you like this to be implemented in HC2 4.0 as well?

9 answers to this question

Recommended Posts

  • 0
Posted

Hi dawiinci,

It is possible already. Please see the code snippet below:

Please login or register to see this code.

What's essentially happening is we're putting the code we want to run into a function and then using a 'protected call' (pcall) to run the function. This will catch any error that gets thrown and return the error along with a boolean status (true = no error, false = error.)

You can then use those values to run a conditional statement to define actions to take given each response. In the code example, we just debug "Success" when true and debug the error string when false. You can add extra actions to this, say for example send you an email or push notification saying the scene has failed.

If you copy and paste the above code into a new scene and run it you'll see what I mean. Notice that the action in the function is called "Fibaro:call(10, "turnOn")" which is incorrect (F is capitalised, should be lower case.) Change it back to normal and you'll see the status change from error to success.

I hope this answers your question.

All the best,

Dan

  • 0
Posted

Daniel,

Your snippet above looks very interesting. Do you use it for all of your scenes?

I notice that you are tagged as “Fibaro UK”. Does this mean that we have local UK support now or are you just an official re-seller?

Cheers

Aleks

  • 0
Posted

Although I would give this idea a +1, I'm under the impression that Fibaro is doing next to nothing with our feedback on improvements regarding bugs and stability issues. Their marketing department runs the show and long lists of features are impressive, even if that means that many features do not work at all....

  • 0
Posted

Hi amilanov,

Usually no, I use it when I have something that is likely to fail because it's based on some external factor or resource that I have no control over - such as when integrating a 3rd party device or service over the network. It's useful none the less.

No we're not a reseller, so you can come to us for localised support - no problem!

Regards,

Daniel

  • 0
  • Inquirer
  • Posted

    So in order to be sure I have to wrap pcall() around all my scenes and virtual devices?

     

    And if something in pcall() fails, it stops executing the rest of pcall() and sends me a message?

    • 0
    Posted

    Would have been nice, but does not work in 4.033 (at least not for me).

    Please login or register to see this code.

    • 0
    Posted

     

    Would have been nice, but does not work in 4.033 (at least not for me).

    Please login or register to see this code.

     

    just change 'Fibaro' to 'fibaro' in Fibaro:call(10, "turnOn")

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
  • Inquirer
  • Posted

    This is not a solution for over 100 scenes. This has to be included in the system. One option to get notification if anything is written in RED in the debug window.

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