-
Notifications
You must be signed in to change notification settings - Fork 18
renault.charge_set_schedules not working as expected #105
Comments
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?
|
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}]}}} 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. 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. 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}]}}} |
I see this error in the response from the Renault servers: Can you please try to set the same startTime on each day of the week (for now I see that you are using |
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}]}}} |
Setting the same time and duration fixes the error message so the sample data in the plugin is wrong. |
On Zoe40, we have only one schedule available (only id=1), and it accepts different times. I will try to add this validation on renault-api PR hacf-fr/renault-api#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? |
Are you able to run the renault-api CLI directly, outside of home assistant? If you take a look at PR 158 hacf-fr/renault-api#158 I will be adding a CLI to make it easier to test. |
I don't have the faintest idea what you're talking about, so I guess not
! 😂
Le jeu. 21 janv. 2021 à 16:47, epenet <[email protected]> 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
<#105 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADWI2XKJ4TXWUQGYQHNWGLS3BEAVANCNFSM4WGHHVIQ>
.
|
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 The second is cleaned up with sanitized input: |
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). Test with sanitized input :
I tried to plan 2 "active" with the sanitized : It is OK. It is possible to have 2 active plan (may be 5) With other json input from eviollet with some corrections. It is OK Before, i tried to play with CLI : thats "ok"
|
This is all very confusing! Can you add these two option in your tests? Like this: |
Yes sorry, not really structured info. With sanitized input : sanitized.log |
Thanks @PysX. |
After the tests from @PysX it seems that the issue may be between Can you please try to add logging for the generated attributes by adding two lines of code in 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:
|
Thanks now I can see the root cause. |
@epenet |
@eviollet Can you please download the latest code, and try again? |
Hi @epenet . I tried updating to "master" in HACS. I assume this is correct?
I currently have Python 3.7 on my Home Assistant machine. Does this mean I have to update to 3.8? |
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. |
Released as v3.0.5 |
@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.
|
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.
The text was updated successfully, but these errors were encountered: