Well, I’m at the point in my development where I’m automating the polling / pairing of devices with Vera. Unfortunately it seems that you can only create child devices once? You can’t truly append new child devices without wiping out any existing ones?
I couldn’t tell from this thread exactly how this is being worked around.
It sounds like they are talking about storing data (variables, attributes, etc.) from the “existing” children so that when they are re-created upon another append, they are updating the child device properties…kind of like a “restore”.
It’s true that you have to enumerate all children each time you do a luup.chdev.* sequence, so you can’t “append” in that sense. But if you use a persistent string for the “alternate ID” argument in your call to luup.chdev.append(), MiOS is smart enough to re-use the child device that already has that ID from before, and you keep all its current variables. Only if you invent a new altID do you get new child, and only if you fail to re-mention an already-existing altID do you have an existing child deleted.
The trick, then, is in choosing a decent persistent string to use as an altID. For an alarm system, it makes sense to use “Z1” for zone 1, “Z2” for zone 2, and so on, because when you probe the system tomorrow you’ll get the same numbers for the same zones. I just prepended the Z so that I have room for naming other class of child device such as partitions. For your lighting system, maybe each group has a name (or, better, a unique integer or UUID) that you can use for this purpose.
Thanks, futzle… that’s a bit of a relief! I’ve been using what’s known as the “group ID” for the lights. The group ID is actually managed internally by the lighting system, but it does not change unless the user starts manually changing groups, does factory resets on his devices, etc.
I’ll just make sure to create my alt-ids with a prepended identifier as you suggest to limit the risk of clashing with any non-lighting devices when they are created.
Best Home Automation shopping experience. Shop at Ezlo!