From 01834ab2d88ebb4efc80bf5d501f8d6e00c12d55 Mon Sep 17 00:00:00 2001 From: Mikael Johansson <46709289+twinor@users.noreply.github.com> Date: Tue, 2 Sep 2025 17:50:23 +0200 Subject: [PATCH 1/2] Update time for cw rank push that fix #89 --- custom_components/checkwatt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/checkwatt/__init__.py b/custom_components/checkwatt/__init__.py index aa7e53f..dda110c 100644 --- a/custom_components/checkwatt/__init__.py +++ b/custom_components/checkwatt/__init__.py @@ -432,7 +432,7 @@ async def _async_update_data(self) -> CheckwattResp: # noqa: C901 if push_to_cw_rank: if self.last_cw_rank_push is None or ( dt_util.now().time() - >= time(9, self.random_offset) # Wait until 9am +- 15 min + >= time(11, self.random_offset) # Wait until 11am +- 15 min and dt_util.start_of_local_day(dt_util.now()) != dt_util.start_of_local_day(self.last_cw_rank_push) ): From 2c8c30f1dfc71ebaad438fe2236e8e5cb888cd55 Mon Sep 17 00:00:00 2001 From: Mikael Johansson <46709289+twinor@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:01:35 +0200 Subject: [PATCH 2/2] updated comment with correct random time addition --- custom_components/checkwatt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/checkwatt/__init__.py b/custom_components/checkwatt/__init__.py index dda110c..3b8d545 100644 --- a/custom_components/checkwatt/__init__.py +++ b/custom_components/checkwatt/__init__.py @@ -432,7 +432,7 @@ async def _async_update_data(self) -> CheckwattResp: # noqa: C901 if push_to_cw_rank: if self.last_cw_rank_push is None or ( dt_util.now().time() - >= time(11, self.random_offset) # Wait until 11am +- 15 min + >= time(11, self.random_offset) # Wait until 11am + 0-14 min and dt_util.start_of_local_day(dt_util.now()) != dt_util.start_of_local_day(self.last_cw_rank_push) ):