Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/google_travel_time/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_API_KEY, CONF_NAME, EVENT_HOMEASSISTANT_START, ATTR_LATITUDE,
ATTR_LONGITUDE, CONF_MODE)
ATTR_LONGITUDE, ATTR_ATTRIBUTION, CONF_MODE)
from homeassistant.helpers import location
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

ATTRIBUTION = "Powered by Google"
Comment thread
ljmerza marked this conversation as resolved.

CONF_DESTINATION = 'destination'
CONF_OPTIONS = 'options'
CONF_ORIGIN = 'origin'
Expand Down Expand Up @@ -181,6 +183,9 @@ def device_state_attributes(self):
res['duration'] = _data['duration']['text']
if 'distance' in _data:
res['distance'] = _data['distance']['text']
res['origin'] = self._origin
res['destination'] = self._destination
res[ATTR_ATTRIBUTION] = ATTRIBUTION
return res

@property
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/waze_travel_time/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

_LOGGER = logging.getLogger(__name__)

ATTR_DESTINATION = 'destination'
ATTR_DURATION = 'duration'
ATTR_DISTANCE = 'distance'
ATTR_ORIGIN = 'origin'
ATTR_ROUTE = 'route'

ATTRIBUTION = "Powered by Waze"
Expand Down Expand Up @@ -147,6 +149,8 @@ def device_state_attributes(self):
res[ATTR_DURATION] = self._waze_data.duration
res[ATTR_DISTANCE] = self._waze_data.distance
res[ATTR_ROUTE] = self._waze_data.route
res[ATTR_ORIGIN] = self._waze_data.origin
res[ATTR_DESTINATION] = self._waze_data.destination
return res

def _get_location_from_entity(self, entity_id):
Expand Down