A live bird collage card for your Home Assistant dashboard.
sun_time>=1.3.0 requires you to pass a timezone object, or you end up with UTC. also required is passing a datetime.datetime() object, not datetime.date()
frederikbedebf69f701
diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.pyindex 6421b306..4f8b2251 100755--- a/scripts/plotly_streamlit.py+++ b/scripts/plotly_streamlit.py@@ -6,7 +6,8 @@ from numpy import maimport plotly.graph_objects as gofrom plotly.subplots import make_subplotsimport plotly.io as pio-from datetime import timedelta+from datetime import datetime, timedelta+from dateutil import tzimport sqlite3from sqlite3 import Connectionimport plotly.express as px@@ -188,11 +189,12 @@ def sunrise_sunset_scatter(date_range):sunset_text_list = []daysback_range = []- current_date = start_date+ local_timezone = tz.tzlocal()for current_date in date_range:- sun_rise = sun.get_local_sunrise_time(current_date)- sun_dusk = sun.get_local_sunset_time(current_date)+ current_datetime = datetime.combine(current_date, datetime.min.time())+ sun_rise = sun.get_sunrise_time(current_datetime, local_timezone)+ sun_dusk = sun.get_sunset_time(current_datetime, local_timezone)sun_rise_time = float(sun_rise.hour) + float(sun_rise.minute) / 60.0sun_dusk_time = float(sun_dusk.hour) + float(sun_dusk.minute) / 60.0