hacf-fr / renault-api

https://readthedocs.org/projects/renault-api/
MIT License
102 stars 34 forks source link

Getting status fails on 'hvacStatus' being 'Not a valid integer' #1237

Closed klokop closed 1 week ago

klokop commented 1 week ago

As of about june 10th 2024, this this doesn't seem to be working anymore.

$ renault-api --version
renault-api, version 0.2.3
$ renault-api vehicles
Registration    Brand    Model            VIN
--------------  -------  ---------------  -----------------
xxxxxxx         RENAULT  MEGANE IV BREAK  xxxx

$ renault-api status
lock status: {"errors":[{"errorCode":404,"errorMessage":"There is no data for this vin and uid","errorLevel":"error","errorType":"functional"}],"error_reference":"rrt-xxxx"}
res state: The access is forbidden
Traceback (most recent call last):
  File "/usr/local/bin/renault-api", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/renault_api/cli/helpers.py", line 39, in wrapper
    asyncio.run(run_command(func, *args, **kwargs))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/renault_api/cli/helpers.py", line 30, in run_command
    await func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/renault_api/cli/__main__.py", line 178, in status
    await renault_vehicle.display_status(websession, ctx_data)
  File "/usr/local/lib/python3.9/dist-packages/renault_api/cli/renault_vehicle.py", line 164, in display_status
    await update_hvac_status(vehicle, status_table, ctx_data)
  File "/usr/local/lib/python3.9/dist-packages/renault_api/cli/renault_vehicle.py", line 362, in update_hvac_status
    response = await vehicle.get_hvac_status()
  File "/usr/local/lib/python3.9/dist-packages/renault_api/renault_vehicle.py", line 160, in get_hvac_status
    response.get_attributes(schemas.KamereonVehicleHvacStatusDataSchema),
  File "/usr/local/lib/python3.9/dist-packages/renault_api/kamereon/models.py", line 353, in get_attributes
    cast(KamereonVehicleDataAttributes, schema.load(self.data.attributes))
  File "/usr/local/lib/python3.9/dist-packages/marshmallow_dataclass/__init__.py", line 973, in load
    all_loaded = super().load(data, many=many, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/marshmallow/schema.py", line 722, in load
    return self._do_load(
  File "/usr/local/lib/python3.9/dist-packages/marshmallow/schema.py", line 909, in _do_load
    raise exc
marshmallow.exceptions.ValidationError: {'hvacStatus': ['Not a valid integer.']}
jwatzk commented 1 week ago

Looks like hvacStatus type changed from integer to string in class KamereonVehicleHvacStatusData: HVAC status information: KamereonVehicleHvacStatusData(raw_data={'hvacStatus': 'off', 'lastUpdateTime': '2024-06-28T05:14:57Z'}, lastUpdateTime='2024-06-28T05:14:57Z', externalTemperature=None, hvacStatus='off', nextHvacStartDate=None, socThreshold=None)

epenet commented 1 week ago

Duplicate of #1223

epenet commented 1 week ago

Sorry - this was not a duplicate of #1223. The issue there is different.

The issue here was fixed via #1242, and a new release was published.