A small dev server to accelerate development on the Open HEMS mobile app.
brew install pipenv
pipenv install
pipenv run python main.py
pipenv run python main.py --lan
Alternatively (if you're not into the whole brevity thing)
pipenv shell
FLASK_APP=main FLASK_ENV=development flask run
pipenv run pytest
Interacting with Swagger UI
The Swagger UI is a convenient GUI for interacting with the existing endpoints.
- Visit jwt.io and replace
your-256-bit-secret
withsuper secret
(or whateverJWT_SECRET_KEY
value from app config) - Copy the encoded JWT
- Visit Swagger UI and tap
🔓 Authorize
- Paste
Bearer <YOUR_ENCODED_JWT>
in the value and hit submit. - ...
- Profit!
Once authorized, try hitting the GET /devices
endpoint. You should receive a 200
response with some interesting device data. If you receive a 422
or otherwise you probably have a poorly-formed JWT.
Sample JWT to get started:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.W9wGb8Cs1SoCoiJ6WRzK6NMg7xed7PBNYJpBNIoD_G8