Use the timezone defined in Home Assistant when making the API call (#23284)
* Use HA defined timezone * Cleanup * Use homeassistant.util.dt.now to get the correct time. * Update homeassistant/components/vasttrafik/sensor.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
1282370ccb
commit
ff867a7d57
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,4 @@
|
|||
"""Support for Västtrafik public transport."""
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
|
@ -10,6 +9,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
|
|||
from homeassistant.const import CONF_NAME, ATTR_ATTRIBUTION
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.dt import now
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -107,7 +107,7 @@ class VasttrafikDepartureSensor(Entity):
|
|||
self._departureboard = self._planner.departureboard(
|
||||
self._departure['id'],
|
||||
direction=self._heading['id'] if self._heading else None,
|
||||
date=datetime.now()+self._delay)
|
||||
date=now()+self._delay)
|
||||
except self._vasttrafik.Error:
|
||||
_LOGGER.debug("Unable to read departure board, updating token")
|
||||
self._planner.update_token()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue