Adding and removing children... on the fly
I would like to create a node that can learn and replay 433Mhz signals of cheap power sockets.
- I would like for the user be able to teach that node new codes at any time, and then have the new code show up as a new switch in the controller.
- I would like for the user to be able to remove a code, and then also have the switch 'disappear' in the controller.
- Is it possible to call the present function at any time? Do controllers support this? Or would it freak them out? If so, is there a way around that? I was thinking perhaps I can force the Arduino to reboot at that point, and present a higher sketch version with the additional child (from eeprom data).
- From my limited experience with Domoticz, it won't remove a switch from the interface even though the MySensors device has disappeared, so it probably won't so anything when one shrink either (right?). But perhaps it can be set to a timeout state somehow, so that it is visually indicated as obsolete?
- Alternatively, perhaps removal shouldn't matter. If the node itself remembers which one has been 'removed', then it can overwrite that child if a user decides to add a code again. In the controller interface the ghost switch will then come back to life. A snag here is that the switch might still have an old name ("bedroom light") while the switch now controls the lights in another room.
Curious to hear any thoughts. Has anyone tried these things before? Searching on the forum ("variable children count", etc) I didn't find anything.
@alowhum calling present at any time should work. The controller wouldn’t know if the node rebooted or presented without rebooting so no extra support is needed.
There is no need to change sketch version. That field is for information only.
I don't think controllers support removing anything automatically. Maybe if they have an external api. I'm unable to find anything like that in the Domoticz api: http://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
But since it is possible to delete stuff from the Domoticz web UI, maybe you can just check what a delete request looks like?