diff --git a/custom_components/fordpass/__init__.py b/custom_components/fordpass/__init__.py index 59989d6..1d1a81f 100644 --- a/custom_components/fordpass/__init__.py +++ b/custom_components/fordpass/__init__.py @@ -132,7 +132,8 @@ def __init__(self, hass, user, password, vin, region, saveToken=False): """Initialize the coordinator and set up the Vehicle object.""" self._hass = hass self.vin = vin - self.vehicle = Vehicle(user, password, vin, region, saveToken) + configPath = hass.config.path("custom_components/fordpass/fordpass_token.txt") + self.vehicle = Vehicle(user, password, vin, region, saveToken, configPath) self._available = True super().__init__( diff --git a/custom_components/fordpass/fordpass_new.py b/custom_components/fordpass/fordpass_new.py index 16749f8..6a4c518 100644 --- a/custom_components/fordpass/fordpass_new.py +++ b/custom_components/fordpass/fordpass_new.py @@ -32,7 +32,9 @@ class Vehicle(object): # Represents a Ford vehicle, with methods for status and issuing commands - def __init__(self, username, password, vin, region, saveToken=False): + def __init__( + self, username, password, vin, region, saveToken=False, configLocation="" + ): self.username = username self.password = password self.saveToken = saveToken @@ -42,7 +44,11 @@ def __init__(self, username, password, vin, region, saveToken=False): self.expires = None self.expiresAt = None self.refresh_token = None - self.token_location = "custom_components/fordpass/fordpass_token.txt" + if configLocation == "": + self.token_location = "custom_components/fordpass/fordpass_token.txt" + else: + _LOGGER.debug(configLocation) + self.token_location = configLocation def auth(self): """Authenticate and store the token""" @@ -232,7 +238,6 @@ def guardStatus(self): ) return r.json() - def start(self): """ Issue a start command to the engine diff --git a/custom_components/fordpass/manifest.json b/custom_components/fordpass/manifest.json index 9f8db17..7c94f48 100644 --- a/custom_components/fordpass/manifest.json +++ b/custom_components/fordpass/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://github.com/itchannel/fordpass-ha", "issue_tracker": "https://github.com/itchannel/fordpass-ha/issues", - "version": "0.1.21", + "version": "0.1.22", "requirements": ["dotted==0.1.8"], "ssdp": [], "zeroconf": [], diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index 7b0f9b4..041998a 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -254,9 +254,7 @@ def get_value(self, ftype): self.coordinator.data["elVehDTE"] != None and self.coordinator.data["elVehDTE"]["value"] != None ): - elecs["elVehDTE"] = self.coordinator.data["elVehDTE"][ - "value" - ] + elecs["elVehDTE"] = self.coordinator.data["elVehDTE"]["value"] if ( self.coordinator.data["plugStatus"] != None and self.coordinator.data["plugStatus"]["value"] != None diff --git a/info.md b/info.md index 0654da3..768fd76 100644 --- a/info.md +++ b/info.md @@ -1,5 +1,8 @@ # **Changelog** +### Version 1.22 +- Fix for custom config locations on certain HA installs + ### Version 1.21 - Error handling for null fuel and elVehDTE attributes. Thanks @wietseschmitt