|
8 | 8 |
|
9 | 9 | from control import data |
10 | 10 | from control.ocpp import OcppMixin |
11 | | -from control.optional_data import TARIFF_UPDATE_HOUR, FlexibleTariff, GridFee, OptionalData, PricingGet |
| 11 | +from control.optional_data import FlexibleTariff, GridFee, OptionalData, PricingGet |
12 | 12 | from helpermodules import hardware_configuration |
13 | 13 | from helpermodules.constants import NO_ERROR |
14 | 14 | from helpermodules.pub import Pub |
@@ -235,37 +235,23 @@ def ep_get_loading_hours(self, duration: float, remaining_time: float) -> List[i |
235 | 235 | return [] |
236 | 236 |
|
237 | 237 | def et_price_update_required(self) -> bool: |
238 | | - def is_tomorrow(last_timestamp: str) -> bool: |
239 | | - return (day_of(date=datetime.now()) < day_of(datetime.fromtimestamp(float(last_timestamp))) |
240 | | - or day_of(date=datetime.now()).hour < TARIFF_UPDATE_HOUR) |
241 | | - |
242 | | - def day_of(date: datetime) -> datetime: |
243 | | - return date.replace(hour=0, minute=0, second=0, microsecond=0) |
244 | | - |
245 | | - def get_last_entry_time_stamp() -> str: |
246 | | - last_known_timestamp = "0" |
247 | | - if self.data.electricity_pricing.get.prices is not None: |
248 | | - last_known_timestamp = max(self.data.electricity_pricing.get.prices) |
249 | | - return last_known_timestamp |
250 | 238 | self._set_ep_configured() |
251 | 239 | if self.data.electricity_pricing.configured is False: |
252 | 240 | return False |
253 | 241 | if len(self.data.electricity_pricing.get.prices) == 0: |
254 | 242 | return True |
255 | 243 | if self.data.electricity_pricing.get.next_query_time is None: |
256 | 244 | return True |
257 | | - if is_tomorrow(get_last_entry_time_stamp()): |
258 | | - if timecheck.create_timestamp() > self.data.electricity_pricing.get.next_query_time: |
259 | | - next_query_formatted = datetime.fromtimestamp( |
260 | | - self.data.electricity_pricing.get.next_query_time).strftime("%Y%m%d-%H:%M:%S") |
261 | | - log.info(f'Wartezeit {next_query_formatted} abgelaufen, Strompreise werden abgefragt') |
262 | | - return True |
263 | | - else: |
264 | | - next_query_formatted = datetime.fromtimestamp( |
265 | | - self.data.electricity_pricing.get.next_query_time).strftime("%Y%m%d-%H:%M:%S") |
266 | | - log.info(f'Nächster Abruf der Strompreise {next_query_formatted}.') |
267 | | - return False |
268 | | - return False |
| 245 | + if timecheck.create_timestamp() > self.data.electricity_pricing.get.next_query_time: |
| 246 | + next_query_formatted = datetime.fromtimestamp( |
| 247 | + self.data.electricity_pricing.get.next_query_time).strftime("%Y%m%d-%H:%M:%S") |
| 248 | + log.info(f'Wartezeit {next_query_formatted} abgelaufen, Strompreise werden abgefragt') |
| 249 | + return True |
| 250 | + else: |
| 251 | + next_query_formatted = datetime.fromtimestamp( |
| 252 | + self.data.electricity_pricing.get.next_query_time).strftime("%Y%m%d-%H:%M:%S") |
| 253 | + log.info(f'Nächster Abruf der Strompreise {next_query_formatted}.') |
| 254 | + return False |
269 | 255 |
|
270 | 256 | def ocpp_transfer_meter_values(self): |
271 | 257 | try: |
|
0 commit comments