Skip to content

Commit

Permalink
Set AP password (#21)
Browse files Browse the repository at this point in the history
- If specified in secrets.ini, set a password on the soft-AP.
- Also, switch mqtt client library to that used by ESPHome.
  • Loading branch information
chl33 authored Oct 20, 2024
1 parent 548f5dc commit 87284ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ build_type = release
; ~/Projects2/Plant133/lib/watering
lib_deps =
watering
og3@^0.2.2
og3@^0.2.3
og3x-oled@^0.2.2
og3x-shtc3@^0.2.0
adafruit/Adafruit BusIO
adafruit/Adafruit SHTC3 Library
adafruit/Adafruit Unified Sensor
bblanchon/ArduinoJson@^7.0.0
ottowinter/AsyncMqttClient-esphome@ ^0.8.5
heman/AsyncMqttClient-esphome@^1.0.0
esphome/ESPAsyncWebServer-esphome@^3.0.0
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
Wire
Expand All @@ -48,6 +48,7 @@ build_flags =
; '-D LOG_UDP'
'-D WIFI_OLED'
'-D LOG_UDP_ADDRESS=${secrets.udpLogTarget}'
'-D AP_PASSWORD="${secrets.apPassword}"'

upload_protocol = ${secrets.uploadProtocol}
upload_port = ${secrets.uploadPort}
Expand Down
3 changes: 3 additions & 0 deletions secrets.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
udpLogTarget = 192, 168, 0, 20
# Add a password for other-the-air password updates.
otaPassword = {password-here}
# Add a password for the Soft-AP mode.
# This will allow soft-AP Wifi to be encrypted.
apPassword = {password-here}
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "watering.h"

#define SW_VERSION "0.7.3"
#define SW_VERSION "0.7.4"

namespace {

Expand Down Expand Up @@ -44,6 +44,9 @@ og3::HAApp s_app(
.withSoftwareName(kSoftware)
.withDefaultDeviceName("plant133")
.withOta(og3::OtaManager::Options(OTA_PASSWORD))
#if defined(AP_PASSWORD)
.withWifi(og3::WifiManager::Options().withApPassword(AP_PASSWORD))
#endif
#if defined(LOG_UDP) && defined(LOG_UDP_ADDRESS)
.withApp(og3::App::Options().withLogType(og3::App::LogType::kUdp))
.withUdpLogHost(IPAddress(IPAddress(LOG_UDP_ADDRESS)))
Expand Down

0 comments on commit 87284ad

Please sign in to comment.