Skip to content

Phase2#2

Open
carsonmwolfe wants to merge 340 commits into
Main-Branchfrom
Phase2
Open

Phase2#2
carsonmwolfe wants to merge 340 commits into
Main-Branchfrom
Phase2

Conversation

@carsonmwolfe

Copy link
Copy Markdown
Owner

No description provided.

@carsonmwolfe

Copy link
Copy Markdown
Owner Author

Phase 2.2

…reshold; relay: command queue endpoints + CORS; server: command polling + execution
carsonmwolfe and others added 30 commits July 2, 2026 20:10
All direct-to-Pi commands now fall back to relay when Tailscale
direct fails (Chrome blocks private network from public HTTP origins).

server.py: relay command handlers for:
  set_brightness:<0-100>  — sets backlight + saves settings
  notify:<title>|<msg>    — pushes notification to Pi screen
  set_mode:<mode>         — already existed
  Access-Control-Allow-Private-Network: true header added

dashboard: relay fallback added to setBrightness() and sendNotify().
All commands now work from any browser at 45.55.245.193/mission-control.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed sunrise/sunset-based dimming which was dimming at 8:25pm while
users are still actively using the display. Now uses the same fixed
10pm-7am window as the sleep canvas for consistent UX.
Removed unused _fetch_sun_times() function.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Was writing manual_raw (e.g. 226) every 5 min which overwrote any
brightness set by start.sh/system to full 255, causing visible dim.
always_on now skips the backlight entirely — leaves it wherever it is.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Daytime (7am-10pm): respects the user's brightness slider setting.
Nighttime (10pm-7am): dims to minimum (51/255).
Previously was blasting to 255 during day, overriding user preference.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AUTO: user brightness 7am-10pm, sleep canvas + dim 10pm-7am.
     Tap to wake → stays awake until 7am.
ALWAYS ON: user brightness always, no sleep canvas ever.

Removed SLEEP NOW mode — redundant with AUTO night window.
Simplified isNightMode(), disableNightMode(), settings UI, dashboard UI.
Wake override now correctly targets 7am (end of night window).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7px → 6px so long text fits within 185px right panel without clipping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FAVORABLE → GO, UNFAVORABLE → NO-GO. Shorter, standard range safety
terminology, and no longer clips on the Pi's 185px right panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Horizontal row layout: [~ MARGINAL]  AT LIFTOFF
Badge font 6px→8px, label stays 8px. More readable at distance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed ✕/~/✓ symbols, bumped font 8px→10px, same box size.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ecting

Previously only deleted by connection name == SSID, which fails when
nmcli saves profiles with different names. Now finds all 802-11-wireless
connections matching the SSID and deletes them all, preventing the
'psk not given' error from stale broken profiles.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wifi.html:
- Remove readonly (WebKit2GTK bug: readonly inputs return empty .value)
- Use -webkit-text-security:disc instead of type=password (no input reset)
- Don't clear password when re-selecting same network
- Client-side validation: empty password, min 8 chars, visual feedback
- CLR key to clear password field
- Character count hint (green ≥8, orange <8)
- Friendly error messages (translate nmcli errors to plain English)
- After 2+ failures: prompt to retry with clean profile
- Suppress native OSK on load and focus
- ✓ DONE key triggers connect

server.py:
- Validate ssid + password server-side, return early with clear errors
- Explicit wifi-sec.key-mgmt=wpa-psk to prevent auth type confusion
- Log all connection attempts with password length for diagnostics
- Log nmcli result for debugging

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Situations now covered:
- Open networks (OPEN toggle, no password required)
- Hidden SSIDs (HIDDEN button, manual name entry)
- 5GHz networks on Pi 3 A+ (detected, shown in orange, blocked with explanation)
- Enterprise/802.1X (detected, blocked with explanation)
- Double-tap connect (isConnecting guard)
- Empty password (blocked client + server side)
- Password < 8 chars or > 63 chars (WPA2 limits enforced)
- Stale nmcli profiles (all profiles for SSID deleted before connect)
- Wrong auth type (explicit wpa-psk key-mgmt set)
- Connected but no internet (captive portal detection via /api/health)
- Server disconnect mid-request (treated as success)
- All nmcli errors translated to plain English
- Attempt counter shown after 2+ failures
- Re-tapping same network no longer clears password
- Keyboard targets manual SSID field or password field correctly
- rfkill/blocked WiFi error message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
server.py: adds 'hidden yes' to nmcli command when hidden=True.
Without this flag nmcli can't connect to hidden networks at all.

wifi.html:
- HIDDEN button toggles proper hidden network mode (isHiddenNetwork flag)
- Step-by-step status messages guide user: type SSID → tap password field → type password
- Password field tap explicitly switches keyboard back from SSID field
- isHiddenNetwork flag sent to server on connect
- Closing HIDDEN mode resets state cleanly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Layout: OPEN/HIDDEN moved to their own row below CONNECT — no overflow.
Bug: oninput doesn't fire on programmatic .value changes from on-screen
keyboard. Replaced with updateHiddenSsid() called directly from handleKey
when keyboardTarget === 'manual-ssid'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wifi.html:
- Disconnect warning: "WILL DISCONNECT FROM [X]" when switching networks
- RECONNECT label when selecting current network
- RESTART WIFI button appears after 3+ failures (restarts NetworkManager)
- Slow DHCP: "STILL CONNECTING" message after 15s, timeout extended to 60s
- Empty scan: diagnoses rfkill vs no signal vs no adapter

server.py:
- /api/wifi/restart — sudo systemctl restart NetworkManager
- Connect timeout 30s → 60s for slow DHCP routers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previous approach only deleted profiles matching the SSID — unreliable
when profile names differ from SSID (common after failed attempts).
Now deletes every saved wifi profile before connecting so there's
zero chance of a stale profile causing 'psk not given'.

Removed wifi-sec.key-mgmt=wpa-psk — broke WPA3/mixed mode networks
(phone hotspots). Profile cleanup alone prevents the original error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses existing /api/notify-push so errors appear as the same overlay
banner as UPDATE COMPLETE — always visible regardless of layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Matches how nmtui (native Pi WiFi tool) works internally:
1. Delete our named profile (clean slate)
2. Add explicit profile with exact parameters
3. Activate it

Eliminates all the magic/guessing in 'dev wifi connect' that was
causing random failures. wifi-sec.key-mgmt is valid in 'con add'
(connection property) unlike 'dev wifi connect' (extra argument).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nmcli dev wifi ACTIVE flag is unreliable after con add + con up.
Now checks nmcli con show --active which correctly detects the
active connection regardless of how it was established.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Custom red error overlay with TAP TO DISMISS — always visible,
correct color, stays until user dismisses it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When nmcli con up fails, reads journalctl NetworkManager entries
to find the actual reason (wrong password, DHCP timeout etc).
Logs full journal to server.log for debugging.
Updated friendlyError() with more error patterns from NM journal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nmcli con add/delete require root to write /etc/NetworkManager/
system-connections/. Without sudo the profile creation silently
failed — only reason WiFi worked was old profile from before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Required for WiFi connect/scan to work from Flask (non-interactive).
Without NOPASSWD, sudo fails silently in non-TTY processes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deleting the active nmcli profile immediately drops the internet
connection. Now modifies the existing profile in place if it exists,
creates new if not. nmcli con up then switches to target network
without losing the current connection first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ensures modified profile settings are applied before nmcli con up.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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