drewying/VeraControl — pull request #3 by javaguy (2013-12-22 19:53:48+00:00)
Title: Pull Request for persisting devices through refresh devices

I made a few changes here related to persisting rooms & devices through a refreshDevices call. The reason for this is in my UX i map these objects to existing UI elements (e.g. Rooms has it's own controller, and each device in rooms has it's own control). Rather than having to refresh these relationships, it's easier to keep updating the same room object.

The way I did this was to introduce a roomsDictionary and deviceDictionary. On refreshDevices, I check first to see if a device or exists and then update its properties. If not then create a new one.

There is more work to be done (e.g. scenes is not yet a dictionary), but in general I feel that moving towards using dictionaries rather than arrays for objects would make them easier to manage in VeraControl and the views/controllers using them.

Let me know your thoughts on these changes.