From 63fbf0f3aadb4b6d037a8164b501fe836d9c361d Mon Sep 17 00:00:00 2001 From: pks Date: Sat, 1 May 2021 06:16:19 +0200 Subject: v1 --- get-temps.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'get-temps.rb') 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 -- cgit v1.2.3