Skip to content

A live bird collage card for your Home Assistant dashboard.

added total species count to sidebar overview

mcguirepr894d57b211e560
diff --git a/scripts/overview.php b/scripts/overview.php
index 157b06d0..977bae57 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -55,6 +55,14 @@ if($statement5 == False) {
}
$result5 = $statement5->execute();
$speciestally = $result5->fetchArray(SQLITE3_ASSOC);
+
+$statement6 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections');
+if($statement6 == False) {
+ echo "Database is busy";
+ header("refresh: 0;");
+}
+$result6 = $statement6->execute();
+$totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC);
?>
<head>
<meta charset="UTF-8">
@@ -85,6 +93,12 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
<td><button type="submit" name="view" value="Species Stats"><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></button></td>
</form>
</tr>
+ <tr>
+ <th>Total Number of Species</th>
+ <form action="" method="POST">
+ <td><button type="submit" name="view" value="Species Stats"><?php echo $totalspeciestally['COUNT(DISTINCT(Com_Name))'];?></button></td>
+ </form>
+ </tr>
</table>
</td></tr></table>
</div>