A live bird collage card for your Home Assistant dashboard.
better overview
mcguirepr895c07c471bf60
diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.shindex d4f72c6d..7c8498cf 100755--- a/scripts/clear_all_data.sh+++ b/scripts/clear_all_data.sh@@ -16,8 +16,6 @@ sudo rm -f $(dirname ${my_dir})/BirdDB.txtecho "Creating necessary directories"[ -d ${EXTRACTED} ] || sudo -u ${USER} mkdir -p ${EXTRACTED}[ -d ${EXTRACTED}/By_Date ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Date-[ -d ${EXTRACTED}/By_Common_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Common_Name-[ -d ${EXTRACTED}/By_Scientific_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Scientific_Name[ -d ${EXTRACTED}/Charts ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/Charts[ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED}@@ -70,8 +68,8 @@ sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOMEecho "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html-chmod -R g+rw $(dirname ${my_dir})-chmod -R g+rw ${RECS_DIR}+sudo chmod -R g+rw $(dirname ${my_dir})+sudo chmod -R g+rw ${RECS_DIR}echo "Generating BirdDB.txt"if ! [ -f $(dirname ${my_dir})/BirdDB.txt ];then@@ -81,10 +79,10 @@ elif ! grep Date $(dirname ${my_dir})/BirdDB.txt;thensudo -u ${USER} sed -i '1 i\Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap' $(dirname ${my_dir})/BirdDB.txtfiln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt &&- chown pi:pi ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt+sudo chown pi:pi ${my_dir}/BirdDB.txt && sudo chmod g+rw ${my_dir}/BirdDB.txtecho "Dropping and re-creating database"-sudo /home/pi/BirdNET-Pi/scripts/createdb_bullseye.sh+sudo /home/pi/BirdNET-Pi/scripts/createdb.shecho "Restarting services"sudo systemctl start birdnet_recording.servicediff --git a/scripts/createdb.sh b/scripts/createdb.shindex 70145f3c..bfeece3b 100755--- a/scripts/createdb.sh+++ b/scripts/createdb.sh@@ -8,6 +8,7 @@# the DB, be sure to run this as root or with sudosource /etc/birdnet/birdnet.confsqlite3 /home/pi/BirdNET-Pi/scripts/birds.db << EOF+DROP TABLE IF EXISTS detections;CREATE TABLE IF NOT EXISTS detections (Date DATE,Time TIME,diff --git a/scripts/daily_plot.py b/scripts/daily_plot.pyindex 7632aede..096279ba 100755--- a/scripts/daily_plot.py+++ b/scripts/daily_plot.py@@ -153,7 +153,7 @@ heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day)heat=(heat+heat_frame).fillna(0)#Generatie heatmap plot-plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)+plot = sns.heatmap(heat, norm=LogNorm(), annot=True, fmt="g", annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)plot.set_xticklabels(plot.get_xticklabels(), rotation = 0, size = 7)# Set heatmap borderdiff --git a/scripts/overview.php b/scripts/overview.phpindex d355d396..c8c62c92 100644--- a/scripts/overview.php+++ b/scripts/overview.php@@ -47,6 +47,13 @@ a {text-decoration: none;color:black;}+table, th {+ background-color: rgb(119, 196, 135);+ border:none;+}+th {+ padding: 0 5px;+}.center {display: block;margin-left: 5px;@@ -64,47 +71,42 @@ a {</style></head><body style="background-color: rgb(119, 196, 135);">- <h2>Overview</h2>-<div class="row">- <div class="column2">- <table>- <tr>- <th>Most Recent Detection</th>- <td><a href="/By_Date/<?php echo $myDate."/".$comname;?>"><?php echo $mostrecent['Com_Name'];?></a></td>- <td><a href="/By_Date/<?php echo$myDate."/".$comname."/".$mostrecent['File_Name'];?>" target="footer"/><?php echo $mostrecent['Date']." ".$mostrecent['Time'];?></a></td>- <td><?php echo $mostrecent['Confidence'];?></td>- <td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/>More Info</a></td>- </tr>- </table>+ <div></div>-</div>--<div class="row">- <div class="column">- <table>+ <table style="padding-bottom:3%;display:block;width:50%;margin-left:auto;margin-right:auto;"><tr>- <th></th><th>Total</th><th>Today</th><th>Last Hour</th>+ <th>Species Detected Today</th></tr><tr>- <th>Number of Detections</th><td><?php echo $totalcount['COUNT(*)'];?></td><td><a href="/By_Date/<?php echo date('Y-m-d');?>"/><?php echo $todaycount['COUNT(*)'];?></a></td><td><?php echo $hourcount['COUNT(*)'];?></td>+ <td><a href="/stats.php"/><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></a></td></tr></table>- </div>- <div class="column">- <table>+</div>+ <div>++ <table style="padding-bottom:3%;display:block;width:90%;margin-left:auto;margin-right:auto;"><tr>- <th>Species Detected Today</th>- <td><a href="/stats.php"/><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></a></td>+ <th style="border:none;background-color: rgb(119, 196, 135);"></th>+ <th style="border:none;">Scientific Name</th>+ <th style="border:none;">Common Name</th>+ <th style="border:none;">Listen</th>+ <th style="border:none;">Confidence</th>+ </tr>+ <tr>+ <th>Most Recent Detection</th>+ <td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/><?php echo $mostrecent['Sci_Name'];?></a></td>+ <td><a href="/By_Date/<?php echo $mostrecent['Date']."/".$comname;?>"><?php echo $mostrecent['Com_Name'];?></a></td>+ <td><a href="/By_Date/<?php echo$myDate."/".$comname."/".$mostrecent['File_Name'];?>" target="footer"/><?php echo $mostrecent['Date']." ".$mostrecent['Time'];?></a></td>+ <td><?php echo $mostrecent['Confidence'];?></td></tr></table></div>-</div><?phpif (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {echo "<img src=\"/Charts/$chart?nocache=time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";diff --git a/scripts/viewdb.php b/scripts/viewdb.phpindex 7b51e51a..6d8dd681 100644--- a/scripts/viewdb.php+++ b/scripts/viewdb.php@@ -76,7 +76,6 @@ a {<th>Scientific Name</th><th>Common Name</th><th>Confidence</th>- <th>Links</th></tr><?phpwhile($todaytable=$result0->fetchArray(SQLITE3_ASSOC))@@ -87,10 +86,9 @@ $sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']);?><tr><td><a href="<?php echo $comlink;?>" target="footer"/><?php echo $todaytable['Time'];?></a></td>- <td><?php echo $todaytable['Sci_Name'];?></td>- <td><?php echo $todaytable['Com_Name'];?></td>+ <td><a class="a2" href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="top"><?php echo $todaytable['Sci_Name'];?></a></td>+ <td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $comname;?>" target="top"><?php echo $todaytable['Com_Name'];?></a></td><td><?php echo $todaytable['Confidence'];?></td>- <td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $comname;?>" target="top">All About Birds</a>, <a class="a2" href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="top">Wikipedia</a></td><?php }?></tr></table>