Skip to content

Commit

Permalink
Update audi_account.py
Browse files Browse the repository at this point in the history
  • Loading branch information
coreywillwhat authored Apr 27, 2024
1 parent 578d52c commit f8ba121
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions custom_components/audiconnect/audi_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
TRACKER_UPDATE,
COMPONENTS,
UPDATE_SLEEP,
REDACT_LOGS,
)

REFRESH_VEHICLE_DATA_FAILED_EVENT = "refresh_failed"
Expand Down Expand Up @@ -257,22 +258,22 @@ async def refresh_vehicle_data(self, service):
await self._refresh_vehicle_data(vin)

async def _refresh_vehicle_data(self, vin):
redacted_vin = "*" * (len(vin) - 4) + vin[-4:]
log_vin = "*" * (len(vin) - 4) + vin[-4:] if REDACT_LOGS else vin
res = await self.connection.refresh_vehicle_data(vin)

if res is True:
_LOGGER.debug("Refresh vehicle data successful for VIN: %s", redacted_vin)
_LOGGER.debug("Refresh vehicle data successful for VIN: %s", log_vin)
self.hass.bus.fire(
"{}_{}".format(DOMAIN, REFRESH_VEHICLE_DATA_COMPLETED_EVENT),
{"vin": redacted_vin},
{"vin": log_vin},
)
elif res == "disabled":
_LOGGER.debug("Refresh vehicle data is disabled for VIN: %s", redacted_vin)
_LOGGER.debug("Refresh vehicle data is disabled for VIN: %s", log_vin)
else:
_LOGGER.debug("Refresh vehicle data failed for VIN: %s", redacted_vin)
_LOGGER.debug("Refresh vehicle data failed for VIN: %s", log_vin)
self.hass.bus.fire(
"{}_{}".format(DOMAIN, REFRESH_VEHICLE_DATA_FAILED_EVENT),
{"vin": redacted_vin},
{"vin": log_vin},
)

_LOGGER.debug("Requesting to refresh cloud data in %d seconds...", UPDATE_SLEEP)
Expand Down

0 comments on commit f8ba121

Please sign in to comment.