removed webapi
parent
38904bf5ac
commit
f81cae3581
23
main.py
23
main.py
|
@ -3,13 +3,6 @@ import requests
|
||||||
from rpi_ws281x import *
|
from rpi_ws281x import *
|
||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import os
|
import os
|
||||||
try:
|
|
||||||
from flask import Flask, request
|
|
||||||
except:
|
|
||||||
os.system('pip3 install Flask')
|
|
||||||
os.system('sudo pip3 install Flask')
|
|
||||||
from flask import Flask, request
|
|
||||||
import threading
|
|
||||||
|
|
||||||
# LED strip configuration:
|
# LED strip configuration:
|
||||||
LED_COUNT = 60 # Number of LED pixels.
|
LED_COUNT = 60 # Number of LED pixels.
|
||||||
|
@ -73,23 +66,7 @@ def power_toggle(channel):
|
||||||
power_button_pressed = 'True'
|
power_button_pressed = 'True'
|
||||||
print('Toggle Power executed')
|
print('Toggle Power executed')
|
||||||
|
|
||||||
#Web API
|
|
||||||
app = Flask(__name__)
|
|
||||||
|
|
||||||
@app.route('/')
|
|
||||||
def index():
|
|
||||||
command = str(request.args.get('command'))
|
|
||||||
if command == "switch-ilde-mode":
|
|
||||||
print('Switched Idlemode via API')
|
|
||||||
change_idle_mode
|
|
||||||
elif command == "switch-toggle-on-off":
|
|
||||||
print('Toggled Power via API')
|
|
||||||
power_toggle
|
|
||||||
|
|
||||||
return command
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
threading.Thread(target=app.run(host="0.0.0.0", port=80, use_reloader=False)).start()
|
|
||||||
|
|
||||||
led_power = 'True'
|
led_power = 'True'
|
||||||
idle_mode = 1
|
idle_mode = 1
|
||||||
|
|
Loading…
Reference in New Issue