Add Home Assistant integration discovery (#243)

* Add Home Assistant integration discovery

* Update motioneye/rootfs/etc/services.d/motioneye/discovery

Co-authored-by: Paul Sinclair <24625998+sinclairpaul@users.noreply.github.com>

Co-authored-by: Paul Sinclair <24625998+sinclairpaul@users.noreply.github.com>
This commit is contained in:
Franck Nijhof 2021-05-22 17:15:53 +02:00 committed by GitHub
parent 926dcb610c
commit 7ca83578fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 "motioneye" "${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[@]}"