skodaconnect / homeassistant-skodaconnect

Skoda Connect - A home assistant plugin to add integration with your car
Apache License 2.0
232 stars 28 forks source link

strptime() argument 1 must be str, not None #153

Closed ChristophCaina closed 1 year ago

ChristophCaina commented 1 year ago

Describe the bug hi, I'm getting the following error in the HA Logs:

2022-12-08 14:03:24.300 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/config/custom_components/skodaconnect/sensor.py", line 50, in state
return self.instrument.state
File "/usr/local/lib/python3.10/site-packages/skodaconnect/dashboard.py", line 127, in state
val = super().state
File "/usr/local/lib/python3.10/site-packages/skodaconnect/dashboard.py", line 58, in state
if hasattr(self.vehicle, self.attr):
File "/usr/local/lib/python3.10/site-packages/skodaconnect/vehicle.py", line 1395, in last_connected
last_connected = datetime.strptime(last_connected_utc,'%Y-%m-%dT%H:%M:%S.%fZ').astimezone().replace(tzinfo=None).replace(microsecond=0)
TypeError: strptime() argument 1 must be str, not None

Latest working release unknown

Debug logs If applicable, add debug logs. See README on how to enable debug logs with response debugging.

Installation:

Additional context Add any other context about the problem here.

Farfar commented 1 year ago

Same root cause as #151.

Problem is most likely service outage but newer library handles errors better.

flopp999 commented 1 year ago

I still have this issue, if I have the latest library I don't know :)

"skodaconnect": {
      "version": "v1.1.4",
      "requirements": [
        "skodaconnect>=1.2.5",
        "homeassistant>=2022.12.0"
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Frontend 20221213.1 - latest
Farfar commented 1 year ago

The issue is that the API responds with empty data from time to time. I am working on error checking for this.

Farfar commented 1 year ago

The issue is that the API responds with empty data from time to time. I am working on error checking for this.