Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comms: WiFi Configuration #22

Open
mitra42 opened this issue Sep 28, 2024 · 3 comments
Open

Comms: WiFi Configuration #22

mitra42 opened this issue Sep 28, 2024 · 3 comments
Labels

Comments

@mitra42
Copy link
Owner

mitra42 commented Sep 28, 2024

How to get the WiFi configured - ?

I've seen several libraries ...
https://github.com/Juerd/ESP-WiFiSettings - looks ok - WiFi portal if can't connect to previous can collect other variables (e.g. MQTT) - also see OTA example here
https://github.com/tabahi/ESP-Wifi-Config - not as sophisticated as Juerd's uses local memory rather than SPIFF
https://github.com/snakeye/WifiConfig - simple, builds UI with javascript but note it MIGHT require net connectivity to fetch those dependencies ?
Either may do what is needed in terms of a captive portal, but that may not be the right solution for field deployment

Note some examples at https://github.com/snakeye/WifiConfig/blob/master/src/WiFiConfig.cpp of WiFi parms to EEPROM

@mitra42 mitra42 added the comms label Oct 5, 2024
@mitra42
Copy link
Owner Author

mitra42 commented Oct 13, 2024

Design thinking ..... (independent of looking at what others have done)

  • If device has been configured it should try and connect to prior WiFi & MQTT while also offering config options
  • If hit reset button (unclear if this is same as power cycling) it should offer config options for a short while.

Config options

  • It should be able to be reached by BLE - but what goes on the phone side of that, and note that not all LMIC smart phones have BLE. This needs research as haven't worked with BLE before.
  • It should offer a WiFi page, this should allow setting WiFi SSID & passwd & MQTT host (& node id?)
  • it might want to try and connect to a few specific WiFi SSIDs and then a specific MQTT host.

More thoughts

  • Should combine this with setting ID of the node
  • Start with Juerd's library - if its too heavyweight then strip down for a later version

@mitra42
Copy link
Owner Author

mitra42 commented Oct 14, 2024

First attempts with Juerd's library

  • POC
    • Test example from ESP-WiFiSettings on ESP8266
      • test edited example on ESP32
      • Submit fixes to example to library ESP-WiFiSettings
      • Open issue regarding clearing settings.
      • Open issue regarding language settings at compile time
    • Copy/adapt to new system_wifi.cpp
    • Test minimal
    • Add mqtt config
    • Try with ESP32
    • Move WiFi from system_mqtt to system_wifi
    • Check other WiFi issues posted
    • Make sure can reconnect e.g. if WiFi off temporarily
    • Obtain client id and pass to MQTT and poss WiFi client
  • MVP
    • Add Indonesian as a language and document how to do this - may require library fork - and maybe compile-time language selection to reduce space
    • Add link to html portal (maybe presume on same machine as mqtt on known port) and allow configuration
    • Probably some of the items in previous comment.
    • Need way to initiate clearing settings - a call to WiFiSettings.portal does it, but need way to trigger that. Maybe two resets without connecting
  • More
    • Think about displaying retained topics simply (blind topic:value) or clever (e.g. bars) via some javascript (probably by forking library)

@mitra42
Copy link
Owner Author

mitra42 commented Oct 24, 2024

Made the WiFi portal time out - it only does this if it has enough information to attempt a connect, in which case after (configurable) 2 minutes it will reset and try wifi again.

Tested a bit - e.g. turn off WiFi - watch portal come on - turn WiFi back on, see portal timeout and reconnect to WiFi.

Note - its dumb, there is no data etc being collected while WiFi is down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant