A live bird collage card for your Home Assistant dashboard.
Apprise ONLY notify for certain species
ehpersonal386d3857b86e5f
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaultsindex 03ca9f5d..58a30fda 100644--- a/birdnet.conf-defaults+++ b/birdnet.conf-defaults@@ -78,6 +78,7 @@ APPRISE_WEEKLY_REPORT=1APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=0APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=0APPRISE_ONLY_NOTIFY_SPECIES_NAMES=""+APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=""#---------------------- Flickr Images API Configuration -----------------------### If FLICKR_API_KEY is set, the web interface will try and display bird imagesdiff --git a/scripts/config.php b/scripts/config.phpindex 0a1ecf38..0dcdbe5a 100644--- a/scripts/config.php+++ b/scripts/config.php@@ -54,6 +54,7 @@ if(isset($_GET["latitude"])){$model = $_GET["model"];$sf_thresh = $_GET["sf_thresh"];$only_notify_species_names = $_GET['only_notify_species_names'];+ $only_notify_species_names_2 = $_GET['only_notify_species_names_2'];if(isset($_GET['apprise_notify_each_detection'])) {$apprise_notify_each_detection = 1;@@ -150,6 +151,7 @@ if(isset($_GET["latitude"])){$contents = preg_replace("/MODEL=.*/", "MODEL=$model", $contents);$contents = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents);$contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents);+ $contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents);$contents2 = file_get_contents("./scripts/thisrun.txt");$contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);@@ -169,6 +171,7 @@ if(isset($_GET["latitude"])){$contents2 = preg_replace("/MODEL=.*/", "MODEL=$model", $contents2);$contents2 = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents2);$contents2 = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents2);+ $contents2 = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents2);@@ -550,7 +553,9 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}<label for="minimum_time_limit">Minimum time between notifications of the same species (sec):</label><input type="number" id="minimum_time_limit" name="minimum_time_limit" value="<?php echo $config['APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES'];?>" min="0"><br><label for="only_notify_species_names">Exclude these species (comma separated common names):</label>- <input type="text" id="only_notify_species_names" placeholder="Northern Cardinal,American Crow,Carolina Chickadee" name="only_notify_species_names" value="<?php echo $config['APPRISE_ONLY_NOTIFY_SPECIES_NAMES'];?>" size=96><br>+ <input type="text" id="only_notify_species_names" placeholder="Mourning Dove,American Crow" name="only_notify_species_names" value="<?php echo $config['APPRISE_ONLY_NOTIFY_SPECIES_NAMES'];?>" size=96><br>+ <label for="only_notify_species_names_2">ONLY notify for these species (comma separated common names):</label>+ <input type="text" id="only_notify_species_names_2" placeholder="Northern Cardinal,Carolina Chickadee,Eastern Bluebird" name="only_notify_species_names_2" value="<?php echo $config['APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2'];?>" size=96><br><br>diff --git a/scripts/install_config.sh b/scripts/install_config.shindex 64d83e32..023c1351 100755--- a/scripts/install_config.sh+++ b/scripts/install_config.sh@@ -106,6 +106,7 @@ APPRISE_WEEKLY_REPORT=1APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=0APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=0APPRISE_ONLY_NOTIFY_SPECIES_NAMES=""+APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=""#---------------------- Flickr Images API Configuration -----------------------### If FLICKR_API_KEY is set, the web interface will try and display bird imagesdiff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.shindex bc0cc7e3..1e88eb96 100755--- a/scripts/update_birdnet_snippets.sh+++ b/scripts/update_birdnet_snippets.sh@@ -190,6 +190,9 @@ fiif ! grep APPRISE_ONLY_NOTIFY_SPECIES_NAMES /etc/birdnet/birdnet.conf &>/dev/null;thensudo -u$USER echo "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"\"" >> /etc/birdnet/birdnet.conffi+if ! grep APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 /etc/birdnet/birdnet.conf &>/dev/null;then+ sudo -u$USER echo "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"\"" >> /etc/birdnet/birdnet.conf+fiif ! grep RTSP_STREAM_TO_LIVESTREAM /etc/birdnet/birdnet.conf &>/dev/null;thensudo -u$USER echo "RTSP_STREAM_TO_LIVESTREAM=\"0\"" >> /etc/birdnet/birdnet.confdiff --git a/scripts/utils/notifications.py b/scripts/utils/notifications.pyindex eaee216c..99265a5f 100644--- a/scripts/utils/notifications.py+++ b/scripts/utils/notifications.py@@ -51,6 +51,11 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latituif APPRISE_ONLY_NOTIFY_SPECIES_NAMES is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES.strip() != "":if any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES.split(",")):return++ APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 = settings_dict.get('APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2')+ if APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.strip() != "":+ if not any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.split(",")):+ returnAPPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES = settings_dict.get('APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES')if APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES != "0":