Skip to content

Commit

Permalink
If no departure time is set, use now as the default. If departure tim…
Browse files Browse the repository at this point in the history
…e is set but does not have a :, assume its a preformed Unix timestamp and send along as raw input. Assume same for arrival_time.
  • Loading branch information
robbiet480 committed May 23, 2016
1 parent 98de7c9 commit b3afb38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions homeassistant/components/sensor/google_travel_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,15 @@ def update(self):
atime = options_copy.get('arrival_time')
if dtime is not None and ':' in dtime:
options_copy['departure_time'] = convert_time_to_utc(dtime)
elif dtime is not None:
options_copy['departure_time'] = dtime
else:
options_copy['departure_time'] = 'now'

if atime is not None and ':' in atime:
options_copy['arrival_time'] = convert_time_to_utc(atime)
elif atime is not None:
options_copy['arrival_time'] = atime

self._matrix = self._client.distance_matrix(self._origin,
self._destination,
Expand Down

0 comments on commit b3afb38

Please sign in to comment.