diff --git a/README.md b/README.md index c323470..9b9e932 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,12 @@ mqtt_topicpath="location" mqtt_room="your pi's location" ``` +If you want to use ssl/tls for your mqtt broker add this line to your **mqtt_preferences** : +``` +mqtt_capath="/etc/ssl/certs/" +``` +_(/etc/ssl/certs is the default ca path for raspbian)_ + 11. **[CONFIGURE PRESENCE]** create file named **owner_devices** and include mac addresses of devices on separate lines. ``` diff --git a/presence.sh b/presence.sh index 82bf95d..76dfb7a 100755 --- a/presence.sh +++ b/presence.sh @@ -186,7 +186,11 @@ publish () { [ "$debug" == "1" ] && (>&2 echo -e "${PURPLE}$mqtt_topicpath$1 { confidence : $2, name : $name, scan_duration_ms: $4, timestamp : $stamp} ${NC}") #POST TO MQTT - $mosquitto_pub_path -h "$mqtt_address" -p "${mqtt_port:=1883}" -u "$mqtt_user" -P "$mqtt_password" -t "$mqtt_topicpath$1" -m "{\"confidence\":\"$2\",\"name\":\"$name\",\"scan_duration_ms\":\"$4\",\"timestamp\":\"$stamp\"}" + if [ -z ${mqtt_capath+x} ]; then + $mosquitto_pub_path -h "$mqtt_address" -p "${mqtt_port:=1883}" -u "$mqtt_user" -P "$mqtt_password" -t "$mqtt_topicpath$1" -m "{\"confidence\":\"$2\",\"name\":\"$name\",\"scan_duration_ms\":\"$4\",\"timestamp\":\"$stamp\"}" + else + $mosquitto_pub_path -h "$mqtt_address" -p "${mqtt_port:=1883}" -u "$mqtt_user" -P "$mqtt_password" --capath "$mqtt_capath" -t "$mqtt_topicpath$1" -m "{\"confidence\":\"$2\",\"name\":\"$name\",\"scan_duration_ms\":\"$4\",\"timestamp\":\"$stamp\"}" + fi fi }