X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/d63010ef6c3cc76ac2a035c0249c87a78e38d980..de2440e167bacd1cebff432611d5d837dfeddffd:/bin/weathermon?ds=sidebyside diff --git a/bin/weathermon b/bin/weathermon index 6980cc8..b8be15f 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -118,7 +118,9 @@ end function submitValue(type,id,param,val) - if web_url then + val = tonumber(val) + + if web_url and val then local url = web_url.."?stype="..url_encode(type).."&sid="..url_encode(id).."¶m="..url_encode(param).."&value="..url_encode(val) @@ -133,8 +135,8 @@ function submitValue(type,id,param,val) return req_sock end}) - if code ~= 200 then - print("writing record to backlog...") + if code ~= 200 and backlog_con then + printLog("writing record to backlog...") backlog_con:execute(string.format("INSERT INTO queue(time_stamp,sensor_id,sensor,param,value) VALUES (datetime('now','localtime'),'%s','%s','%s',%f)",id,type,param,val)) end @@ -385,6 +387,8 @@ else return end +serialin:setvbuf('no') + records = {} while 1 do