Skip to content

A live bird collage card for your Home Assistant dashboard.

advertise http for easy discovery

frederikb820c195ca4c
diff --git a/scripts/install_services.sh b/scripts/install_services.sh
index dd3f802d..9fe1d4e6 100755
--- a/scripts/install_services.sh
+++ b/scripts/install_services.sh
@@ -233,6 +233,9 @@ WantedBy=multi-user.target
EOF
ln -sf $HOME/BirdNET-Pi/templates/[email protected] /usr/lib/systemd/system
systemctl enable avahi-alias@"$(hostname)".local.service
+ # symbolic link does not work here, so just copy
+ cp -f $HOME/BirdNET-Pi/templates/http.service /etc/avahi/services/
+ systemctl restart avahi-daemon.service
}
install_birdnet_stats_service() {
diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh
index e2c105d1..fb63a41b 100755
--- a/scripts/uninstall.sh
+++ b/scripts/uninstall.sh
@@ -27,6 +27,11 @@ remove_services() {
set +x
remove_icecast
remove_crons
+ remove_avahi_services
+}
+
+remove_avahi_services() {
+ sudo rm -v "/etc/avahi/services/http.service"
}
remove_crons() {
diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh
index 2c99612a..5157a952 100755
--- a/scripts/update_birdnet_snippets.sh
+++ b/scripts/update_birdnet_snippets.sh
@@ -154,6 +154,12 @@ if grep -q 'php7.4-' /etc/caddy/Caddyfile &>/dev/null; then
sed -i 's/php7.4-/php-/' /etc/caddy/Caddyfile
fi
+if ! [ -L /etc/avahi/services/http.service ];then
+ # symbolic link does not work here, so just copy
+ cp -f $HOME/BirdNET-Pi/templates/http.service /etc/avahi/services/
+ systemctl restart avahi-daemon.service
+fi
+
if [ -L /usr/local/bin/analyze.py ];then
rm -f /usr/local/bin/analyze.py
fi
diff --git a/templates/http.service b/templates/http.service
new file mode 100644
index 00000000..fffd21d3
--- /dev/null
+++ b/templates/http.service
@@ -0,0 +1,9 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+<service-group>
+<name replace-wildcards="yes">BirdNET-Pi %h</name>
+<service>
+<type>_http._tcp</type>
+<port>80</port>
+</service>
+</service-group>