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
fi fi
message "Sending event to Home Assistant ..." if [ -n "${ha_url}" ]; then
result=$(curl -s -X POST -H "Authorization: Bearer ${ha_token}" -H "Content-Type: application/json" "${ha_url}/api/events/motion_event" -d "${data}") message "Sending event to Home Assistant ..."
return_code=$? result=$(curl -s -X POST -H "Authorization: Bearer ${ha_token}" -H "Content-Type: application/json" "${ha_url}/api/events/motion_event" -d "${data}")
if [ $return_code != 0 ]; then return_code=$?
if [ $return_code != 0 ]; then
message "Error ${return_code} sending to Home Assistant '${ha_url}'" message "Error ${return_code} sending to Home Assistant '${ha_url}'"
fi
fi fi
if ${remove_picture}; then if ${remove_picture}; then