From f461190e22a97bde985b067ce01c4ed9c74f7e62 Mon Sep 17 00:00:00 2001 From: pks Date: Sat, 1 May 2021 06:17:55 +0200 Subject: v1 --- v1/get-temps.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 v1/get-temps.rb (limited to 'v1/get-temps.rb') diff --git a/v1/get-temps.rb b/v1/get-temps.rb new file mode 100755 index 0000000..f25540b --- /dev/null +++ b/v1/get-temps.rb @@ -0,0 +1,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 -- cgit v1.2.3