I think you might have meant @jeffeb3, but I found it anyway.
If it were me, I would leave sql out of it. But you can store the settings wherever you like.
Here’s the steps I see:
- ESP32 needs to subscribe to the settings topics, and be able to read them when they change.
- You should be able to write to those topics in python. You can do this without flask or anything, just using mosquitto or some other mqtt library
- Store the settings to a file, and read them from the file in python. I wouldn’t use sql for this, I would just use a json txt file.
- Use flask to format a page to show the settings, make buttons, things like that from a list of settings.
- Make the buttons POST back to flask when the settings change. This can be a single POST when the form is filled.
So if you look at this:
http://flask.pocoo.org/docs/0.12/quickstart/#routing
You can see you can put any python into those functions, and when the browser asks for the page, that code will be called.
If you look at this:
http://flask.pocoo.org/docs/0.12/quickstart/#the-request-object
You can see that one of those routes can accept a POST request and the request object will be populated with information from the webpage. That’s how you’ll do something like get the set temperature from the webpage. The post in the webpage will fill in that information and python gets it from the POST and publishes the new temperature to mqtt, and saves it in the settings.
It’s kind of a mess (I wrote this years ago), but you might be able to see how I called a POST from a button on my thermostat: