X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/0a2693126165f68131a1d1686a2bee1f1967494d..d63010ef6c3cc76ac2a035c0249c87a78e38d980:/bin/weathermon-iio?ds=sidebyside diff --git a/bin/weathermon-iio b/bin/weathermon-iio index 7fe5f68..df32c3a 100755 --- a/bin/weathermon-iio +++ b/bin/weathermon-iio @@ -189,16 +189,17 @@ if not delay then end while true do - values = get_parameters(parameters) - records = {} - records[web_id] = {} - for key,record in pairs(values) do - records[web_id][key] = record - records[web_id]["timestamp"] = os.date("%Y-%m-%dT%H:%M:%S") - end - for key,value in pairs(values) do - value["device"] = key - print(json.encode(value)) + if pcall(function () values = get_parameters(parameters) end) then + records = {} + records[web_id] = {} + for key,record in pairs(values) do + records[web_id][key] = record + records[web_id]["timestamp"] = os.date("%Y-%m-%dT%H:%M:%S") + end + for key,value in pairs(values) do + value["device"] = key + print(json.encode(value)) + end end socket.sleep(delay) end