You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(settings): make device hostname configurable at runtime
Move hostname from compile-time build flag to user-configurable setting stored
in SettingsManager. Hostname can now be changed via web UI or REST API
without recompiling firmware. Applied to mDNS, WiFi AP name, syslog, and
ArduinoOTA. Default values from HOST_NAME build flag are preserved for
backward compatibility. Device restart required for mDNS and AP changes to
take full effect.
Copy file name to clipboardExpand all lines: Agents.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,7 @@ All ESP32-specific functions use the HAL abstraction (`IHAL.h`). New hardware in
83
83
-**SunriseSunset** - Location-based calculations with timezone support
84
84
85
85
### Recent Completions
86
+
- Configurable Device Hostname (user-editable setting in web UI, stored in SettingsManager, used for mDNS/WiFi AP/syslog/ArduinoOTA, device restart required, defaults: "CoopController" or "CoopHWEmulator")
86
87
- OTA Update System Complete (full OTA: manifest check, streaming firmware/filesystem download, ESP32 Update.h flash, NVS settings backup, redirect handling, REST API endpoints, web UI with progress, force reinstall option, 71 tests)
87
88
- NVS Settings Preservation for OTA Updates (backup to NVS before filesystem flash, auto-restore on boot, 3 new HAL NVS methods, OTA settings serialization fix, 14 new tests)
88
89
- Git Commit SHA on Update Page (clickable link to GitHub commit, build flag pipeline)
Copy file name to clipboardExpand all lines: docs/api-reference.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ Get current system settings. **Public** (password field excluded for security).
16
16
17
17
```json
18
18
{
19
+
"hostname": "CoopController",
19
20
"ssid": "MyNetwork",
20
21
"ap_mode": false,
21
22
"enabled": true,
@@ -44,6 +45,7 @@ Update system settings. Only provided fields are updated.
44
45
45
46
```json
46
47
{
48
+
"hostname": "MyCoopController",
47
49
"ssid": "NewNetwork",
48
50
"passwd": "NewPassword",
49
51
"temp_threshold_on_f": 32.0,
@@ -54,7 +56,7 @@ Update system settings. Only provided fields are updated.
54
56
55
57
**Response:**`200 OK` with "ok" text.
56
58
57
-
**Note:** WiFi settings (ssid, passwd, ap_mode) trigger system restart after save.
59
+
**Note:** WiFi settings (ssid, passwd, ap_mode) trigger system restart after save. Hostname changes take effect immediately for most uses, but mDNS and WiFi AP name changes require device restart.
Copy file name to clipboardExpand all lines: docs/feature-tracker.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,70 @@ This document tracks all features: completed, in-progress, and planned.
43
43
44
44
## Completed Features
45
45
46
+
### Configurable Device Hostname ✅
47
+
48
+
**Implemented:** 2026-02-12
49
+
**Status:** Complete and tested
50
+
**Implementation:** User-configurable setting in SettingsManager, web UI, and API
51
+
52
+
**Summary:**
53
+
Device hostname is now a user-configurable setting, allowing users to change the device identity without recompiling firmware. Previously, hostname was only a compile-time build flag (HOST_NAME). The setting is stored in SettingsManager's user_settings.json alongside other persistent settings.
54
+
55
+
**Key Changes:**
56
+
57
+
1.**SettingsManager**
58
+
- Added `hostname` (String) setting with getters/setters
59
+
- Default: "CoopController" for main builds, "CoopHWEmulator" for emulator builds
60
+
- BUILD_FLAG: `HOST_NAME` now serves as the compile-time default value only
61
+
- Persisted in `user_settings.json` for persistence across reboots
62
+
63
+
2.**SettingsManager Initialization**
64
+
-`begin()` applies the stored hostname to Logger for syslog identification
65
+
- Runtime reconfiguration without requiring device restart for most uses
66
+
67
+
3.**Device Integration Points**
68
+
-**mDNS:** Used by WifiController for mDNS hostname registration (requires device restart to take effect)
69
+
-**WiFi AP Name:** Used for AP SSID when in AP mode
70
+
-**Syslog Identification:** Logger uses hostname for remote syslog messages
71
+
-**ArduinoOTA:** Used for network OTA discovery and identification
72
+
73
+
4.**REST API**
74
+
-`/get_settings` - Returns hostname field in response
75
+
-`/update_settings` - Hostname can be updated via JSON field
76
+
- No immediate restart required for API change, but mDNS/AP changes require device restart
77
+
78
+
5.**Web UI**
79
+
- Settings page: "Device Settings" section with hostname text input
80
+
- Validation: Non-empty, alphanumeric + hyphens
81
+
- Label and help text explaining the setting and restart requirement
82
+
83
+
6.**Behavior**
84
+
- Changing hostname updates the setting immediately in LittleFS
85
+
- mDNS re-registration and WiFi AP name update require device restart
86
+
- Hostname update is logged at INFO level
87
+
- Empty/invalid hostnames revert to default at next boot
88
+
89
+
**Files Modified:**
90
+
-`lib/SettingsManager/SettingsManager.h` - Added hostname field
0 commit comments