Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Runs on your computer, talks to a Pi Pico W (or W 2) over USB, and your wakemypc

## Install

Create a virtual environment.
Create a virtual environment, if you want.
```bash
python -m venv .venv
```
Expand All @@ -18,7 +18,7 @@ source .venv/bin/activate #linux/MacOS
.\.venv\Scripts\Activate.ps1 #Powershell
```

Use pip:
Use pip to install:

```bash
pip install wakemypc
Expand Down Expand Up @@ -68,11 +68,8 @@ wakemypc upload --github
# 3) Configure WiFi + server.
wakemypc provision --add-new-wifi --wifi-ssid HomeWiFi --wifi-pass mypassword

# 4) Register on wakemypc.com.
wakemypc register --username username --password mypassword
# or
# Use Token based registeration When using Goggle SignIn (Future versions will support login through browsers)
wakemypc register --token <Token> # Check
# 4) Register on wakemypc.com using browser login
wakemypc register --oauth --name "My Pico"
```

## Auth Token registeration (Manual)
Expand Down
6 changes: 5 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
## v1.2.2 — Fix OAuth workflow API links
## v1.2.3 — Patch CLI

- Fix how CLI shows help texts for various options(Formatting)
- Add error for not passing `--name` in `register --oauth`, because API requires it.
- Bump `pyproject.toml` to 5 - Production/Stable State
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "wakemypc"
version = "1.2.2"
version = "1.2.3"
description = "Companion CLI for https://wakemypc.com (WakeMyPC) -- flash, provision, and manage Pico W transmitters from your terminal. WakeMyPC is a website that lets you turn on you PC remotely from anywhere in the world using Wake-on-Lan."
readme = "README.md"
license = { file = "LICENSE" }
Expand All @@ -10,7 +10,7 @@ authors = [
]
keywords = ["wake-on-lan", "wakemypc", "raspberry-pi-pico", "iot", "homelab"]
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"License :: Other/Proprietary License",
Expand Down
48 changes: 34 additions & 14 deletions src/wakemypc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,31 +520,45 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi,
Examples:

First-time setup (all fields required):

wakemypc provision --add-new-wifi --wifi-ssid MyNetwork --wifi-pass secret123

Update just the server URL (keep existing WiFi):

wakemypc provision --server-url https://new-server.com

Add a new WiFi network without removing existing ones:

Add a new WiFi network without removing existing ones:

wakemypc provision --add-new-wifi --wifi-ssid AnotherNetwork --wifi-pass anotherpass --order 1

wakemypc provision -a --wifi-ssid AnotherNetwork --wifi-pass anotherpass --order 1

(The --order flag is optional but can be used to control the priority of WiFi networks)

Clear all WiFi networks and set a new one:
Clear all WiFi networks and set a new one:

wakemypc provision --clear-wifi --wifi-ssid FreshNetwork --wifi-pass freshpass

wakemypc provision -c --wifi-ssid FreshNetwork --wifi-pass freshpass

Clear all WiFi networks without adding a new one:
Clear all WiFi networks without adding a new one:

wakemypc provision --clear-wifi

wakemypc provision -c

Remove a specific WiFi network:
Remove a specific WiFi network:

wakemypc provision --remove-wifi --wifi-ssid NetworkToRemove

wakemypc provision -r --wifi-ssid NetworkToRemove

Notes:

- You can run this command multiple times to update the configuration as needed.

- If you change the server URL, make sure to also update it on the server side if necessary.

- If you change WiFi credentials, the Pico will use the new ones on next boot.
"""
from .serial_detect import get_single_pico_port
Expand All @@ -553,8 +567,7 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi,

# If user runs without required args → show help instead of error
if not (
server_url
or (add_new_wifi and wifi_ssid and wifi_pass)
(add_new_wifi and wifi_ssid and wifi_pass)
or clear_wifi
or (remove_wifi and wifi_ssid)
):
Expand Down Expand Up @@ -668,7 +681,7 @@ def provision(server_url, wifi_ssid, wifi_pass, port, add_new_wifi, clear_wifi,
@click.option(
"--oauth",
is_flag=True,
default=False,
default=True,
help="Sign in via the website in your browser (supports username/password and 'Sign in with Google') instead of passing --username/--password, then proceed with the normal Pico registration (or rotation, with --rotate).",
)
@click.option(
Expand All @@ -691,20 +704,25 @@ def register(api_url, username, password, port, name, rotate, token, oauth, no_b

Modes, picked by flags:

Fresh registration via the browser (supports "Sign in with Google"):

wakemypc register --oauth

Fresh registration with username/password:
wakemypc register --api-url https://example.com --username admin --password pass

Fresh registration via the browser (supports "Sign in with Google"):
wakemypc register --api-url https://example.com --oauth
wakemypc register --username admin --password pass

Rotate an already-registered Pico's token (server invalidates the old one):
wakemypc register --api-url https://example.com --username admin --password pass --rotate
wakemypc register --api-url https://example.com --oauth --rotate

wakemypc register --username admin --password pass --rotate

wakemypc register --oauth --rotate

Push a token you already have (no server call -- e.g. you rotated via the dashboard):

wakemypc register --token <device_token>

With --oauth, the CLI opens https://example.com/dashboard/cli-auth in
With --oauth, the CLI opens https://wakemypc.com/dashboard/cli-auth in
your browser, captures the JWT access token returned to a local loopback
URL, and then drives the rest of the registration / rotation flow with
that token -- in one go. The device_token returned by the server is
Expand Down Expand Up @@ -746,6 +764,8 @@ def register(api_url, username, password, port, name, rotate, token, oauth, no_b
# CLI only needs to know which server to talk to.
if not api_url:
raise click.UsageError("--api-url is required with --oauth.")
if not name:
raise click.UsageError("--name is required. Choose a friendly name, and pass as --name 'My Pico'")
if username or password:
click.echo(
"Note: --oauth handles sign-in via the browser, so --username / "
Expand Down
Loading