diff options
Diffstat (limited to 'get-temps.rb')
-rwxr-xr-x | get-temps.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/get-temps.rb b/get-temps.rb index ac24051..f25540b 100755 --- a/get-temps.rb +++ b/get-temps.rb @@ -1,15 +1,20 @@ #!/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 + d["temperature"] = val.to_f end if name == "device_id" - d["dev"] = val + d["dev"] = devices[val] end } puts d.to_s |