I am new with vera, but have been playing with home automation for a while. I have a home brew system, written in C running (currently) on Mac os/x. I read the “http://wiki.micasaverde.com/index.php/Luup_Intro” on how to do a system data dump. I entered a " http://myip:49451/data_request?id=lu_status" in a browser. It worked, and my browser returned a long list of data. I was able to read the data, but have no idea what it means.
I hope to parse the data with PCRE library in C, but need to understand what I am looking at before I can parse.
Any pointers as to what the data means and how it is formatted would be great!
You will need a JSON parser to read this data effectively.
There are plenty out there for various languages.
Search the web for a JSON pretty printer to format your data.
It will help you to understand the format of the data.
It contains lists of rooms and their details, devices and their details, scenes and their details, …
You would have to write a book to explain it all.
Keep digging at the wiki as it will have some of the data you are looking for. I would advise that depending on what type of data you are looking for, you might want to use the following link:
veraip:3480/data_request?id=lu_sdata
The lu_sdata provides a much smaller data set with most of the required info needed. E.g. rooms, scenes, devices, sections, etc. It is also a fraction about 10 - 20 times smaller in size the the data you are pulling which is called the user_data. The port you should be using is 3480 as 49451 I believe is an old port kept for backwards compatibility.
Looks right to me … what did you expect ?
You need to do a recursive descent to decode all the details.
Did you try a Pretty Printer first to see what the data looks like ?
Thanks! Now I see. Just one little print statement makes all the difference.
Now all I have to do is figure out how to get this information back into my homebrew system…
#puts result #uncomment to see all the data in unformatted JSON format
trends = result[‘devices’] #now filter on only devices
trends.each do |subject|
pp subject #dump each element as it is read
puts ‘’
altid = subject[‘altid’]
name = subject[‘name’]
id = subject[‘id’] #pp subject[‘altid’]
if altid =~ /./ #filter on the xx.xx.xx address lookng for the . #puts “found an insteon device:”
status = subject[‘status’]
if status.nil?
puts name + " " + altid + " " + " no status"
else
puts name + " " + altid + " " + status
end
end
if name == “Thermostat” # example of looking for something else…here the thermostat with whatever parameters are useful #puts “Found the thermostat”
mode = subject[‘mode’]
hvacstate = subject[‘hvacstate’]
temp = subject[‘temperature’] #puts id + " " + mode + " " + hvacstate + " " + temp
puts id
puts mode
puts hvacstate
puts temp
end
end
Best Home Automation shopping experience. Shop at Ezlo!