A live bird collage card for your Home Assistant dashboard.
Update service_controls.php
ehpersonal38fce0c080959b
diff --git a/scripts/service_controls.php b/scripts/service_controls.phpindex ad86a1e0..faf4da44 100644--- a/scripts/service_controls.php+++ b/scripts/service_controls.php@@ -1,11 +1,21 @@<?phpfunction service_status($name) {- if($name)+ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");+ $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");+ $home = trim($home);++ if($name == "birdnet_server.service") {+ $filesinproc=trim(shell_exec("ls ".$home."/BirdSongs/Processed | wc -l"));+ if($filesinproc > 200) {+ echo "<span style='color:#fc6603'>(stalled - backlog of ".$filesinproc." files in ~/BirdSongs/Processed/)</span>";+ return;+ }+ }$op = shell_exec("sudo systemctl status ".$name." | grep Active | grep ' active\| activating\|running\|waiting\|start'");if(strlen($op) > 0) {echo "<span style='color:green'>(active)</span>";} else {- echo "<span style='color:darkorange'>(inactive)</span>";+ echo "<span style='color:#fc6603'>(inactive)</span>";}}?>