Fixed invalid response when sending a test-request from Locative iOS app (#5179)

This commit is contained in:
Sander de Leeuw authored and Johann Kellerman committed 2017-01-05 10:05:39 +02:00
1 parent 2f907696f3
commit 497a1c84b5
2 files changed
+13 -6

No files matched your search

@@ -63,18 +63,18 @@ class LocativeView(HomeAssistantView):
return ('Device id not specified.',
HTTP_UNPROCESSABLE_ENTITY)
if 'id' not in data:
_LOGGER.error('Location id not specified.')
return ('Location id not specified.',
HTTP_UNPROCESSABLE_ENTITY)
if 'trigger' not in data:
_LOGGER.error('Trigger is not specified.')
return ('Trigger is not specified.',
HTTP_UNPROCESSABLE_ENTITY)
if 'id' not in data and data['trigger'] != 'test':
_LOGGER.error('Location id not specified.')
return ('Location id not specified.',
HTTP_UNPROCESSABLE_ENTITY)
device = data['device'].replace('-', '')
location_name = data['id'].lower()
location_name = data.get('id', data['trigger']).lower()
direction = data['trigger']
gps_location = (data[ATTR_LATITUDE], data[ATTR_LONGITUDE])