Skip to content

Commit

Permalink
Fix Ariya battery URL
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Nov 7, 2024
1 parent b887527 commit 903d48e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions custom_components/nissan_connect/kamereon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
'user_adapter_base_url': 'https://alliance-platform-usersadapter-prod.apps.eu2.kamereon.io/user-adapter/',
'user_base_url': 'https://nci-bff-web-prod.apps.eu2.kamereon.io/bff-web/'
}
},
'mitsubishi': {},
'renault': {},
}
}


Expand Down Expand Up @@ -763,7 +761,7 @@ def __init__(self, data, user_id):
_LOGGER.debug(f"Unknown feature {str(u['id'])}")
pass

_LOGGER.debug(f"Active features: {self.features}")
_LOGGER.debug("Active features: %s", self.features)

self.can_generation = data.get('canGeneration')
self.color = data.get('color')
Expand Down Expand Up @@ -1157,10 +1155,10 @@ def refresh_battery_status(self):
return body

def fetch_battery_status(self):
if self.model_name == "Leaf":
return self.fetch_battery_status_leaf()
elif self.model_name == "Ariya":
if self.model_name == "Ariya":
return self.fetch_battery_status_ariya()

return self.fetch_battery_status_leaf()

def fetch_battery_status_leaf(self):
"""The battery-status endpoint isn't just for EV's. ICE Nissans publish the range under this!
Expand Down Expand Up @@ -1208,7 +1206,7 @@ def fetch_battery_status_leaf(self):

def fetch_battery_status_ariya(self):
resp = self._get(
'{}v3/cars/{}/battery-status?canGen={}'.format(self.session.settings['car_adapter_base_url'], self.vin, self.can_generation),
'{}v3/cars/{}/battery-status?canGen={}'.format(self.session.settings['user_base_url'], self.vin, self.can_generation),
headers={'Content-Type': 'application/vnd.api+json'}
)
body = resp.json()
Expand Down

0 comments on commit 903d48e

Please sign in to comment.