Deleting Device Variables

Once I’ve created/set a device variable (meaning the variables that show up under a device when you click the plus sign - on the devices page), how do I delete it? Preferably through lua/luup.

there’s currently no API for that.

yes, i agree there should be some way to do it; but consider that in UPnP these are ‘State Variables’, declared on the XML service definition file. according to the standard, it shouldn’t be valid to even create new variables!

but, that would be overly restricting; so you can add variables. and that means that you ‘should’ be able to delete them. and that brings up the issue about if it should let you delete declared variables or not…

The problem is I am trying to create a quantity of state variables based on a quantity of devices found - more specifically, number of sprinkler valve variables based on number of etherrains found on the network. If I install 2 etherrains and then later remove one, I’m left with 16 valve variables. Odds are this scenario would never happen, but you get where I’m going with it.

Have you considered modeling this instead as a set of “N” child Devices, of a “parent” [Etherrain] Controller?

In that way, the Children can come and go at will (these can be deleted), and each will be symmetrical in the variables it has, and actions it implements, and any Scene Events it can deliver.

This is how my Alarm is implemented, and that was modeled on how the GC100 Device implementation works. In this model, each Sprinkler can participate directly/individually in Scenes (etc) but the Controller gets the actual Events and can co-ordinate as appropriate.

ie. Each Etherrain becomes a Top Level Device, and each Sprinkler Valve is a child of that device

It may even be possible to create a 3-layer heirarchy if you’re trying to create a parent-parent-child array (Ether-rain - Controller - Valve) with some sort of auto-discovery built in.

It doesn’t eliminate the general need to be able to delete vars, but it probably eliminates the need from your use-case.

sure, and i agree there should be some way to do it. i’m upping it a notch in my TODO queue.

Guessed, it’s funny you say that. My current modifications to the ER plugin support auto-discovery of the etherrain, as well as child devices for control/status of each valve individually. I use the parent device to represent the sprinkler cycle, so I can run a cycle in a scene. Currently, though, my code does not support multiple ER’s so thinking about ways to implement this. I hadn’t considered the parent-child-child concept, in which I could place the variables into the individual controller devices, but it’s probably a lot more user friendly to have the cycle valve times all together.
FYI, my modifications to the ER plugin have been submitted to 325xi, for incorporation into his plugin at his discretion.

woodsby, what you’re doing is great, and as I mentioned I’d totally support if you decide to make your version available independently, ER++ I called it internally :slight_smile:
I would borrow network discovery - it’s great, but being a big fan of KISS approach I’d rather not have separate controls per valve in my version (although I might do something like that but for valve status presentation only… got to think about it).
Anyways, I can put your version besides mine at the download page so people can have their own decision.