Skip to content

A live bird collage card for your Home Assistant dashboard.

Revert "Update .gitignore"

lloydbayley4bf3c11bb86c
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index 542f14da..9193b9b0 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -2,6 +2,11 @@
# Configuration settings for BirdNET-Pi #
################################################################################
+# Site Name - Optional
+
+SITE_NAME=""
+
+
#--------------------- Required: Latitude, and Longitude ----------------------#
## Please only go to 4 decimal places. Example:43.3984
diff --git a/scripts/config.php b/scripts/config.php
index c581528e..7a64be23 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -22,6 +22,8 @@ if(isset($_GET['restart_php']) && $_GET['restart_php'] == "true") {
if(isset($_GET["latitude"])){
$latitude = $_GET["latitude"];
$longitude = $_GET["longitude"];
+ $site_name = $_GET["site_name"];
+ $site_name = preg_replace( '/[^A-Za-z0-9 ]/' , "", $site_name);
$birdweather_id = $_GET["birdweather_id"];
$apprise_input = $_GET['apprise_input'];
$apprise_notification_title = $_GET['apprise_notification_title'];
@@ -99,6 +101,7 @@ if(isset($_GET["latitude"])){
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
+ $contents = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents);
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
$contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
@@ -114,6 +117,7 @@ if(isset($_GET["latitude"])){
$contents = preg_replace("/APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=.*/", "APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=$minimum_time_limit", $contents);
$contents2 = file_get_contents("./scripts/thisrun.txt");
+ $contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
$contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2);
@@ -295,6 +299,8 @@ function sendTestNotification(e) {
<table class="settingstable"><tr><td>
<h2>Location</h2>
+ <label for="site_name">Site Name: </label>
+ <input name="site_name" type="text" value="<?php print($config['SITE_NAME']);?>"/> (Optional)<br>
<label for="latitude">Latitude: </label>
<input name="latitude" type="number" max="90" min="-90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
<label for="longitude">Longitude: </label>
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index 4d2c79d4..09334adf 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -13,12 +13,17 @@ install_config() {
# Configuration settings for BirdNET-Pi #
################################################################################
+# Optional: Site Title for banner
+
+SITE_NAME="$HOSTNAME"
+
#--------------------- Required: Latitude, and Longitude ----------------------#
## The shell substitution below guesses these based on your network. THESE NEED
## TO BE CHANGED TO STATIC VALUES
## Please only go to 4 decimal places. Example:43.3984
+
LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude)
LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude)
diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh
index 729f264c..5f0170cc 100755
--- a/scripts/update_birdnet_snippets.sh
+++ b/scripts/update_birdnet_snippets.sh
@@ -10,6 +10,11 @@ my_dir=$HOME/BirdNET-Pi/scripts
sudo -E chown -R $USER:$USER $HOME/*
sudo chmod -R g+wr $HOME/*
+# Create blank sitename as it's optional. First time install will use $HOSTNAME.
+if ! grep SITE_NAME /etc/birdnet/birdnet.conf &>/dev/null;then
+ sudo -u$USER echo "SITE_NAME=\"\"" >> /etc/birdnet/birdnet.conf
+fi
+
if ! grep PRIVACY_THRESHOLD /etc/birdnet/birdnet.conf &>/dev/null;then
sudo -u$USER echo "PRIVACY_THRESHOLD=0" >> /etc/birdnet/birdnet.conf
git -C $HOME/BirdNET-Pi rm $my_dir/privacy_server.py