summaryrefslogtreecommitdiff
path: root/get-temps.rb
diff options
context:
space:
mode:
authorpks <pks@pks.rocks>2021-05-01 06:16:19 +0200
committerpks <pks@pks.rocks>2021-05-01 06:16:19 +0200
commit63fbf0f3aadb4b6d037a8164b501fe836d9c361d (patch)
treea33240dfd9ad5c57f283e942514bb8ce67d71085 /get-temps.rb
parent00fdbd489494c917865cf3fbf153e5751052e2d1 (diff)
v1
Diffstat (limited to 'get-temps.rb')
-rwxr-xr-xget-temps.rb9
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