Skip to content

Conversation

@dbieber
Copy link
Owner

@dbieber dbieber commented Apr 14, 2025

Make it so the wifi is configurable in the settings server. right now wifi can only be configured either through the :wifi command (in system_commands.py) or by manually editing the wpa_supplicant, but that's tedius and technical and we want non-technical users to be able to use go note go, so we want wifi to be configurable in the settings server. Currently the :wifi command simply appends to the wpa_supplicant. Instead, let's take a different approach: Let's store the registered wifi configs in redis We'll make the :wifi command add a new config to the list (if it doesn't already exist). The settings UI will load the wifi configs from redis (using the settings module — settings.get and settings.set are the way to update redis from the settings server) Whenever the wifi configs in redis get updated, let's update a special section of the wpa supplicant: This section will be demarcated by a begin and end comment. And when it's updated, (1) if that section doesn't exist, it will be added, (2) if it does exist, it will be replaced wholesale. Each time its updated that special Go Note Go managed section will be updated to list all the wifi networks present in the redis config. In this way the user can add/remove wifi configs via the settings UI or add using the :wifi command.

Conversation Prompts

Initial request

Make it so the wifi is configurable in the settings server. right now wifi can only be configured either through the :wifi command (in system_commands.py) or by manually editing the wpa_supplicant, but that's tedius and technical and we want non-technical users to be able to use go note go, so we want wifi to be configurable in the settings server. Currently the :wifi command simply appends to the wpa_supplicant. Instead, let's take a different approach: Let's store the registered wifi configs in redis We'll make the :wifi command add a new config to the list (if it doesn't already exist). The settings UI will load the wifi configs from redis (using the settings module — settings.get and settings.set are the way to update redis from the settings server) Whenever the wifi configs in redis get updated, let's update a special section of the wpa supplicant: This section will be demarcated by a begin and end comment. And when it's updated, (1) if that section doesn't exist, it will be added, (2) if it does exist, it will be replaced wholesale. Each time its updated that special Go Note Go managed section will be updated to list all the wifi networks present in the redis config. In this way the user can add/remove wifi configs via the settings UI or add using the :wifi command.

Remove country code

I notice you allow for configuring country but I don't think that gets used right now. Let's remove it.

Rename commands to avoid collisions

rename wifi migrate and wifi list to wifi-migrate and wifi-list (otherwise they collide with the wifi {} command)

Debugging UI issue

the wifi settings aren't showing when I load the settings UI page

to fix,

  1. move the wifi saving and loading and updating logic out of system_commands into its own module (but respect the style conventions of the project still! eg 2 space indentation)

  2. in settings/server.py make sure we're returning the wifi settings properly in /api/settings and using them properly in the App.tsx

  3. similarly we need to make a fix for when we're saving the wifi settings. right now there's a weird non-standard import pattern in do_POST; instead just import the new wifi module normally and save the wifi settings with ordinary python

keep the changes minimal to fix these issues; don't do other fixes or changes beyond what I've asked

Remove wifi/init.py

gonotego/settings/wifi/init.py is still showing in the pr

Remove comment

remove the "# WiFi functions moved to gonotego.settings.wifi module" comment...

Move migrate logic

move the migrate logic to the wifi library as well

Fix circular imports

to avoid the circula imports with "shell", move the wifi commands out of system_commands into a new wifi_commands.py in command_center/

then wifi.py can just use ordinary imports

Shell function advice

in wifi.py you can continue to use the shell function - just import system_commands at the top rather than shell in the middle;

this will no longer be a circular import since system_commands will no longer depend on wifi

Formatting

that comment isn't necessary; remove it and continue

also don't add trailing spaces to lines

Final UI issue debugging

when I go to the settings ui, I still don't see the wifi configs from wifi.get_networks() - why?

get_networks returns the right thing:

[{'ssid': 'BiebsNet', 'psk': 'mane7-tuber-mil'}, {'ssid': 'Clark_96-98_A', 'psk': '2270piano1155'}, {'ssid': "David's iPhone (2)", 'psk': 'ee87k87k'}, {'ssid': 'DavidPhone', 'psk': 'ee87k87k'}, {'ssid': '@Hyatt_WiFi'}, {'ssid': 'Solaris', 'psk': 'junta-sown-gunwale-muse-SEMINAR'}, {'ssid': 'Xenia', 'psk': 'RibbitRibbit!'}, {'ssid': 'Incepto incepto ne', 'psk': 'desistam'}, {'ssid': 'Barnes Guest', 'psk': 'Goldrush225'}]

what should I check next?

Oh! The issue is probably secure_settings not being updated on the prod machine - it doesn't have WIFI_NETWORKS defined yet; I'll fix now

🤖 Generated with Claude Code

dbieber and others added 6 commits April 14, 2025 15:47
- Store WiFi configurations in Redis instead of directly editing wpa_supplicant.conf
- Add WiFi configuration UI in settings server to manage multiple networks
- Add WiFi migration command to import existing networks
- Manage a dedicated section in wpa_supplicant.conf marked with comments
- Update existing WiFi commands to use the new Redis-based storage

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove country code input from settings UI
- Remove country code from secure settings template

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Change 'wifi list' to 'wifi-list'
- Change 'wifi migrate' to 'wifi-migrate'
- Change 'wifi remove' to 'wifi-remove'
- Change 'wifi refresh' and 'wifi reconfigure' to 'wifi-refresh' and 'wifi-reconfigure'

This resolves potential command parameter collisions with the 'wifi {}' command.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Move WiFi functionality into dedicated module (gonotego.settings.wifi)
- Update system_commands.py to use the new WiFi module
- Update server.py to properly import and use the WiFi module
- Fix WiFi settings handling in server.py to use the proper modules

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Change from gonotego/settings/wifi/__init__.py to gonotego/settings/wifi.py
- Ensure file ends with newline character

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove directory structure in favor of single file approach
- Clean up git tracking of removed file

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
try:
# Special handling for CUSTOM_COMMAND_PATHS which is a list
# Special handling for CUSTOM_COMMAND_PATHS and WIFI_NETWORKS which are lists
if isinstance(value, list):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they're not actually treated differently; remove the if

dbieber and others added 4 commits April 14, 2025 16:18
- Remove the comment about WiFi functions being moved

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add migrate_networks_from_wpa_supplicant function to wifi.py
- Update system_commands.py to use the new function
- Simplify code in system_commands.py

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Create wifi_commands.py for all WiFi-related commands
- Remove WiFi commands from system_commands.py
- Update commands.py to import wifi_commands
- Update wifi.py to import system_commands directly
- Use shell = system_commands.shell for cleaner code

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused imports in system_commands.py
- Fix module imports in wifi_commands.py
- Clean up secure_settings_template.py formatting
- Simplify settings saving in server.py
- Improve empty value handling in server.py

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
@dbieber dbieber force-pushed the claude-20250414-154257 branch from bb48dbb to 2be32f9 Compare April 14, 2025 16:46
dbieber and others added 3 commits April 14, 2025 16:50
- Add special handling for WIFI_NETWORKS in the API response
- Get networks directly from the wifi module to ensure proper format
- Add debug logging to help diagnose issues

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update serverurl in supervisord.conf to use /tmp/supervisor.sock
- Simplify path for better compatibility across environments

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Sort imports alphabetically in wifi_commands.py
- Sort imports alphabetically in server.py
- Remove debug print statements

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
# Handle other values
else:
settings.set(key, value)
settings.set(key, value)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if settings.set with this value is correct - test in follow up PR

- Remove unused import of gonotego.common.interprocess
- Fix linting error F401

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
@dbieber dbieber merged commit 524ab09 into main Apr 14, 2025
2 checks passed
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.

2 participants