From b0a690ee18f5c2f894edc7c30fd6204c262670fe Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Fri, 28 Oct 2016 12:32:59 +0300 Subject: [PATCH] =?utf8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?utf8?q?=D0=B0=20"=D0=BF=D0=BE=D0=BB=D1=83=D0=BF=D1=83=D1=81=D1=82=D1=8B?= =?utf8?q?=D1=85"=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9=20=D1=82?= =?utf8?q?=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D1=81=20=D1=82=D0=B8=D0=BF?= =?utf8?q?=D0=BE=D0=BC=20=D0=B8=20ID=20=D0=B4=D0=B0=D1=82=D1=87=D0=B8?= =?utf8?q?=D0=BA=D0=B0=20-=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C?= =?utf8?q?=D0=BD=D0=BE=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B5=D0=BD=D1=81?= =?utf8?q?=D0=BE=D1=80=D0=BE=D0=B2=20=D0=B4=D0=B2=D0=B8=D0=B6=D0=B5=D0=BD?= =?utf8?q?=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- weathermon.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/weathermon.lua b/weathermon.lua index af38729..b43b72c 100755 --- a/weathermon.lua +++ b/weathermon.lua @@ -186,7 +186,7 @@ function processJson(str) for key,value in pairs(msg) do if value then - if key=="model" then + if key=="model" or key=="device" then sensor_type=value elseif key=="id" then sensor_id=value @@ -199,6 +199,9 @@ function processJson(str) end if not (sensor_type==nil or sensor_id==nil or sensor_type=='' or sensor_id=='') then + if next(sensor)==nil then + sensor["command"]="alarm" + end for k,v in pairs(sensor) do printLog("Type = "..sensor_type..", ID = "..sensor_id..", Param = "..k..", Value = "..v) submitValue(sensor_type,sensor_id,k,v) -- 2.34.1