Skip to content

Commit

Permalink
bugfix for TypeError when validation Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffykraken committed Mar 9, 2019
1 parent 8493b1a commit 0c9bd9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bvgsensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Version 0.2 - added multiple destinations, optimized error logging
# Version 0.3 fixed encoding, simplified config for direction
# Version 0.3.1 fixed a bug when departure is null
# Version 0.3.2 bufix for TypeError

from urllib.request import urlopen
import json
Expand Down Expand Up @@ -233,7 +234,7 @@ def isCacheValid(self):
date_now = datetime.now(pytz.timezone(self.hass_config.get("time_zone")))
# If there is no connection right from the start
if self._cache_creation_date is None:
self._cache_creation_date = os.path.getmtime("{}{}".format(self.file_path, self.file_name))
self._cache_creation_date = datetime.fromtimestamp(os.path.getmtime("{}{}".format(self.file_path, self.file_name)))
td = self._cache_creation_date - date_now
td = td.seconds
_LOGGER.debug("td is: {}".format(td))
Expand Down

0 comments on commit 0c9bd9c

Please sign in to comment.