@@ -54,9 +54,7 @@ def start(self) -> None:
54
54
next_price_minimum , minimum_has_to_be_rechecked = self ._do_iteration ()
55
55
56
56
if minimum_has_to_be_rechecked :
57
- time_to_sleep_to = datetime .now (tz = self .timezone ).replace (
58
- hour = 14 , minute = 0 , second = 0 , microsecond = 0
59
- )
57
+ time_to_sleep_to = TimeHandler .get_time ().replace (hour = 14 , minute = 0 , second = 0 , microsecond = 0 )
60
58
self .log .info (f"The price minimum has to re-checked at { time_to_sleep_to } . Waiting until then..." )
61
59
pause .until (time_to_sleep_to )
62
60
self .log .info ("Waking up since the the price minimum has to re-checked" )
@@ -98,7 +96,7 @@ def _do_iteration(self) -> tuple[datetime, bool]: # FIXME: Find better name
98
96
"Waiting is over, now is the a price minimum. Checking what has to be done to reach the next minimum..."
99
97
)
100
98
101
- timestamp_now = datetime . now ( tz = self . timezone )
99
+ timestamp_now = TimeHandler . get_time ( )
102
100
103
101
next_price_minimum , minimum_has_to_be_rechecked = self .tibber_api_handler .get_timestamp_of_next_price_minimum ()
104
102
self .log .info (f"The next price minimum is at { next_price_minimum } " )
@@ -202,12 +200,12 @@ def _do_iteration(self) -> tuple[datetime, bool]: # FIXME: Find better name
202
200
required_state_of_charge = max_target_soc
203
201
204
202
energy_bought_before_charging = self .sems_portal_api_handler .get_energy_buy ()
205
- timestamp_starting_to_charge = datetime . now ( tz = self . timezone )
203
+ timestamp_starting_to_charge = TimeHandler . get_time ( )
206
204
self .log .debug (f"The amount of energy bought before charging is { energy_bought_before_charging } " )
207
205
208
206
self ._charge_inverter (required_state_of_charge )
209
207
210
- timestamp_ending_to_charge = datetime . now ( tz = self . timezone )
208
+ timestamp_ending_to_charge = TimeHandler . get_time ( )
211
209
212
210
duration_to_wait_for_semsportal_update = timedelta (minutes = 10 )
213
211
self .log .info (
0 commit comments