Add API route for logging alarm light value
This commit is contained in:
parent
c3238f8b75
commit
750eed0fb6
|
@ -484,6 +484,17 @@ class StatsViewSet(viewsets.ViewSet, List):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise exceptions.ValidationError(dict(data='This field is required.'))
|
raise exceptions.ValidationError(dict(data='This field is required.'))
|
||||||
|
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def alarm(self, request):
|
||||||
|
try:
|
||||||
|
logging.info('Alarm value: ' + str(request.data['data']))
|
||||||
|
#cache.set('alarm', int(request.data['data']))
|
||||||
|
return Response(200)
|
||||||
|
except ValueError:
|
||||||
|
raise exceptions.ValidationError(dict(data='Invalid integer.'))
|
||||||
|
except KeyError:
|
||||||
|
raise exceptions.ValidationError(dict(data='This field is required.'))
|
||||||
|
|
||||||
@action(detail=False, methods=['post'])
|
@action(detail=False, methods=['post'])
|
||||||
def track(self, request):
|
def track(self, request):
|
||||||
if 'name' in request.data:
|
if 'name' in request.data:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user