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
qnstie 4
I have recently played with VD programming and I encountered a few problems in VD programming that I would be very happy to have addressed by Fibaro team in one of the next releases:
1. Please add variables to VD scope, shared across buttons and main loop
It is now quite cumbersome to code VDs that have some (even very basic) state and logic.
There now seem to be only the following options of keeping the state:
- Create a global variable (most obvious, but problematic)
- Keep data in the sliders (integers only, generally in range of 0-100)
- Keep data in physical device parameters (if you happen to have one that allows it!)
- Use external web service API
Each of these has serious problems, probably quite obvious for everyone.
How about adding a possibility to define within the VD a set of parameters, accessed - once defined - in the same way as the "IPAddress" and "TCPPort" are accessed, namely:
Please login or register to see this code.
I do not think it would be a big problem for the Firabo team and would be a great help for the crowd developers.
2. Please add option to define a range for VD sliders.
The sliders now always have range of 0-100.
But this is not very useful for cases like I had with sprinkler control, where I wanted to give user a possibility to delay the sprinkler in range of 0-24 hours.
Please add a possibility to define min, max and step values for the slider.
3. Please add an API function (or metadata) to CREATE a global variable, a "constructor" code block
I know this may be tricky security-wise, but in order to automatically create global variables that are needed by the VDs or scenes, the developers are forced to do even more dangerous tricks (as using webservice API with open superadmin usernames and passwords).
Therefore I ask - please add a method (e.g. fibaro:createGlobalVariable()) to allow developers creating global variables lege artis.
It would be even better (especially security-wise), if you added (in VD and LUA scene) a special "constructor" block of code which is executed only once, during the first run of a scene or installation of a VD, where such methods could be used safely (because only super admin has rights to install/define a VD and scene).
Thanks in advance!
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.