wrong place

This commit is contained in:
karl.hudgell 2021-10-26 15:55:21 +01:00
parent 4f8d4ac222
commit a79b3e1f24

View File

@ -8,8 +8,8 @@ from tenacity import wait_exponential, retry, stop_after_attempt
app = Flask(__name__)
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/on")
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
def on():
result = subprocess.run(
[f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n cc2333"],
@ -23,8 +23,8 @@ def on():
return "On"
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/off")
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
def off():
result = subprocess.run(
[f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n cc2433"],
@ -38,8 +38,8 @@ def off():
return "Off"
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/colour")
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
def hello():
# a = request.query_string
r = int(request.args.get("r"))
@ -51,7 +51,9 @@ def hello():
str = "56" + hex + "00f0aa"
try:
result = subprocess.run(
[f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"],
[
f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"
],
stdout=subprocess.PIPE,
shell=True,
).stdout.decode("utf-8")