fix host flag and simplify the headwind constructor

This commit is contained in:
Tomasz Frątczak 2023-11-15 22:16:16 +01:00
parent 71ab300339
commit 28a8c01a5a
3 changed files with 3 additions and 6 deletions

View File

@ -1,12 +1,11 @@
# Initialise flask # Initialise flask
from flask import Flask from flask import Flask
app = Flask(__name__) app = Flask(__name__)
app.config['SERVER_NAME'] = '0.0.0.0:5000'
app.config.from_prefixed_env() app.config.from_prefixed_env()
# Initialise the bluetooth stack # Initialise the bluetooth stack
from bluewind import headwind from bluewind import headwind
fan = headwind.Headwind(app, app.config["ADDRESS"]) fan = headwind.Headwind(app.config["ADDRESS"])
# Load the views # Load the views
from bluewind import views from bluewind import views

View File

@ -16,9 +16,7 @@ CHARACTERISTIC = "a026e038-0a7d-4ab3-97fa-f1500f9feb8b"
class Headwind: class Headwind:
fanClient = None fanClient = None
flaskApp = None def __init__(self, address):
def __init__(self, flaskApp, address):
self.flaskApp = flaskApp
self.fanClient = BleakClient(address) self.fanClient = BleakClient(address)
async def readSpeed(self): async def readSpeed(self):

View File

@ -2,4 +2,4 @@
from bluewind import app from bluewind import app
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=False) app.run(debug=False, host='0.0.0.0')