Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Update unifi-video-mqtt.sh #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions unifi-video-mqtt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
UNIFI_MOTION_LOG=/var/log/unifi-video/motion.log

# MQTT Vars
MQTT_SERVER="192.168.x.x"
MQTT_PORT="1883"
MQTT_TOPIC_BASE="camera/motion"
#MQTT_SERVER="192.168.x.x"
#MQTT_PORT="1883"
#MQTT_TOPIC_BASE="camera/motion"

# MQTT User/Pass Vars, only use if needed
#MQTT_USER="username"
#MQTT_PASS="password"
#MQTT_ID="yourid" ## To make it work with hassio

# Camera Defs
CAM1_NAME="camera_name"
CAM1_ID="F0xxxxxxxxxx"
#CAM1_NAME="camera_name"
#CAM1_ID="F0xxxxxxxxxx"

# --------------------------------------------------------------------------------
# Script starts here
Expand Down Expand Up @@ -50,7 +50,7 @@ while inotifywait -e modify $UNIFI_MOTION_LOG; do

LAST_EVENT=`echo $LAST_MESSAGE | cut -d ':' -f 5 | cut -d ' ' -f 1`

if echo $LAST_CAM | grep -n1 $CAM1_ID; then
if echo $LAST_CAM | grep $CAM1_ID; then
# Camera 1 triggered
if [[ $LAST_EVENT == "start" ]]; then
echo "Motion started on $CAM1_NAME"
Expand Down