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

Controller firmware overhaul (part 1) #179

Merged
merged 9 commits into from
Sep 13, 2024

Conversation

calvinmclean
Copy link
Owner

@calvinmclean calvinmclean commented Sep 9, 2024

Description

I am working on overhauling the controller firmware to be more easy to setup, update, and configure. Ultimately, the goal is to have a single firmware binary that is separate from a user's configuration. You should be able to download the binary file, put it on an ESP32, and then connect to WiFi and MQTT using a captive portal. Then, you can create a config in the UI and publish to the controller.

Part 1, this PR, includes:

  • WifiManager library is used for captive portal setup for WiFi and MQTT. It also provides manual OTA uploads
  • Remove extra firmware features that complicate things
    • Moisture sensors
    • Buttons
    • Extra options for health and other features that don't need to be changed
  • Simplify config overall to prepare for JSON
  • Add test project for developing and testing config format and filesystem
  • Add mDNS to easily connect to WifiManager portal without IP address

Next, I will need:

  • New config or firmware either as part of a Garden or as a child resource in the API (/gardens/{gardenID}/config)
  • Update controller to use config JSON and load it from MQTT
    • Before config is received, it should just listen on the one topic and publish health messages
  • The server should be able to notify the controller of new firmware (over MQTT) so the controller can download from a Github release (this is probably part 3)

- Remove unused moisture sensing: this is impractical and inaccurate
- Remove unused buttons: this is a nice feature but I don't use it or
  imagine it being used since I have good connectivity and UI now
- Remove options for logging, watering, and health so they are always
  enabled
- Currenlty using this project to explore serializing the controller
  configuration to JSON
- This allows OTA update when a user opts to install firmware
  with configured SSID and password
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.33%. Comparing base (1f7e538) to head (02a8b1e).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #179      +/-   ##
==========================================
+ Coverage   76.87%   77.33%   +0.45%     
==========================================
  Files          63       63              
  Lines        3650     3529     -121     
==========================================
- Hits         2806     2729      -77     
+ Misses        602      561      -41     
+ Partials      242      239       -3     
Components Coverage Δ
garden-app 77.33% <100.00%> (+0.45%) ⬆️

@calvinmclean calvinmclean merged commit c36b137 into main Sep 13, 2024
6 checks passed
@calvinmclean calvinmclean deleted the feature/controller-wifimanager branch September 13, 2024 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant