File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
custom_components/nordpool Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1515
1616from .aio_price import AioPrices
1717from .events import async_track_time_change_in_tz
18+ from .misc import stock
1819
1920DOMAIN = "nordpool"
2021_LOGGER = logging .getLogger (__name__ )
@@ -153,10 +154,18 @@ async def new_day_cb(_):
153154
154155 async_dispatcher_send (hass , EVENT_NEW_DAY )
155156
156- async def new_hr (_ ):
157- """Callback to tell the sensors to update on a new hour."""
157+ async def new_hr (tdo ):
158+ """Callback to tell the sensors to update on a new hour.
159+ and poll data if needed.
160+ """
158161 _LOGGER .debug ("Called new_hr callback" )
159162 async_dispatcher_send (hass , EVENT_NEW_HOUR )
163+ if not api .tomorrow_valid_all_areas ():
164+ now = stock (dt_utils .now ())
165+ if now >= now .replace (
166+ hour = 13 , minute = RANDOM_MINUTE , second = RANDOM_SECOND
167+ ):
168+ new_data_cb (tdo )
160169
161170 async def new_data_cb (tdo ):
162171 """Callback to fetch new data for tomorrows prices at 1300ish CET
You can’t perform that action at this time.
0 commit comments