I’m writing my first plugin for Vera, and I need to create a variable with posible values from 1 to 10 (that is, ten posible settings). These settings should be configurable by user both inside the tab in the device where you can set IP and so on, but also it should appear in the GUI of the device as a ten values control, just te way a dimmer is presented, but only ten integer values to select from. When the user sets a value, then my LUUP code will take it into account in order to give a command that uses this setting.
So I think my question is in fact at least a couple of questions:
How and where to create such a variable from my plugin so that it can be configurable in the device parameters by the user.
How to create such a 10 integer values dimmer in the json file of my plugin.
Of course it’s not a variable that exists in the external device. It’s just a variable that only exists in Vera to control the behaviour of my Luup code.
[quote=“floyderman3d, post:1, topic:171539”]- How and where to create such a variable from my plugin so that it can be configurable in the device parameters by the user.
How to create such a 10 integer values dimmer in the json file of my plugin.[/quote]
That’s pretty ambitious for a first plugin. I don’t know of anyone else who has tried that yet, so you might just have to experiment.
The best way to proceed is to find examples that are close to what you need. In this case I’d start with the D_DimmableLight1.json file. It has this inside it:
There are 101 values between 0 and 100. See if you can reduce this to ten values.
But a warning: Just because the JSON file has a spot for it doesn’t mean that the JavaScript in the UI has to respect it. The only way to be sure is to try it and see. Let us know how it goes.
At the end I discarded the slide bar from 1 to 10, since its behaviour was a little bit buggy, and opted for an input box (limited from 1 to 10 by luup code) and a button that takes the value of this input box, that in turns updates a statevariable as in the chixxi Vcontainer plugin with this value, to finally read it from my luup implementation and take it into account to biffurcate the code depending on its value. It worked!
So thanks for your tips!
Best Home Automation shopping experience. Shop at Ezlo!