Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions packages/modules/common/configurable_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,27 @@ def _get_carstate_by_source(self, vehicle_update_data: VehicleUpdateData, source
if source == SocSource.API:
try:
_carState = self.__component_updater(vehicle_update_data)
_odometer = _carState.odometer
_now = int(time.time())
_diff = 0
if _carState.soc_timestamp:
_diff = int(_now - _carState.soc_timestamp)
if _diff > self.general_config.request_interval_charging and\
vehicle_update_data.plug_state and\
vehicle_update_data.last_soc and\
vehicle_update_data.last_soc_timestamp >= vehicle_update_data.plug_time and\
vehicle_update_data.imported -\
(self.calculated_soc_state.last_imported or vehicle_update_data.imported) > 0:
_age = int(self.general_config.request_interval_charging / 60)
_txt1 = "Ladestand und Reichweite sind berechnet, da der von der Online-Abfrage "
_txt1 = _txt1 + f"gelieferte Zeitstempel mehr als {_age} min alt ist."
self.fault_state.warning(f"{_txt1}")
self.fault_state.store_error()
_carState = calc_vehicle_data.calc_vehicle_data(vehicle_update_data,
self.calculated_soc_state.last_imported or
vehicle_update_data.imported)
_carState.odometer = _odometer
if type(_carState) is CarState:
_odometer = _carState.odometer
_now = int(time.time())
_diff = 0
if _carState.soc_timestamp:
_diff = int(_now - _carState.soc_timestamp)
if _diff > self.general_config.request_interval_charging and\
vehicle_update_data.plug_state and\
vehicle_update_data.last_soc and\
vehicle_update_data.last_soc_timestamp >= vehicle_update_data.plug_time and\
vehicle_update_data.imported -\
(self.calculated_soc_state.last_imported or vehicle_update_data.imported) > 0:
_age = int(self.general_config.request_interval_charging / 60)
_txt1 = "Ladestand und Reichweite sind berechnet, da der von der Online-Abfrage "
_txt1 = _txt1 + f"gelieferte Zeitstempel mehr als {_age} min alt ist."
self.fault_state.warning(f"{_txt1}")
self.fault_state.store_error()
_carState = calc_vehicle_data.calc_vehicle_data(vehicle_update_data,
self.calculated_soc_state.last_imported or
vehicle_update_data.imported)
_carState.odometer = _odometer
except Exception as e:
if vehicle_update_data.plug_state and\
vehicle_update_data.last_soc and\
Expand Down
Loading