function mqtt_encode(str)
if (str) then
str = string.gsub (str, "\n", "")
+ str = string.gsub (str, ":", "-")
str = string.gsub (str, "/", "-")
+ str = string.gsub (str, " ", "_")
end
return str
end
function printLog(str)
if logging=="yes" then
- capture("logger -t beaconmon "..str)
+ capture("logger -t beaconmon \""..str.."\"")
else
print(str)
end
function mqtt_pub(path,value)
res=mqtt_client:publish(path,value)
- printLog("Pub "..path.." "..value.." returned "..res);
+ printLog("Pub "..path.." returned "..res);
return res
end