From 67f3d398664cc319615339c1ce9c525e672c332f Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Mon, 3 Dec 2018 01:21:27 +0300 Subject: [PATCH] =?utf8?q?1)=20=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4?= =?utf8?q?=20=D0=BD=D0=B0=20=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BA?= =?utf8?q?=D1=83=20=D0=B1=D0=B5=D0=B7=20=D0=B3=D0=B0=D1=80=D0=B0=D0=BD?= =?utf8?q?=D1=82=D0=B8=D0=B8=20(=D1=81=D1=82=D0=B0=D1=80=D1=8B=D0=B5=20?= =?utf8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BF=D0=B8?= =?utf8?q?=D1=82=D1=8C=20=D0=BD=D0=B5=D1=82=20=D1=81=D0=BC=D1=8B=D1=81?= =?utf8?q?=D0=BB=D0=B0)=202)=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?utf8?q?=D0=B5=D0=BD=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0?= =?utf8?q?=D1=86=D0=B8=D1=8F=20=D0=B2=20=D1=81=D0=BB=D1=83=D1=87=D0=B0?= =?utf8?q?=D0=B5=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20<=3D=20?= =?utf8?q?=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D1=83=20=D0=BE=D0=BA=D0=BD?= =?utf8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/weather-filter | 4 ++++ bin/weathermon | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/weather-filter b/bin/weather-filter index 1fc798f..84c2265 100755 --- a/bin/weather-filter +++ b/bin/weather-filter @@ -42,6 +42,10 @@ function filter_data(dataset,width) width = 7 end + if #dataset <= width then + return dataset + end + local result = {} local window_spread = math.floor(width/2) diff --git a/bin/weathermon b/bin/weathermon index 804ba25..cc58def 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -189,7 +189,7 @@ function processJson(str) if not mqtt_client:socket() then mqtt_client:reconnect() end - mqtt_client:publish(mqtt_path,v) + mqtt_client:publish(mqtt_path,v,0,0) mqtt_client:loop() end end @@ -252,7 +252,7 @@ function processLine(str) return '{'..name..'}' end end) - mqtt_client:publish(mqtt_path,v) + mqtt_client:publish(mqtt_path,v,0,0) mqtt_client:loop() end end @@ -293,7 +293,7 @@ function processLine(str) return '{'..name..'}' end end) - mqtt_client:publish(mqtt_path,msg_body) + mqtt_client:publish(mqtt_path,msg_body,0,0) mqtt_client:loop() end if alarm_exec then -- 2.34.1