This commit is contained in:
Devaev Maxim
2020-09-10 07:09:03 +03:00
parent 31fdcd2f3c
commit a6385cd20e
2 changed files with 42 additions and 27 deletions

View File

@@ -52,8 +52,9 @@ class UserGpioApi:
async def __switch_handler(self, request: Request) -> Response:
channel = valid_ugpio_channel(request.query.get("channel"))
state = valid_bool(request.query.get("state"))
done = await self.__user_gpio.switch(channel, state)
return make_json_response({"done": done})
wait = valid_bool(request.query.get("wait", "0"))
await self.__user_gpio.switch(channel, state, wait)
return make_json_response()
@exposed_http("POST", "/gpio/pulse")
async def __pulse_handler(self, request: Request) -> Response: