Add Home Assistant integration discovery

This commit is contained in:
Franck Nijhof 2021-05-20 22:12:50 +02:00
parent 926dcb610c
commit f0cb073db0
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: motionEye
# Send Discovery information to Home Assistant
# ==============================================================================
declare config
# Wait for motionEye to start before continuing
bashio::net.wait_for 28765
# Create discovery config payload for Home Assistant
config=$(bashio::var.json \
url "http://127.0.0.1:28765"
)
# Send discovery info
if bashio::discovery "mmotioneye" "${config}" > /dev/null; then
bashio::log.info "Successfully send discovery information to Home Assistant."
else
bashio::log.error "Discovery message to Home Assistant failed!"
fi

View file

@ -15,5 +15,8 @@ if bashio::debug; then
options+=(-d)
fi
# Send out discovery information
./discovery &
# Run the motionEye
exec meyectl startserver "${options[@]}"