help understanding data dump

Greetings all

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!

Thanks,
Schenkl

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.

Welcome,

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.

Here is a link that should be of interest:

http://wiki.micasaverde.com/index.php/UI_Simple

  • Garrett

Thanks for the pointers…but I still am having trouble. I thought that I would try parsing the json output with Ruby…the code is:

require “rubygems”
require “json”
require “net/http”
require “uri”

uri = URI.parse(“http://192.168.1.77:3480/data_request?id=lu_sdata”)

http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)

response = http.request(request)

puts response #prints out entire vera response
puts""

if response.code == “200”
result = JSON.parse(response.body)

result.each do |doc|
puts doc # this is the result in object form
puts “”
puts “”
end
else
puts “ERROR!!!”
end

But the output does not make any sense to me:
I guess that Ruby doesn’t parse it correctly.
Any other suggestions?

Many thanks!

Here is the output:

irtx

scenes
active1room0id3nameMotionTriggered
active0room1id2nameMusic Room Lights
active1state-1commentroom1id1nameTemperature Triggered

rooms
section1id3nameKitchen
section1id2nameLibrary
section1id1nameMusic Room

zwave_heal
1

dataversion
201806367

fwd2
fwd1.mios.com

fwd1
fwd2.mios.com

serial_number
30005828

version
1.5.408

full
1

state
-1

categories
id2nameDimmable Light
id3nameSwitch
id4nameSensor
id5nameThermostat
id16nameHumidity Sensor
id17nameTemperature Sensor

devices
altid0a.a8.75status1loadsense0parent7ledstatus1subcat9category3ledduringtx1subcategory-1programlock0devcat2room0id15nameAlllianceLinc
altid3state-1status0parent1category3commentsubcategory0room0id6nameAppliance Module
altid2level0state-1status0parent1category2commentsubcategory0room0id5nameDimmable Light
altid0e.7e.18level1resumedim1loadsense1status1parent7ledstatus1subcat0category2ledduringtx1subcategory-1programlock0devcat1room0id16nameDimmer3
altidWeather-Forecast-HighTemperatureparent9category17temperature25subcategory0room0id12nameHigh Temperature
altidWeather-Current-Humidityhumidity90parent9category16subcategory0room0id13nameHumidity
altidWeather-Forecast-LowTemperatureparent9category17temperature18subcategory0room0id11nameLow Temperature
armed0tripped0altid13.ef.bfparent7subcat1category4subcategory3devcat16room0id17nameMD_1
altid1b.76.29loadsense1status0parent7ledstatus1subcat9category3ledduringtx1subcategory-1programlock0devcat2room0id8nameMusic Room Plug Relay
altidplmparent0category0subcategory-1ip192.168.1.77room0id7nameplm
altidWeather-Current-Temperatureparent9category17temperature9.4subcategory0room0id10nameTemperature
altid4coolsp78state-1status1heatsp65parent1modeHeatOncategory5commenttemperature65subcategory1hvacstateIdlefanmodePeriodicOnroom0id18nameThermostat
altidvariablename5Variable5variablename4Variable4variablename3Variable3variablename2Variable2variablename1Solar Power Levelvariable50variable40variable30variable20variable130parent0category0subcategory-1room0id22nameVariableContainer
altidlevel0status0parent0category2subcategory0room0id14nameWake Up Light
windspeed0.0windconditionCalmaltidproviderkeyb5c951b4a155900econditiongroupcloudyconditionOvercastwinddirectionSSEparent0providernameWUI (Weather Underground)category0providerurlhttp://www.wunderground.comsubcategory-1room0id9nameWorld Weather

comment

loadtime
1357201806

temperature
F

sections
id1nameMy Home

model
Sercomm NA900

ir
0

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…

Many thanks to all the help. I will post my mini-program if anyone else is interested. It is easily modified to fit what ever situation…

Regards,
Schenkl

require ‘rubygems’
require ‘open-uri’
require ‘json’
require ‘pp’

url = ‘http://192.168.1.77:3480/data_request?id=lu_sdata

buffer = open(url, “UserAgent” => “Ruby-Wget”).read

convert JSON data into a hash

result = JSON.parse(buffer)

#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