From 4e18bace563c01a3bdd8afbb95fd8eb0c0ad6914 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Tue, 22 Apr 2025 10:37:18 -0700 Subject: [PATCH] New backup 2025-04-22 10:37:18 --- default/home/Scripts/ha | 45 ----------------------------------------- 1 file changed, 45 deletions(-) delete mode 100755 default/home/Scripts/ha diff --git a/default/home/Scripts/ha b/default/home/Scripts/ha deleted file mode 100755 index 1d82784..0000000 --- a/default/home/Scripts/ha +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -#https://developers.home-assistant.io/docs/api/rest/ - -source "${HOME}/.secrets" - -while getopts "a:e:d:s:" flag; do - case $flag in - a) - action="${OPTARG}" - ;; - e) - entity_id="${OPTARG}" - ;; - d) - domain="${OPTARG}" - ;; - s) - service="${OPTARG}" - ;; - *) - printf '%s' "bad option: ${flag}" - ;; - esac -done - -#echo "action: ${action}" -#echo "entity_id: ${entity_id}" - -case "${action}" in - "states") - curl -s \ - -H "Authorization: Bearer ${HA_TOKEN}" \ - -H "Content-Type: application/json" \ - "${HA_URL}/api/${action}/${entity_id}" | jq '.' - ;; - "services") -# echo '{"entity_id": "'"${entity_id}"'"}' - curl -s \ - -H "Authorization: Bearer ${HA_TOKEN}" \ - -H "Content-Type: application/json" \ - -d '{"entity_id": "'"${entity_id}"'"}' \ - "${HA_URL}/api/${action}/${domain}/${service}" | jq '.' - ;; -esac