#!/bin/sh
#
set -a; . "${HOME}/.config/secrets/hass"; set +a
# curl -s -X GET \
#   -H "Authorization: Bearer ${token}" \
#   -H "Content-Type: application/json" \
#   https://hass.dafu.dev/api/states
#

curl -s -X POST \
  -H "Authorization: Bearer ${token}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id":"switch.'${1}'"}' \
  https://hass.dafu.dev/api/services/switch/toggle || notify-send "${1} failed"
