A live bird collage card for your Home Assistant dashboard.
cache flush helper
frederik882ed2fe0664
diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.pyindex e241232b..f638fa55 100755--- a/scripts/plotly_streamlit.py+++ b/scripts/plotly_streamlit.py@@ -65,7 +65,13 @@ def get_connection(path: str):return sqlite3.connect(uri, uri=True, check_same_thread=False)-def get_data(_conn: Connection):+def get_todays_count(conn):+ today = datetime.now().strftime("%Y-%m-%d")+ return pd.read_sql(f"SELECT COUNT(*) FROM detections WHERE Date = DATE('{today}')", con=conn)++[email protected]_data(ttl=300)+def get_data(_conn: Connection, flush_cache):print_now('** get_data **')df1 = pd.read_sql("SELECT Date, Time, Sci_Name, Com_Name, Confidence, File_Name FROM detections", con=_conn)return df1@@ -81,7 +87,8 @@ def normalise_com_name(df):conn = get_connection(URI_SQLITE_DB)-df2 = get_data(conn)+latest_count = get_todays_count(conn)+df2 = get_data(conn, latest_count)df2 = normalise_com_name(df2)if len(df2) == 0: