30 lines
589 B
Bash
Executable File
30 lines
589 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${1:-http://192.168.4.1}"
|
|
|
|
echo "Testing ESP32 at: $BASE_URL"
|
|
echo
|
|
|
|
echo "1. Status:"
|
|
curl -s "$BASE_URL/status" | python3 -m json.tool
|
|
|
|
echo
|
|
echo "2. Relay 1 ON:"
|
|
curl -s "$BASE_URL/relay/relay_1/on" | python3 -m json.tool
|
|
|
|
echo
|
|
echo "3. Relay 1 OFF:"
|
|
curl -s "$BASE_URL/relay/relay_1/off" | python3 -m json.tool
|
|
|
|
echo
|
|
echo "4. Relay 2 ON:"
|
|
curl -s "$BASE_URL/relay/relay_2/on" | python3 -m json.tool
|
|
|
|
echo
|
|
echo "5. Relay 2 OFF:"
|
|
curl -s "$BASE_URL/relay/relay_2/off" | python3 -m json.tool
|
|
|
|
echo
|
|
echo "ESP32 HTTP bring-up test complete."
|