BrewPi/firmware

Can connect brewpi via WiFi

Opened this issue · 1 comments

With the Spark Core being WiFi enabled, it makes sense to leverage this to get Wireless brewpi.

  • setup wifi credentials.
    • via Serial: the Web UI will accept the WiFI details and send these to the device via the script. This requires a new command in the uC to accept and set the wifi credentials using the api WiFi.setCredentials().
    • Using listening mode and the Spark app should also be an option. (The Web UI has a button that when clicked puts the device in listening mode to save users from having to open the case.)
  • is the uC a TCP client or server?
    • as a client: will have to continually monitor the connection, and reconnect when down. How to configure the IP to connect to? mDNS/zeroconf would avoid the need for configuration.
    • as server: no IP config needed on the spark, but on the rpi, unless zero conf is used. Also no need for the spark to continually reconnect.
    • use zeroconf to avoid IP config
  • brewpi.py discover command line param will list discovered uC devices. each device given with it's device ID. Default ID is MAC address. This is copied by the user into brewpi config to talk to a specific device?
  • how is the brewpi script configured to connect to either serial or wifi?
    • startup attempts to look on serial and broadcasted devices on mDNS
  • How does the device know which interface to use? There is only one global piStream object which will talk either over serial or WiFi. It may need to be a multiplexer object - route to serial and to any TCP connections. (this is what was done in the nice-firm repo - the code relies on the boost library but should be relatively easy to back port to the current brewpi code.)

This has been implemented in develop with the help of @glibersat. Pyserial seems to be able to work with TCP sockets too, so it was a smaller effort than expect. The user can now just set a socket as serial port and it will work. The controller listens on both and sends data back to the latest connection that was used.

I have tried mDNS, but it added 10k to the build size, so I have omitted it. The Spark will now show it's IP address on screen and the user should add it to config.cfg.

More details can be found on the new wiki: https://wiki.brewpi.com/how-to-setup-wifi-on-the-brewpi-spark

Setting WiFi credentials via the web interface is not yet implemented.