Closed eviollet closed 3 years ago
Hi eviollet,
The way it works is that it first "downloads" the existing settings into a temporary class, then updates the class with the settings provided in the service call, and finally attempts to "upload" the updated settings to the Renault servers.
In order to investigate your issue, we would need to see what the "downloaded" settings are, and what is being sent back.
Can you please activate the traces in the configuration file, and send the corresponding traces?
logger:
logs:
renault_api: debug
custom_components.renault: debug
Hi.
Thank you for your quick response.
Here is the log:
2021-01-19 10:16:41 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v1/cars/VF1XXXXXXXXXX/charging-settings?country=FR: {"data":{"type":"Car","id":"VF1XXXXXXXXXX","attributes":{"mode":"scheduled","schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":450},"tuesday":{"startTime":"T00:00Z","duration":450},"wednesday":{"startTime":"T00:00Z","duration":450},"thursday":{"startTime":"T00:00Z","duration":450},"friday":{"startTime":"T00:00Z","duration":450},"saturday":{"startTime":"T00:00Z","duration":450},"sunday":{"startTime":"T00:00Z","duration":450}},{"id":2,"activated":true,"monday":{"startTime":"T23:30Z","duration":15},"tuesday":{"startTime":"T23:30Z","duration":15},"wednesday":{"startTime":"T23:30Z","duration":15},"thursday":{"startTime":"T23:30Z","duration":15},"friday":{"startTime":"T23:30Z","duration":15},"saturday":{"startTime":"T23:30Z","duration":15},"sunday":{"startTime":"T23:30Z","duration":15}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}} 2021-01-19 10:16:41 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules attempt: {'id': 4, 'activated': True, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T04:30Z', 'duration': 420}} 2021-01-19 10:16:41 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 500 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v2/cars/VF1XXXXXXXXXX/actions/charge-schedule?country=FR: {"type":"TECHNICAL","messages":[{"code":"err.tech.500","message":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"errors":[{"errorCode":"err.tech.500","errorMessage":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"error_reference":"TECHNICAL"} 2021-01-19 10:16:41 ERROR (MainThread) [custom_components.renault.services] Charge set schedules failed: ('err.tech.500', '{"errors":[{"status":"Internal Server Error","code":"500"}]}')
Today, the error message seems to be just "Error code 500" without any more information. As stated before, everything works fine with the Renault Android app
Hope this helps.
Regards,
Hi @eviollet,
I think the issue comes from having multiple activated schedules. I see in your log that schedule id 1 and schedule id 2 are already marked as "activated:True", and you are trying to add schedule id 4 as activated also! Can you try again, making sure that you keep only one schedule as "activated: true"?
On my system, I only ever use id:1 (I think the other schedules are not available on Zoe phase 1)
Hi @epenet
Here is the error log I'm getting when trying to change only id 1. All the others are disabled.
2021-01-21 15:50:31 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v1/cars/VF1AXXXXXXXXXXXX/charging-settings?country=FR: {"data":{"type":"Car","id":"VF1AXXXXXXXXXXXX","attributes":{"mode":"scheduled","schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":450},"tuesday":{"startTime":"T00:00Z","duration":450},"wednesday":{"startTime":"T00:00Z","duration":450},"thursday":{"startTime":"T00:00Z","duration":450},"friday":{"startTime":"T00:00Z","duration":450},"saturday":{"startTime":"T00:00Z","duration":450},"sunday":{"startTime":"T00:00Z","duration":450}},{"id":2,"activated":false,"monday":{"startTime":"T23:30Z","duration":15},"tuesday":{"startTime":"T23:30Z","duration":15},"wednesday":{"startTime":"T23:30Z","duration":15},"thursday":{"startTime":"T23:30Z","duration":15},"friday":{"startTime":"T23:30Z","duration":15},"saturday":{"startTime":"T23:30Z","duration":15},"sunday":{"startTime":"T23:30Z","duration":15}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}} 2021-01-21 15:50:31 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules attempt: {'id': 1, 'activated': True, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T04:30Z', 'duration': 420}} 2021-01-21 15:50:31 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 400 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v2/cars/VF1AXXXXXXXXXXXX/actions/charge-schedule?country=FR: {"type":"FUNCTIONAL","messages":[{"code":"err.func.400","message":"{\"errors\":[{\"status\":\"Bad Request\",\"code\":\"400\",\"title\":\"A schedule must have the same startTime/duration on each day\",\"detail\":\"A schedule must have the same startTime/duration on each day\"}]}"}],"errors":[{"errorCode":"err.func.400","errorMessage":"{\"errors\":[{\"status\":\"Bad Request\",\"code\":\"400\",\"title\":\"A schedule must have the same startTime/duration on each day\",\"detail\":\"A schedule must have the same startTime/duration on each day\"}]}"}],"error_reference":"FUNCTIONAL"} 2021-01-21 15:50:31 ERROR (MainThread) [custom_components.renault.services] Charge set schedules failed: ('err.func.400', 'A schedule must have the same startTime/duration on each day A schedule must have the same startTime/duration on each day')
I see this error in the response from the Renault servers:
A schedule must have the same startTime/duration on each day
Can you please try to set the same startTime on each day of the week (for now I see that you are using T12:00Z
for all days except T04:30Z
on Sunday)
2021-01-21 16:03:57 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v1/cars/VF1AGXXXXXXXX/charging-settings?country=FR: {"data":{"type":"Car","id":"VF1AGXXXXXXXX","attributes":{"mode":"scheduled","schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":450},"tuesday":{"startTime":"T00:00Z","duration":450},"wednesday":{"startTime":"T00:00Z","duration":450},"thursday":{"startTime":"T00:00Z","duration":450},"friday":{"startTime":"T00:00Z","duration":450},"saturday":{"startTime":"T00:00Z","duration":450},"sunday":{"startTime":"T00:00Z","duration":450}},{"id":2,"activated":false,"monday":{"startTime":"T23:30Z","duration":15},"tuesday":{"startTime":"T23:30Z","duration":15},"wednesday":{"startTime":"T23:30Z","duration":15},"thursday":{"startTime":"T23:30Z","duration":15},"friday":{"startTime":"T23:30Z","duration":15},"saturday":{"startTime":"T23:30Z","duration":15},"sunday":{"startTime":"T23:30Z","duration":15}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}} 2021-01-21 16:03:57 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules attempt: {'id': 1, 'activated': True, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T12:00Z', 'duration': 15}} 2021-01-21 16:03:57 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 500 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v2/cars/VF1AGXXXXXXXX/actions/charge-schedule?country=FR: {"type":"TECHNICAL","messages":[{"code":"err.tech.500","message":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"errors":[{"errorCode":"err.tech.500","errorMessage":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"error_reference":"TECHNICAL"} 2021-01-21 16:03:57 ERROR (MainThread) [custom_components.renault.services] Charge set schedules failed: ('err.tech.500', '{"errors":[{"status":"Internal Server Error","code":"500"}]}')
Setting the same time and duration fixes the error message so the sample data in the plugin is wrong. However, it's still triggering a 500 server error. :(
On Zoe40, we have only one schedule available (only id=1), and it accepts different times. On Zoe50, you have multiple schedules available (1 <= id <= 5), but you are not allowed different times.
I will try to add this validation on renault-api PR https://github.com/hacf-fr/renault-api/pull/157
Sadly I am still not sure why you are receiving this error 500.
@PysX I think you have a Zoe50. Does the service work ok for you?
@epenet could it be that the service doesn't accept more than 1 schedule at a time? A reminiscent from the ZE40? Is there a way I could try this out ? Any PY file I can tweak?
Are you able to run the renault-api CLI directly, outside of home assistant?
If you take a look at PR 158 https://github.com/hacf-fr/renault-api/pull/158 I will be adding a CLI to make it easier to test.
You will be able to create a json file (eg. schedule.json) and attempt to push it directly:
renault-api http post /commerce/v1/accounts/{account_id}/kamereon/kca/car-adapter/v2/cars/{vin}/actions/charge-schedule schedule.json
I don't have the faintest idea what you're talking about, so I guess not ! 😂
Le jeu. 21 janv. 2021 à 16:47, epenet notifications@github.com a écrit :
Are you able to run the renault-api CLI directly, outside of home assistant?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hacf-fr/hassRenaultZE/issues/105#issuecomment-764735387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADWI2XKJ4TXWUQGYQHNWGLS3BEAVANCNFSM4WGHHVIQ .
@PysX I think you have a Zoe50. Does the service work ok for you?
Hi, I do not use planned charge. But I will make tests similar to those ones above.
If you have a chance to test with the new renault-api http CLI, here are two json to test with...
The first is the sample from @eviollet
{"data":{"type":"ChargeSchedule,"attributes":{"schedules":[{"id":1,"activated":true,"monday":{"startTime":"T12:00Z","duration":15},"tuesday":{"startTime":"T00T12:00Z","duration":15},"wednesday":{"startTime":"T12:00Z","duration":15},"thursday":{"startTime":"T12:00Z","duration":15},"friday":{"startTime":"T12:00Z","duration":15},"saturday":{"startTime":"T12:00Z","duration":15},"sunday":{"startTime":"T12:00Z","duration":15}},{"id":2,"activated":false,"monday":{"startTime":"T23:30Z","duration":15},"tuesday":{"startTime":"T23:30Z","duration":15},"wednesday":{"startTime":"T23:30Z","duration":15},"thursday":{"startTime":"T23:30Z","duration":15},"friday":{"startTime":"T23:30Z","duration":15},"saturday":{"startTime":"T23:30Z","duration":15},"sunday":{"startTime":"T23:30Z","duration":15}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}}
The second is cleaned up with sanitized input:
{ "data": { "type": "ChargeSchedule", "attributes": { "schedules": [{ "activated": true, "monday": { "startTime": "T12:00Z", "duration": 15 }, "tuesday": { "startTime": "T12:00Z", "duration": 15 }, "wednesday": { "startTime": "T12:00Z", "duration": 15 }, "thursday": { "startTime": "T12:00Z", "duration": 15 }, "friday": { "startTime": "T12:00Z", "duration": 15 }, "saturday": { "startTime": "T12:00Z", "duration": 15 }, "sunday": { "startTime": "T12:00Z", "duration": 15 } }, { "activated": false, "monday": { "startTime": "T23:30Z", "duration": 15 }, "tuesday": { "startTime": "T23:30Z", "duration": 15 }, "wednesday": { "startTime": "T23:30Z", "duration": 15 }, "thursday": { "startTime": "T23:30Z", "duration": 15 }, "friday": { "startTime": "T23:30Z", "duration": 15 }, "saturday": { "startTime": "T23:30Z", "duration": 15 }, "sunday": { "startTime": "T23:30Z", "duration": 15 } }] } } }
Ok, i've done some tests with CLI. And to my ZE50 updating schedule is OK with sanitized json (the other one does works if corrected). No errors reported, schedule checked in car and in MyRenault App. (The car was charging and it stopped ;-)).
Test with sanitized input :
poetry run renault-api http post-file /commerce/v1/accounts/ACCOUNT-ID/kamereon/kca/car-adapter/v2/cars/VIN-ID/actions/charge-schedule sample.json
{'data': {'type': 'ChargeSchedule', 'id': 'd9aa8103-1633-4234-8170-2d4af532dd69', 'attributes': {'schedules': [{'activated': True, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T12:00Z', 'duration': 15}}, {'activated': False, 'monday': {'startTime': 'T23:30Z', 'duration': 15}, 'tuesday': {'startTime': 'T23:30Z', 'duration': 15}, 'wednesday': {'startTime': 'T23:30Z', 'duration': 15}, 'thursday': {'startTime': 'T23:30Z', 'duration': 15}, 'friday': {'startTime': 'T23:30Z', 'duration': 15}, 'saturday': {'startTime': 'T23:30Z', 'duration': 15}, 'sunday': {'startTime': 'T23:30Z', 'duration': 15}}]}}}
Schedule ID: 1 [Active]
Day Start time End time Duration
--------- ------------ ---------- ----------
Monday 13:00 13:15 0:15:00
Tuesday 13:00 13:15 0:15:00
Wednesday 13:00 13:15 0:15:00
Thursday 13:00 13:15 0:15:00
Friday 13:00 13:15 0:15:00
Saturday 13:00 13:15 0:15:00
Sunday 13:00 13:15 0:15:00
Schedule ID: 2
Day Start time End time Duration
--------- ------------ ---------- ----------
Monday 00:30 00:45 0:15:00
Tuesday 00:30 00:45 0:15:00
Wednesday 00:30 00:45 0:15:00
Thursday 00:30 00:45 0:15:00
Friday 00:30 00:45 0:15:00
Saturday 00:30 00:45 0:15:00
Sunday 00:30 00:45 0:15:00
I tried to plan 2 "active" with the sanitized : It is OK. It is possible to have 2 active plan (may be 5)
{ "data": { "type": "ChargeSchedule", "attributes": { "schedules": [{ "activated": true, "monday": { "startTime": "T12:00Z", "duration": 15 }, "tuesday": { "startTime": "T12:00Z", "duration": 15 }, "wednesday": { "startTime": "T12:00Z", "duration": 15 }, "thursday": { "startTime": "T12:00Z", "duration": 15 }, "friday": { "startTime": "T12:00Z", "duration": 15 }, "saturday": { "startTime": "T12:00Z", "duration": 15 }, "sunday": { "startTime": "T12:00Z", "duration": 15 } }, { "activated": true
, "monday": { "startTime": "T23:30Z", "duration": 15 }, "tuesday": { "startTime": "T23:30Z", "duration": 15 }, "wednesday": { "startTime": "T23:30Z", "duration": 15 }, "thursday": { "startTime": "T23:30Z", "duration": 15 }, "friday": { "startTime": "T23:30Z", "duration": 15 }, "saturday": { "startTime": "T23:30Z", "duration": 15 }, "sunday": { "startTime": "T23:30Z", "duration": 15 } }] } } }
With other json input from eviollet with some corrections. It is OK
{"data":{"type":"ChargeSchedule"
,"attributes":{"schedules":[{"id":1,"activated":true,"monday":{"startTime":"T12:00Z","duration":15},"tuesday":{"startTime":"T12:00Z
","duration":15},"wednesday":{"startTime":"T12:00Z","duration":15},"thursday":{"startTime":"T12:00Z","duration":15},"friday":{"startTime":"T12:00Z","duration":15},"saturday":{"startTime":"T12:00Z","duration":15},"sunday":{"startTime":"T12:00Z","duration":15}},{"id":2,"activated":false,"monday":{"startTime":"T23:30Z","duration":15},"tuesday":{"startTime":"T23:30Z","duration":15},"wednesday":{"startTime":"T23:30Z","duration":15},"thursday":{"startTime":"T23:30Z","duration":15},"friday":{"startTime":"T23:30Z","duration":15},"saturday":{"startTime":"T23:30Z","duration":15},"sunday":{"startTime":"T23:30Z","duration":15}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}}
Before, i tried to play with CLI : thats "ok"
renault-api charge schedule activate 1
{'schedules': [{'id': 1, 'activated': True}, {'id': 2, 'activated': False}, {'id': 3, 'activated': False}, {'id': 4, 'activated': False}, {'id': 5, 'activated': False}]}
renault-api charge schedule deactivate 1
{'schedules': [{'id': 1, 'activated': False}, {'id': 2, 'activated': False}, {'id': 3, 'activated': False}, {'id': 4, 'activated': False}, {'id': 5, 'activated': False}]}
renault-api charge schedule set --monday 23:30,15 1
{'schedules': [{'id': 1, 'activated': False, 'monday': {'startTime': 'T22:30Z', 'duration': 15}}, {'id': 2, 'activated': False}, {'id': 3, 'activated': False}, {'id': 4, 'activated': False}, {'id': 5, 'activated': False}]}
This is all very confusing! Can you add these two option in your tests?
--debug
to have the details of the HTTP request
--json
to have the result in JSON format (with correct double-quote and boolean values not Python fake json format)
Like this: poetry run renault-api --debug --json http post-file......
Yes sorry, not really structured info.
With sanitized input : sanitized.log With eviollet input fixed (one quote missing and one startTime not valid) : eviollet-fixed.log
Thanks @PysX.
@eviollet
After the tests from @PysX it seems that the issue may be between hassRenaultZE
and renault-api
.
Can you please try to add logging for the generated attributes by adding two lines of code in services.py
, on line 139
attributes = {"schedules": list(schedule.for_json() for schedule in charge_schedules.schedules)}
_LOGGER.debug("Charge set schedules new attributes: %s", attributes)
In full it should look like this:
try:
_LOGGER.debug("Charge set schedules attempt: %s", schedules)
attributes = {"schedules": list(schedule.for_json() for schedule in charge_schedules.schedules)}
_LOGGER.debug("Charge set schedules new attributes: %s", attributes)
result = await vehicle.send_set_charge_schedules(charge_schedules)
except KamereonResponseException as err:
_LOGGER.error("Charge set schedules failed: %s", err)
else:
_LOGGER.info("Charge set schedules result: %s", result)
_LOGGER.info(
"It may take some time before these changes are reflected in your vehicle."
)
And then try again to send the request via Home Assistant
Are here is the result:
2021-01-23 11:43:12 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v1/cars/VF1XXXXXXXXX/charging-settings?country=FR: {"data":{"type":"Car","id":"VF1XXXXXXXXX","attributes":{"mode":"scheduled","schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":450},"tuesday":{"startTime":"T00:00Z","duration":450},"wednesday":{"startTime":"T00:00Z","duration":450},"thursday":{"startTime":"T00:00Z","duration":450},"friday":{"startTime":"T00:00Z","duration":450},"saturday":{"startTime":"T00:00Z","duration":450},"sunday":{"startTime":"T00:00Z","duration":450}},{"id":2,"activated":false,"monday":{"startTime":"T00:00Z","duration":60},"tuesday":{"startTime":"T00:00Z","duration":60},"wednesday":{"startTime":"T00:00Z","duration":60},"thursday":{"startTime":"T00:00Z","duration":60},"friday":{"startTime":"T00:00Z","duration":60},"saturday":{"startTime":"T00:00Z","duration":60},"sunday":{"startTime":"T00:00Z","duration":60}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}}
2021-01-23 11:43:12 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules attempt: {'id': 1, 'activated': False, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T12:00Z', 'duration': 15}}
2021-01-23 11:43:12 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules new attributes: {'schedules': [{'id': 1, 'activated': True, 'monday': {'startTime': 'T12:00Z', 'duration': 15}, 'tuesday': {'startTime': 'T12:00Z', 'duration': 15}, 'wednesday': {'startTime': 'T12:00Z', 'duration': 15}, 'thursday': {'startTime': 'T12:00Z', 'duration': 15}, 'friday': {'startTime': 'T12:00Z', 'duration': 15}, 'saturday': {'startTime': 'T12:00Z', 'duration': 15}, 'sunday': {'startTime': 'T12:00Z', 'duration': 15}}, {'id': 2, 'activated': False, 'monday': {'startTime': 'T00:00Z', 'duration': 60}, 'tuesday': {'startTime': 'T00:00Z', 'duration': 60}, 'wednesday': {'startTime': 'T00:00Z', 'duration': 60}, 'thursday': {'startTime': 'T00:00Z', 'duration': 60}, 'friday': {'startTime': 'T00:00Z', 'duration': 60}, 'saturday': {'startTime': 'T00:00Z', 'duration': 60}, 'sunday': {'startTime': 'T00:00Z', 'duration': 60}}, {'id': 3, 'activated': False, 'monday': {}, 'tuesday': {}, 'wednesday': {}, 'thursday': {}, 'friday': {}, 'saturday': {}, 'sunday': {}}, {'id': 4, 'activated': False, 'monday': {}, 'tuesday': {}, 'wednesday': {}, 'thursday': {}, 'friday': {}, 'saturday': {}, 'sunday': {}}, {'id': 5, 'activated': False, 'monday': {}, 'tuesday': {}, 'wednesday': {}, 'thursday': {}, 'friday': {}, 'saturday': {}, 'sunday': {}}]}
2021-01-23 11:43:12 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 500 on https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v2/cars/VF1XXXXXXXXX/actions/charge-schedule?country=FR: {"type":"TECHNICAL","messages":[{"code":"err.tech.500","message":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"errors":[{"errorCode":"err.tech.500","errorMessage":"{\"errors\":[{\"status\":\"Internal Server Error\",\"code\":\"500\"}]}"}],"error_reference":"TECHNICAL"}
2021-01-23 11:43:12 ERROR (MainThread) [custom_components.renault.services] Charge set schedules failed: ('err.tech.500', '{"errors":[{"status":"Internal Server Error","code":"500"}]}')
Thanks now I can see the root cause. I'll work on a fix next week.
@epenet Great. Thank you very much!
@eviollet It seems the issue was already solved in renault-api v0.0.4, but the Home-Assistant component was only using v0.0.3. I have just merged PR #107 to use the latest release or renault-api.
Can you please download the latest code, and try again? If it's OK for you, then I will publish it as a release.
Hi @epenet .
I tried updating to "master" in HACS. I assume this is correct? Now, the integration won't load. The error I get is the following:
2021-01-26 09:24:44 ERROR (MainThread) [homeassistant.setup] Setup failed for renault: Unable to import component: cannot import name 'ChargeMode' from 'renault_api.kamereon.enums' (/usr/local/lib/python3.8/site-packages/renault_api/kamereon/enums.py)
I currently have Python 3.7 on my Home Assistant machine. Does this mean I have to update to 3.8?
The PR #107 was missing a commit. I have now merged PR #109.
Can you please try again?
Hi @epenet .
I just tried. The new commit loads correctly. And schedule changing seems to be working as it should. The changes are now reflected in the app. 🤗
Thank you very much.
@epenet ,
I may have spoken too soon...
I've been playing around with this new version and it seems that the "activated" attribute isn't reflected correctly. In this example, I'm trying to enable id 2. And here is the output:
021-01-26 10:03:58 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on GET https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v1/cars/VFXXXXXXXX/charging-settings?country=FR: {"data":{"type":"Car","id":"VFXXXXXXXX","attributes":{"mode":"scheduled","schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":480},"tuesday":{"startTime":"T00:00Z","duration":480},"wednesday":{"startTime":"T00:00Z","duration":480},"thursday":{"startTime":"T00:00Z","duration":480},"friday":{"startTime":"T00:00Z","duration":480},"saturday":{"startTime":"T00:00Z","duration":480},"sunday":{"startTime":"T00:00Z","duration":480}},{"id":2,"activated":false,"monday":{"startTime":"T00:00Z","duration":480},"tuesday":{"startTime":"T00:00Z","duration":480},"wednesday":{"startTime":"T00:00Z","duration":480},"thursday":{"startTime":"T00:00Z","duration":480},"friday":{"startTime":"T00:00Z","duration":480},"saturday":{"startTime":"T00:00Z","duration":480},"sunday":{"startTime":"T00:00Z","duration":480}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}} (with body data None) 2021-01-26 10:03:58 DEBUG (MainThread) [custom_components.renault.services] Charge set schedules attempt: {'id': 2, 'activated': True, 'monday': {'startTime': 'T23:30Z', 'duration': 30}, 'tuesday': {'startTime': 'T23:30Z', 'duration': 30}, 'wednesday': {'startTime': 'T23:30Z', 'duration': 30}, 'thursday': {'startTime': 'T23:30Z', 'duration': 30}, 'friday': {'startTime': 'T23:30Z', 'duration': 30}, 'saturday': {'startTime': 'T23:30Z', 'duration': 30}, 'sunday': {'startTime': 'T23:30Z', 'duration': 30}} 2021-01-26 10:03:59 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 200 on POST https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/8244b99e-5ec1-4eb7-8695-2e0de0a7d427/kamereon/kca/car-adapter/v2/cars/VFXXXXXXXX/actions/charge-schedule?country=FR: {"data":{"type":"ChargeSchedule","id":"ba40940e-7f9b-4761-b001-db84e0682330","attributes":{"schedules":[{"id":1,"activated":true,"monday":{"startTime":"T00:00Z","duration":480},"tuesday":{"startTime":"T00:00Z","duration":480},"wednesday":{"startTime":"T00:00Z","duration":480},"thursday":{"startTime":"T00:00Z","duration":480},"friday":{"startTime":"T00:00Z","duration":480},"saturday":{"startTime":"T00:00Z","duration":480},"sunday":{"startTime":"T00:00Z","duration":480}},{"id":2,"activated":false,"monday":{"startTime":"T23:30Z","duration":30},"tuesday":{"startTime":"T23:30Z","duration":30},"wednesday":{"startTime":"T23:30Z","duration":30},"thursday":{"startTime":"T23:30Z","duration":30},"friday":{"startTime":"T23:30Z","duration":30},"saturday":{"startTime":"T23:30Z","duration":30},"sunday":{"startTime":"T23:30Z","duration":30}},{"id":3,"activated":false},{"id":4,"activated":false},{"id":5,"activated":false}]}}} (with body data {'data': {'type': 'ChargeSchedule', 'attributes': {'schedules': [{'id': 1, 'activated': True, 'monday': {'startTime': 'T00:00Z', 'duration': 480}, 'tuesday': {'startTime': 'T00:00Z', 'duration': 480}, 'wednesday': {'startTime': 'T00:00Z', 'duration': 480}, 'thursday': {'startTime': 'T00:00Z', 'duration': 480}, 'friday': {'startTime': 'T00:00Z', 'duration': 480}, 'saturday': {'startTime': 'T00:00Z', 'duration': 480}, 'sunday': {'startTime': 'T00:00Z', 'duration': 480}}, {'id': 2, 'activated': False, 'monday': {'startTime': 'T23:30Z', 'duration': 30}, 'tuesday': {'startTime': 'T23:30Z', 'duration': 30}, 'wednesday': {'startTime': 'T23:30Z', 'duration': 30}, 'thursday': {'startTime': 'T23:30Z', 'duration': 30}, 'friday': {'startTime': 'T23:30Z', 'duration': 30}, 'saturday': {'startTime': 'T23:30Z', 'duration': 30}, 'sunday': {'startTime': 'T23:30Z', 'duration': 30}}, {'id': 3, 'activated': False, 'monday': None, 'tuesday': None, 'wednesday': None, 'thursday': None, 'friday': None, 'saturday': None, 'sunday': None}, {'id': 4, 'activated': False, 'monday': None, 'tuesday': None, 'wednesday': None, 'thursday': None, 'friday': None, 'saturday': None, 'sunday': None}, {'id': 5, 'activated': False, 'monday': None, 'tuesday': None, 'wednesday': None, 'thursday': None, 'friday': None, 'saturday': None, 'sunday': None}]}}}) 2021-01-26 10:03:59 INFO (MainThread) [custom_components.renault.services] Charge set schedules result: KamereonVehicleChargeScheduleActionData(raw_data={'schedules': [{'id': 1, 'activated': True, 'monday': {'startTime': 'T00:00Z', 'duration': 480}, 'tuesday': {'startTime': 'T00:00Z', 'duration': 480}, 'wednesday': {'startTime': 'T00:00Z', 'duration': 480}, 'thursday': {'startTime': 'T00:00Z', 'duration': 480}, 'friday': {'startTime': 'T00:00Z', 'duration': 480}, 'saturday': {'startTime': 'T00:00Z', 'duration': 480}, 'sunday': {'startTime': 'T00:00Z', 'duration': 480}}, {'id': 2, 'activated': False, 'monday': {'startTime': 'T23:30Z', 'duration': 30}, 'tuesday': {'startTime': 'T23:30Z', 'duration': 30}, 'wednesday': {'startTime': 'T23:30Z', 'duration': 30}, 'thursday': {'startTime': 'T23:30Z', 'duration': 30}, 'friday': {'startTime': 'T23:30Z', 'duration': 30}, 'saturday': {'startTime': 'T23:30Z', 'duration': 30}, 'sunday': {'startTime': 'T23:30Z', 'duration': 30}}, {'id': 3, 'activated': False}, {'id': 4, 'activated': False}, {'id': 5, 'activated': False}]}) 2021-01-26 10:03:59 INFO (MainThread) [custom_components.renault.services] It may take some time before these changes are reflected in your vehicle.
Can you open a new issue for the inability to update the active/inactive status?
@epenet OK
Version of the custom_component
Version 3.0.4 of Renault ZE sensor
Description of the issue
Hi all.
I'm having trouble finding documentation about the Renault API. I've tried fiddling around with the renault.charge_set_schedules service to no avail until now. Whenever I try to call the service using default data in "Fill Example Data", I get the following error:
Logger: custom_components.renault.services Source: custom_components/renault/services.py:136 Integration: Renault (documentation, issues) First occurred: 9:11:36 (7 occurrences) Last logged: 17:20:06
Charge set schedules failed: ('err.tech.500', '{"errors":[{"status":"Internal Server Error","code":"500"}]}') Charge set schedules failed: ('err.func.400', 'A schedule must have the same startTime/duration on each day A schedule must have the same startTime/duration on each day')
I don't quite understand what the error message is trying to say here. I also tried the following parameters, but, of course, to no avail: vin: vf1*** schedules: id: 3 activated: true monday: startTime: 'T12:00Z' duration: 15 tuesday: startTime: 'T12:00Z' duration: 15 wednesday: startTime: 'T12:00Z' duration: 15 thursday: startTime: 'T12:00Z' duration: 15 friday: startTime: 'T12:00Z' duration: 15 saturday: startTime: 'T12:00Z' duration: 15 sunday: startTime: 'T12:00Z' duration: 15
Modifying the schedules works when using the APP, so I suppose the API is working OK. It just seems to be a syntax issue. And the example in the services template seems to be wrong.
Can anyone help me with pointers to the API? Or, even explaining what I'm doing wrong here?
In advance, thanks.