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

Question
Lambik 194
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.