I’ve been messing around off and on for quite some time with controlling Vera through UI Simple polling. The main issue I have is that the data that is returned from Vera seems to be a bit random. In particular, it seems that it is never clear what fields are going to be retruned from a certain device. It makes it a bit tough to map to SQL tables for instance!
I’ve been handling this by checking to see if fields I expect are in the JSON and if not storing empty values. As I can’t be sure what is going to be present in a JSON update for the devices I care about I typically push the new values to my table first and then process that device data from there.
As an example, “category” might not be a field in the update lu_sdata, and so if I have any logic that gets executed for a Binary Light I have to grab the Category for the updated device from initial data load to see if it is a Binary Light. I know that most of these fields aren’t supposed to change on a normal update, so this does make sense, except for the fact that it isn’t just changed fields that are pushed out.
The bottom line is that there is a lot to keep track of and I have had a few false starts. I think it would be useful to have this documented better so we don’t all have to recreate the wheel each time we work on a Vera client. Is there any interest in taking a stab at this as a community? For instance, figuring out how best to map JSON to SQL tables (or classes, etc) and then how to handle updated data. I think either better documentation or preferable an open source Vera library would be good. I am certainly happy to share anything I have. Right now it isn’t working quite right or I would have it posted already.
I’m attempting this with Python right now am experimenting with both SQL and Python classes to store the data. I would certainly be happy to try this with something else (Java?) instead.