nickknissen / hass-monta

Monta Home Assistant custom component
MIT License
21 stars 2 forks source link

Stop charge function doesn't work, as it uses chargePointId instead of chargeId #49

Closed kenni closed 6 months ago

kenni commented 6 months ago

System Health details

.

Checklist

Describe the issue

Ifølge Monta API dokumentationen, startes en opladning ved angivelse af chargePointId, mens stop af en opladning sker ved angivelse af chargeId.

Start af opladning via integrationen virker fint, men stop af opladning fejler med HTTP 404. Kigger jeg i debug log, ser det ud som om at chargePointId fejlagtigt benyttes ved stop af opladning, i stedet for chargeId.

Reproduction steps

  1. Start opladning fra integration -> Starter fint.
  2. Stop opladning fra integration -> Fejler konsekvent med HTTP 404 ("provided id was not found").

Debug logs

-----
Start af opladning:
-----

DEBUG (MainThread) [custom_components.monta.api] Trying to start a charge on: 3025882
<SNIP>
DEBUG (MainThread) [custom_components.monta.api] [charges] Response status: 200
DEBUG (MainThread) [custom_components.monta.api] [charges] Response body : {'id': 7760375, 'chargePointId': 3025882, <SNIP>

-----
Stop af opladning (bemærk at chargePointId 3025882 benyttes, mens det burde være chargeId 7760375):
-----

DEBUG (MainThread) [custom_components.monta.api] Trying to stop a charge with id: 3025882
<SNIP>
DEBUG (MainThread) [custom_components.monta.api] [charges/3025882/stop] Response status: 404
ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140064796647232] Error fetching information
Traceback (most recent call last):
  File "/config/custom_components/monta/api.py", line 246, in _api_wrapper
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://public-api.monta.com/api/v1/charges/3025882/stop')

Diagnostics dump

No response

kenni commented 6 months ago

Løsning afhænger potentielt af fix i API: https://docs.public-api.monta.com/discuss/65a310511f7f8c002ad91c0b

nickknissen commented 6 months ago

Tak for researchen.

Jeg ser om jeg ikke kan implementere et fix ved at gemme chargeId ved start af en ladning. Indtil de retter fejlen i API'et.

kenni commented 6 months ago

Monta har svaret på mit indlæg ovenfor, at fejlen i deres API nu skulle være fixet. Jeg kan dog ikke teste det pt, så kan ikke lige bekræfte det.

nickknissen commented 6 months ago

@kenni Jeg har testet og data er nu korrekt i deres API.