Skip to content

Commit

Permalink
Merge pull request #116 from itchannel/1.22---config
Browse files Browse the repository at this point in the history
1.22   config
  • Loading branch information
itchannel committed Jul 24, 2021
2 parents 9bd758a + 07ce43d commit 02a2dee
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion custom_components/fordpass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
11 changes: 8 additions & 3 deletions custom_components/fordpass/fordpass_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"""
Expand Down Expand Up @@ -232,7 +238,6 @@ def guardStatus(self):
)
return r.json()


def start(self):
"""
Issue a start command to the engine
Expand Down
2 changes: 1 addition & 1 deletion custom_components/fordpass/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
4 changes: 1 addition & 3 deletions custom_components/fordpass/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 02a2dee

Please sign in to comment.