Fix hvv_departures request time (#40195)

pull/41934/head
Tom Schneider 2020-10-16 10:07:24 +02:00 committed by GitHub
parent 2b151209b2
commit d16c04a8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import logging
from aiohttp import ClientConnectorError
from pygti.exceptions import InvalidAuth
from pytz import timezone
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID, DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers import aiohttp_client
@ -65,11 +66,13 @@ class HVVDepartureSensor(Entity):
minutes=self.config_entry.options.get("offset", 0)
)
departure_time_tz_berlin = departure_time.astimezone(timezone("Europe/Berlin"))
payload = {
"station": self.config_entry.data[CONF_STATION],
"time": {
"date": departure_time.strftime("%d.%m.%Y"),
"time": departure_time.strftime("%H:%M"),
"date": departure_time_tz_berlin.strftime("%d.%m.%Y"),
"time": departure_time_tz_berlin.strftime("%H:%M"),
},
"maxList": MAX_LIST,
"maxTimeOffset": MAX_TIME_OFFSET,