Skip to content

A live bird collage card for your Home Assistant dashboard.

apprise starting point

ehpersonal389e5331168c03
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index d1dd7b93..e0e38a2d 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -68,16 +68,6 @@ RTSP_STREAM=
PUSHED_APP_KEY=
PUSHED_APP_SECRET=
-#------------------- Browser Notifications via Notify.run -------------------#
-#________________The variable below enables browser notifications______________#
-#________________________See https://notify.run/ to get________________________#
-#_________________ __these subscription URL for your device.___________________#
-
-# Keep these EMPTY if haven't setup a Notify.run Channel yet. #
-
-## Notify.run Channel ID
-
-NOTIFY_RUN_CHANNEL_ID=
################################################################################
#-------------------------------- Defaults ----------------------------------#
diff --git a/requirements.txt b/requirements.txt
index 9f651b44..22f27e29 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,3 +10,4 @@ pandas
seaborn
streamlit
plotly
+apprise
\ No newline at end of file
diff --git a/scripts/config.php b/scripts/config.php
index cebf813c..a71e5294 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -9,7 +9,7 @@ $longitude = $_GET["longitude"];
$birdweather_id = $_GET["birdweather_id"];
$pushed_app_key = $_GET["pushed_app_key"];
$pushed_app_secret = $_GET["pushed_app_secret"];
-$notify_run_channel = $_GET["notify_run_channel"];
+$apprise_input = $_GET['apprise_input'];
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
@@ -32,6 +32,10 @@ $fh2 = fopen("./scripts/thisrun.txt", "w");
fwrite($fh, $contents);
fwrite($fh2, $contents2);
+$appriseconfig = fopen("~/.apprise");
+fwrite($appriseconfig, $apprise_input);
+
+
$language = $_GET["language"];
if ($language != "none"){
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
@@ -57,6 +61,11 @@ if (file_exists('./scripts/thisrun.txt')) {
} elseif (file_exists('./scripts/firstrun.ini')) {
$config = parse_ini_file('./scripts/firstrun.ini');
}
+if (file_exists('~/.apprise')) {
+ $apprise_config = file_get_contents('~/.apprise');
+} else {
+ $apprise_config = "";
+}
$caddypwd = $config['CADDY_PWD'];
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
@@ -88,9 +97,9 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
<input name="pushed_app_secret" type="text" value="<?php print($config['PUSHED_APP_SECRET']);?>" /><br>
<p><a target="_blank" href="https://pushed.co/quick-start-guide">Pushed iOS Notifications</a> can be setup and enabled for New Species notifications. Be sure to "Enable" the "Pushed Notifications" in "Tools" > "Services" if you would like to use this feature. Sorry, Android users, this only works on iOS.</p>
- <label for="notify_run_channel">Notify.run Channel ID: </label>
- <input name="notify_run_channel" type="text" value="<?php print($config['NOTIFY_RUN_CHANNEL_ID']);?>" /><br>
- <p><a target="_blank" href="https://notify.run/">Notify.run browser notifications</a> can be setup and enabled for New Species notifications.</p>
+ <label for="apprise_input">Apprise Notifications Configuration: </label>
+ <textarea name="apprise_input" type="text" ><?php print($apprise_config);?></textarea>
+ <p><a target="_blank" href="https://github.com/caronc/apprise/wiki">Apprise Notifications</a> can be setup and enabled for New Species notifications.</p>
<label for="language">Database Language: </label>
<select name="language">
diff --git a/scripts/species_notifier.sh b/scripts/species_notifier.sh
index a4416126..95b67200 100755
--- a/scripts/species_notifier.sh
+++ b/scripts/species_notifier.sh
@@ -33,5 +33,9 @@ ${NOTIFICATION}"
--form-string "content=${NOTIFICATION}" \
https://api.pushed.co/1/push
fi
+
+ if [ ! -s ~/.apprise ];then
+ apprise -vv -t 'New Species Detected' -b ${NOTIFICATION}
+ fi
fi
diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh
index 3c451740..88a9bc43 100755
--- a/scripts/update_birdnet_snippets.sh
+++ b/scripts/update_birdnet_snippets.sh
@@ -15,3 +15,8 @@ fi
if ! which lsof &>/dev/null;then
sudo apt update && sudo apt -y install lsof
fi
+apprise_installation_status=$(~/BirdNET-Pi/birdnet/bin/python3 -c 'import pkgutil; print("installed" if pkgutil.find_loader("apprise") else "not installed")')
+if [[ "$apprise_installation_status" = "not installed" ]];then
+ ~/BirdNET-Pi/birdnet/bin/pip3 install -U pip
+ ~/BirdNET-Pi/birdnet/bin/pip3 install apprise
+fi
\ No newline at end of file