-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rework authentication and API structure after VW has switched off CarNet #216
Conversation
@oliverrahner i let you decide when you feel this is ready for release, i believe it may be better to release it once when it is sort of working as i guess people will find missing things as there are different values depending on which type of car you have 😄 |
Could you do a pre-release, so it would be possible to install it via HACS, and tested by wider audiences? |
Thanks @robinostlund |
Unfortunately, it’s not the integration I’m reworking, but the underlying library. |
The owner (@robinostlund) could take a tag of your branch, and create a pre-release. I would test it on my ID.3 tonight. |
I would test it also. |
Mee too, I do have a 2022 Touran. |
Is it ok if i do it tomorrow morning? Dont have any computer infront of me now 😊 @oliverrahner i think you should have access to do this also now when you are a collaborator 😊 |
Let us know when we can update from hacs ill do it roght away, for me is also ok for tomorrow as i see @oliverrahner used all my apicalls and the vw application is frozen 😂😂😂 |
Actually if one runs the Python code in the example with the library saved as a subfolder ("download as ZIP") and with the correct login information, we/you could get information about the sensors that are working or not. It is not the easy of use of Home Assistant sensors, but for debugging a lot of configurations it could be a viable solution. |
That is very strange... I tested only very little with your car and mostly with mine and the one from @michiii1337, and ours still work... But I can confirm that I also get HTTP 429s from the VW API for your credentials. We need to monitor that, because I have set up all our 3 cars in my Dev HA environment, so it might be some case that produces more API calls for electric cars than for others. |
@oliverrahner it is possible i dont know i use the app also almoast every time i go somewhere to heat the car, and i have also the other integration installed. But to have some ideeas i will delete the other integration and see from tomorrow what is hapening, ok? |
Sounds good! I also removed it now from my Dev instances, so we can investigate better. |
@oliverrahner I have deleted the other integration. As it happened last time after midnight it worked again, so from now it will be my mobile app and you for the api calls. If i can help with something let me know! |
volkswagencarnet/vw_vehicle.py
Outdated
data = await self._connection.getParkingPosition(self.vin) | ||
if data: | ||
self._states.update(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data = await self._connection.getParkingPosition(self.vin) | |
if data: | |
self._states.update(data) | |
if data := await self._connection.getParkingPosition(self.vin): | |
self._states.update(data) |
Just a perfect use for a walrus operator 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same argument again :) I tried to copy the original style as much as possible, and that's how it was done before.
My perspective on this is: rather have uniform code than optimizing every little detail once you stumble over it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, resolved the wrong convo
No, I am using the integration which is running 4 API's every 5 minutes + Login flow or Refresh token flow every hour. |
Gets confusing now :) I'll repost my comments in the PR, where they belong and remove them here. Regarding the rate limit: Could you try to spam the parking position API? I'll update the script in a second. Because I would really like to know if you can also reach the limit and at how many requests. |
I updated the Gist: |
The problem with this script is that is hammering the server every second. That might be the reason why you are getting rate-limited. I am not saying that there is no rate limit, I am just saying that there might be a combination of both amount of API requests and how frequently you do it. At least this is what I would do on WAF. :) |
Now the change I intended is there, 6d12a41... Difficult decision if we should leave it in or not. It doesn't seem to make a difference for you, but I'm also look at all the other people complaining about being rate limited 🤔 I agree that the actual rate and not only the pure number of requests should make a difference, but then it doesn't explain why the API doesn't bother at all about the other endpoints being hammered in the same way, but the do limit the parking position one... |
Right now I am at 820 requests to |
it might also be that VW moved to Prod and is still fine-tuning the configs. |
6d12a41
to
8fedaa8
Compare
@oliverrahner If a user has the In this way both kind of users will be happy... |
@oliverrahner I don't know if you paid attention but currently if VW servers go down, all the sensors are still available, and it gives you the wrong impression that everything is fine. We can introduce the connection status sensor that will show the service status. I have such a sensor for my Bosch/Siemens home appliances. OR we can drop all the sensors in an unavailable state which will indicate the problem. OR maybe even both. I think I like the last option more, connection status sensor + all the sensors in an unavailable state. I will work on the implementation of both. Let me know if you see it differently. |
I liked to proposal. |
@virtualdj Just noticed I didn't answer. Right now, we hope that @stickpin's fix really solves the problem in total, so that the users don't need to make that choice. |
yes, sounds good. :) |
@oliverrahner well...
Then I guess I will keep it this way and introduce only a connection status sensor for the time being. @robinostlund what was the initial idea to keep the previous state of the sensors if VW servers are down? |
@oliverrahner the funny part is that every VW endpoint is acting differently. Now for example:
Which connection status we should choose? :)) Or maybe create some string-based sensor and have 3 statuses? "Up", "Down", "Warning" with attributes that will show each endpoint status? |
Attributes are a bad idea. But to create a binary_sensor for each endpoint is also not very elegant. I guess I will start moving in this direction. |
That's also why I had a hard time reacting to the request for "last update" time that some people mentioned... there is not a specific time for everything, but rather a specific time per endpoint, sometimes even below that... I don't have a clear answer to this yet |
@oliverrahner wow. now I managed to get a response from
hmmm... one more use case to consider... :( |
@oliverrahner what do you say? The current logic is:
|
@oliverrahner please check: #228 I think we can merge it into the next stable branch as well. |
@oliverrahner Ignore it... this API always returns 207. I will update API status codes. |
@oliverrahner should we close this PR? |
All relevant work of this PR has been merged as part of #226 |
No description provided.