Command does not require addr

This commit is contained in:
2021-12-19 22:15:54 +01:00
parent a06520025b
commit 46f7565820
3 changed files with 4 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ class Connector:
print(message)
return True
def passthrough(self, address, data):
def passthrough(self, data):
self.__mqtt_pub(data)
def ops(self, address, data, function=False):

View File

@@ -4,7 +4,7 @@ from driver.views import SendCommand, Function, Cab, Emergency, Infra
urlpatterns = [
path('emergency', Emergency.as_view()),
path('infra', Infra.as_view()),
path('<int:address>/command', SendCommand.as_view()),
path('command', SendCommand.as_view()),
path('<int:address>/cab', Cab.as_view()),
path('<int:address>/function', Function.as_view()),
]

View File

@@ -24,13 +24,12 @@ def addresschecker(f):
return addresslookup
@method_decorator(addresschecker, name="put")
class SendCommand(APIView):
parser_classes = [PlainTextParser]
def put(self, request, address):
def put(self, request):
data = request.data
conn.passthrough(address, data)
conn.passthrough(data)
return Response(data,
status=status.HTTP_202_ACCEPTED)