blob: f25540ba8372ccb081afdde692b7c3d273317885 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/env ruby
$devices = { "f4:01" => "outside", "1f:01" => "inside" }
while line = STDIN.gets
a = line.split
d = {}
a.each { |i|
name, val = i.split("::")
if name == "timestamp"
d["timestamp"] = val.to_f
end
if name == "temperature"
d["temperature"] = val.to_f
end
if name == "device_id"
d["dev"] = devices[val]
end
}
puts d.to_s
end
|