From d9783b759886c3e5a3b7db99bcb0e39571a6c180 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 27 Jul 2023 20:16:11 +1000 Subject: [PATCH] Fix token refresh error --- custom_components/fordpass/__init__.py | 1 + custom_components/fordpass/fordpass_new.py | 2 +- custom_components/fordpass/switch.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/fordpass/__init__.py b/custom_components/fordpass/__init__.py index 1603da3..6bed789 100644 --- a/custom_components/fordpass/__init__.py +++ b/custom_components/fordpass/__init__.py @@ -160,6 +160,7 @@ def refresh_status(hass, service, coordinator): _LOGGER.debug("Invalid VIN") elif status == 200: _LOGGER.debug("Refresh Sent") + def clear_tokens(hass, service, coordinator): diff --git a/custom_components/fordpass/fordpass_new.py b/custom_components/fordpass/fordpass_new.py index 02aa803..2c1dfc2 100644 --- a/custom_components/fordpass/fordpass_new.py +++ b/custom_components/fordpass/fordpass_new.py @@ -202,7 +202,7 @@ def refreshToken(self, token): headers = {**apiHeaders, "Application-Id": self.region} r = session.post( - f"https://{guardUrl}/token/v2/cat-with-refresh-token", + f"{guardUrl}/token/v2/cat-with-refresh-token", data=json.dumps(data), headers=headers, ) diff --git a/custom_components/fordpass/switch.py b/custom_components/fordpass/switch.py index aa5e762..78e6a21 100644 --- a/custom_components/fordpass/switch.py +++ b/custom_components/fordpass/switch.py @@ -49,6 +49,7 @@ async def async_turn_on(self, **kwargs): self.coordinator.vehicle.enableGuard ) await self.coordinator.async_request_refresh() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): if self.switch == "ignition": @@ -61,6 +62,7 @@ async def async_turn_off(self, **kwargs): self.coordinator.vehicle.disableGuard ) await self.coordinator.async_request_refresh() + self.async_write_ha_state() @property def name(self):