-
Notifications
You must be signed in to change notification settings - Fork 44
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
Revert "Keep UTC time zone attached to datetime objects when API retu… #109
Conversation
…rns timestamps in UTC." This reverts commit 02c9c84. Throws the following exception on Enyaq for Webspider: ``` Traceback (most recent call last): File "/home/nivo/dev/skodaconnect/example/me.py", line 358, in <module> loop.run_until_complete(main()) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/nivo/dev/skodaconnect/example/me.py", line 247, in main print(f'\tstr_state: {instrument.str_state} - state: {instrument.state}') File "/home/nivo/dev/skodaconnect/skodaconnect/dashboard.py", line 123, in str_state return f'{self.state}' File "/home/nivo/dev/skodaconnect/skodaconnect/dashboard.py", line 127, in state val = super().state File "/home/nivo/dev/skodaconnect/skodaconnect/dashboard.py", line 58, in state if hasattr(self.vehicle, self.attr): File "/home/nivo/dev/skodaconnect/skodaconnect/vehicle.py", line 1542, in last_connected last_connected = datetime.fromisoformat(last_connected_utc) ValueError: Invalid isoformat string: '2023-12-11T15:34:24.425Z' ```
Oh, I'm really sorry for the troubles. However I must say that I have asked about this on the original pull request:
I'm quite certain that problem is not with a model but with python version: Python 3.9:
Python 3.11:
Shall I implement this in a way that's compatible with Python before 3.11? |
@WebSpider did you get an error on a Python 3.9 env? If that's the case and it all works fine on 3.11 then I think you can just resubmit the exact same fix. HA Core depends on 3.11 now anyway (https://github.com/home-assistant/core/blob/dev/pyproject.toml#L24). Sorry we weren't quite sure yesterday and had to get a fix out for the updated user-agent. |
I will double check, I don't know what my python version in the venv was at that point. |
No worries, I can totally understand it. FYI: 3.10 is also expected to have the same error - just checked. And according to https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat 3.11 is the first version which support the required format. |
Yep. It was python version related. The exception is solved when using 3.11. However, the date conversion does not seem correct to me:
Results in the dashboard in:
So the time for some reason is set to the beginning of the epoch, and not to the value of |
On the surface this looks completely unrelated to my change. I only updated two specific sensors: |
I looked a bit more into these "N/A" and "1970-01-01T00:00:00". At least some of them seem to be related to actions initiated from Home Assistant. For example I have just triggered "Force data refresh" and now for
Before triggering "Force data refresh" I had "N/A" in I will prepare another PR identical to 02c9c84 later today. |
Align with requirements.txt. Required for skodaconnect#109. Note that HA-core already depends on 3.12. Fixes skodaconnect#123
@badrpc FYI - have to revert this so we can safely release a fix for the user-agent
This reverts commit 02c9c84.
Throws the following exception on Enyaq for Webspider: