X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/82c945cbf3ea97175cd2fba31f8ba92b9aade8ba..5bc9573c3235d959463e75f6103b027d6f5efe84:/bin/weathermon

diff --git a/bin/weathermon b/bin/weathermon
index ade5bfa..fdf092a 100755
--- a/bin/weathermon
+++ b/bin/weathermon
@@ -248,6 +248,9 @@ function processLine(str)
                 return '{'..name..'}'
               end      
             end)
+          if not mqtt_client:socket() then
+            mqtt_client:reconnect()
+          end  
           mqtt_client:publish(mqtt_path,v,0,false)
           mqtt_client:loop()
         end  
@@ -289,6 +292,9 @@ function processLine(str)
               return '{'..name..'}'
             end      
           end)
+        if not mqtt_client:socket() then
+          mqtt_client:reconnect()
+        end  
         mqtt_client:publish(mqtt_path,msg_body,0,false)
         mqtt_client:loop()
       end