新增灭蚊灯自动清扫接口

This commit is contained in:
Jay Huang 2023-12-02 16:25:31 +08:00
parent b95a6e0374
commit 6496583273
1 changed files with 3 additions and 0 deletions

View File

@ -215,6 +215,7 @@ class DeviceInfoAPIView(ListAPIView, RoleMixin):
@api_view(['POST'])
def remote_control(request, device_id):
command = request.data.get('command')
speed = request.data.get('speed')
if command == 'ledOn':
message = {'RemoteControl': {'LED': 'ON'}}
@ -222,6 +223,8 @@ def remote_control(request, device_id):
message = {'RemoteControl': {'LED': 'OFF'}}
elif command == 'countClear':
message = {'count': 0}
elif command == 'mosqClean':
message = {'MosqDeviceClean': speed}
else:
return Response({'error': 'Invalid command'}, status=400)