feat: Added stuff
Some checks failed
build / checks-matrix (push) Failing after 19m1s
build / checks-build (push) Has been skipped
build / codecov (push) Failing after 19m2s
docs / docs (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-08-16 20:35:09 +05:30
parent 0e3079a6f8
commit 8252d6c8b6
8 changed files with 653 additions and 13 deletions

View File

@@ -175,10 +175,12 @@ check_hyprmonitors_server() {
else
print_warning "Hyprmonitors server not reachable at $host:$port"
print_info "Make sure the Rust server is running: cargo run"
print_info "For Docker users, run: python3 test_connectivity.py to diagnose issues"
return 1
fi
else
print_warning "curl not available, cannot test server connection"
print_info "Use: python3 test_connectivity.py to test connectivity"
return 1
fi
}
@@ -192,17 +194,23 @@ show_next_steps() {
echo " - If using Docker: docker restart homeassistant"
echo " - If using HAOS: Settings → System → Restart"
echo
echo "2. Add the integration:"
echo "2. Test connectivity (especially for Docker users):"
echo " - cd $(dirname "$SOURCE_DIR")/homeassistant"
echo " - python3 test_connectivity.py"
echo " - For Docker: python3 test_connectivity.py host.docker.internal 3000"
echo
echo "3. Add the integration:"
echo " - Go to Settings → Devices & Services"
echo " - Click 'Add Integration'"
echo " - Search for 'Hyprland Monitor Control'"
echo " - Configure with your server details"
echo " - Docker users: Use 'host.docker.internal' instead of 'localhost'"
echo
echo "3. Make sure your Hyprmonitors server is running:"
echo "4. Make sure your Hyprmonitors server is running:"
echo " - cd $(dirname "$SOURCE_DIR")"
echo " - cargo run"
echo
echo "4. Optional: Check the examples.yaml file for automation ideas"
echo "5. Optional: Check the examples.yaml file for automation ideas"
echo
print_success "Enjoy controlling your monitors from Home Assistant! 🖥️"
}
@@ -215,11 +223,13 @@ usage() {
echo " -h, --help Show this help message"
echo " --check-server HOST:PORT Check if Hyprmonitors server is running"
echo " --dry-run Show what would be done without making changes"
echo " --test-connectivity Run connectivity test with detailed diagnostics"
echo
echo "Examples:"
echo " $0 # Auto-detect HA config directory"
echo " $0 -c /config # Specify config directory"
echo " $0 --check-server localhost:3000 # Test server connection"
echo " $0 --test-connectivity # Run full connectivity test"
echo " $0 --dry-run # Preview installation"
}
@@ -227,6 +237,7 @@ main() {
local ha_config=""
local check_server=""
local dry_run=false
local test_connectivity=false
# Parse arguments
while [[ $# -gt 0 ]]; do
@@ -243,6 +254,10 @@ main() {
check_server="$2"
shift 2
;;
--test-connectivity)
test_connectivity=true
shift
;;
--dry-run)
dry_run=true
shift
@@ -264,6 +279,24 @@ main() {
exit $?
fi
# Handle connectivity test
if [[ "$test_connectivity" == true ]]; then
local test_script="$SOURCE_DIR/test_connectivity.py"
if [[ -f "$test_script" ]]; then
print_info "Running connectivity test..."
if command -v python3 &> /dev/null; then
python3 "$test_script"
exit $?
else
print_error "Python3 not found, cannot run connectivity test"
exit 1
fi
else
print_error "Connectivity test script not found: $test_script"
exit 1
fi
fi
# Detect Home Assistant config directory
if [[ -z "$ha_config" ]]; then
ha_config=$(detect_ha_config)