function printLog(str)
if logging=="yes" then
capture("logger -t beaconmon \""..str.."\"")
- print(str)
- elseif logging=="syslog" then
- capture("logger -t beaconmon \""..str.."\"")
- elseif logging=="stdout" then
+ else
print(str)
end
end
end
function mqtt_pub(path,value)
- res=mqtt_client:publish(path,value)
+ res=mqtt_client:publish(path,value,0,false)
printLog("Pub "..path.." returned "..res);
return res
end
if not pcall(mqtt_pub,mqtt_path,dump(packet)) then
printLog('Reconnecting MQTT...')
- mqtt_client:connect(mqtt_id)
+ mqtt_client:connect(mqtt_host,mqtt_port)
end
end