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

[Beta] System Status Virtual Device


Question

Posted

Hi to you all!

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

I made this Virtual Device just to learn (a bit of) lua-scripting. I call it System Status.

I used a lot of snippets of code, found on this forum and help of members (special thanks to Dalle1985!)

So.... Use it on your own risk!!

Please login or register to see this image.

/emoticons/default_icon_curve.gif" alt=":-/" />

Warning: System can be unresponsive for a long time when using Dead Node Repair/Repair Mesh!!

What does it do?

This System Status Virtual Device can report and fix:

Dead Nodes

Report - It will show all your systems dead nodes.

Wake Up - Will try to wake up the dead node (only the dead node ID itself)

Repair - Will try to wake up the dead node and perform a "requestNodeNeighborUpdate" for this node only

Beware: this will takes 21 minutes per found device and the system may become unresponsive for that time!!

Repair Mesh - Will perform a complete system "requestNodeNeighborUpdate" (only when dead nodes are detected)

Beware: this will takes 21 minutes and the system may become unresponsive for that time!!

Scenes

Count scenes - Count the total number of scenes running (summed)

Count +1 scenes - Count the total number of scenes with one of more instances running (summed)

Kill all scenes - Kill all running scenes (except System Status scene)

Kill +1 scenes - Kill all running scenes with more then one instance running (except System Status scene)

Installation

The System Status virtual device needs two global variable (do not use predefined variables):

VD_System_Instance - This is used to prevent the use of more buttons at one time and is also used to interact with the System Status scene. Depending which button is used on the virtual device it will trigger the scene and perform action (if needed).

VD_System_saReport - This one is used to get the results from the scene presented in the System Status virtual device.

Make a new lua scene, called System Scene (or whatever you like), and copy/paste this code:

Please login or register to see this code.

Please change the code according to the newly created scene-ID, found on the first scene-tab.

local selfId = 16; -- ** IMPORTANT! ** ID of this scene. Please change to this scene ID-number

The scene was created because the lua code of counting and killing a scene doesn't work in a virtual device. The goal was to limit it just to one virtual device. Maybe it would be nice to solve it with json scripting, but I have no experience at all with that. If you do, maybe you can help...

On the other hand it can be handy because you can open two browser windows and see what is happening. Thats why I used a lot of debug-aids in the scene, so you can monitor which scenes are actually activated and have some potential bad influences on the HC2 system.

Last but not least, I also made some Steampunk Icon's for the looks of the virtual device, which I added to this posting.

Remember, it's still a beta version so if you have comments, please do! It's highly appreciated.

Also, I'm still a programming rookie and I'm not so smart, so be patience with me...

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

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.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

6 answers to this question

Recommended Posts

  • 0
Posted

Hello,

I'll give a try.

Thank you very much!

  • 0
  • Inquirer
  • Posted
    Thank you very much!

    Your welcome

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Posted

    Cool, this is a very nice VD you created there. However, you write that the system might become unresponsive. If you follow the method we discussed, it should not become unresponsive. The problem only arise if you call the code multiple times at simultaneously which might mess something up.

    A nice addition to your vd might be a label which shows the current rebuild status and time remaining, i.e. :

    "Rebuilding ID xx"

    "Done in 21:00"

    • 0
  • Inquirer
  • Posted
    However, you write that the system might become unresponsive. If you follow the method we discussed, it should not become unresponsive. The problem only arise if you call the code multiple times at simultaneously which might mess something up.

    I had, when testing this VD, one time it became unresponsive. Indeed there where multiple instances running, as you mentioned.

    Afterwards I added the runInstance code, which blocks running more instances at one time, so it should be not becoming unresponsive anymore.

    The warning is just made out of precaution, you see, because it has to be tested more thoroughly before being sure.....

    Please login or register to see this image.

    /emoticons/default_icon_cool.gif" alt="8-)" />

    A nice addition to your vd might be a label which shows the current rebuild status and time remaining, i.e. :

    "Rebuilding ID xx"

    "Done in 21:00"

    That should be there and working:

    Please login or register to see this code.

    Did you noticed that isn't working?

    If not, I have to take a closer look...

    • 0
    Posted

    Ahh sorry about that... Didn't have time to test it yet. Just looked at the screens and didn't see it.

    • 0
  • Inquirer
  • Posted
    Ahh sorry about that... Didn't have time to test it yet. Just looked at the screens and didn't see it.

    No problem! Please ask questions, so I will be forced consider if I have done it the right way....

    Questions often leads to me to a "hmmmmm, didn't think of that"-moment....

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

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