Skip to content
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

parse_datetime reports error on missing lastFetched field #610

Closed
2 of 4 tasks
rleidner opened this issue Apr 30, 2024 · 2 comments · Fixed by #612
Closed
2 of 4 tasks

parse_datetime reports error on missing lastFetched field #610

rleidner opened this issue Apr 30, 2024 · 2 comments · Fixed by #612
Labels
bug 🐛 Something isn't working

Comments

@rleidner
Copy link

Describe the issue

I get this error:

unable to parse 'None' using ['%Y-%m-%dT%H:%M:%S.%f%z', '%Y-%m-%dT%H:%M:%S%z', '%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%SZ']

For the car there is no "lastFetched" in attributes.

I think this code in bimmer_connected/utils.py:
def parse_datetime(date_str: str) -> Optional[datetime.datetime]: """Convert a time string into datetime.""" if not date_str: return None date_formats = ["%Y-%m-%dT%H:%M:%S.%f%z", "%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%SZ"]
should rather be:
def parse_datetime(date_str: str) -> Optional[datetime.datetime]: """Convert a time string into datetime.""" if not date_str or date_str = "None": return None date_formats = ["%Y-%m-%dT%H:%M:%S.%f%z", "%Y-%m-%dT%H:%M:%S%z", "%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%SZ"]

The calling vehicle/vehicle.py converts None to "None"...

Expected behavior

avoid the error message

Which Home Assistant version are you using?

bimmerconnected cli

What was the last working version of Home Assistant Core?

n/a

What is your region?

Rest of world

MyBMW website

  • I can still successfully login to the BMW MyBMW website and the car status is available there.
  • I have MyBMW enabled for my vehicle.

Number of cars

  • I have 2 or more cars linked to the MyBMW account.
  • I have a Mini vehicle linked to my account.

Output of bimmer_connected fingerprint

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@rleidner rleidner added the bug 🐛 Something isn't working label Apr 30, 2024
@rikroe
Copy link
Member

rikroe commented Apr 30, 2024

Thanks, hope the PR solves it.

@rleidner
Copy link
Author

Thanks, that was fast. Is solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants