power_off_hdd.sh 346 B

123456789101112
  1. #!/bin/bash
  2. # Load environment variables from .env file
  3. source .env
  4. # Turn off the external HDD
  5. response=$(curl -s -X POST "$HA_URL/api/services/switch/turn_off" \
  6. -H "Authorization: Bearer $HA_TOKEN" \
  7. -H "Content-Type: application/json" \
  8. -d "{\"entity_id\": \"$HDD_SWITCH_ENTITY\"}")
  9. echo "Powering off external HDD: $response"