add check for ha uri

This commit is contained in:
Antonio J. Delgado 2023-03-20 22:31:01 +02:00
parent fea32df8bc
commit 072ae9c267

View file

@ -239,11 +239,13 @@ if [ -n "${ntfy_server}" ]; then
fi
fi
message "Sending event to Home Assistant ..."
result=$(curl -s -X POST -H "Authorization: Bearer ${ha_token}" -H "Content-Type: application/json" "${ha_url}/api/events/motion_event" -d "${data}")
return_code=$?
if [ $return_code != 0 ]; then
message "Error ${return_code} sending to Home Assistant '${ha_url}'"
if [ -n "${ha_url}" ]; then
message "Sending event to Home Assistant ..."
result=$(curl -s -X POST -H "Authorization: Bearer ${ha_token}" -H "Content-Type: application/json" "${ha_url}/api/events/motion_event" -d "${data}")
return_code=$?
if [ $return_code != 0 ]; then
message "Error ${return_code} sending to Home Assistant '${ha_url}'"
fi
fi
if ${remove_picture}; then