Skip to content

Commit

Permalink
Fix De Lijn component tzinfo error
Browse files Browse the repository at this point in the history
This fix should update the issue "Error:'str' object has no attribute 'tzinfo'" (issue #67455)
  • Loading branch information
bollewolle committed Jun 13, 2022
1 parent c660fae commit 7b7de62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion homeassistant/components/delijn/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import logging

from datetime import datetime

from pydelijn.api import Passages
from pydelijn.common import HttpException
import voluptuous as vol
Expand Down Expand Up @@ -111,7 +113,7 @@ async def async_update(self):
first = self.line.passages[0]
if (first_passage := first["due_at_realtime"]) is None:
first_passage = first["due_at_schedule"]
self._attr_native_value = first_passage
self._attr_native_value = datetime.strptime(first_passage, '%Y-%m-%dT%H:%M:%S%z')

for key in AUTO_ATTRIBUTES:
self._attr_extra_state_attributes[key] = first[key]
Expand Down

0 comments on commit 7b7de62

Please sign in to comment.