main
Eric Loyd 1 month ago
parent 40311e075b
commit c368e04c18

@ -91,22 +91,22 @@ do_start() {
do_poweroff() {
do_getKey
case "$myDevice" in
quad*|all) do_api "/Driver/PPBAdvance/Power/Hub/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Quad Power..." | jq '.status';;&
var*|all) do_api "/Driver/PPBAdvance/Power/Variable/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Variable Power..." | jq '.status';;&
dew1|all) do_api "/Driver/PPBAdvance/Dew/1/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Dew Heater 1..." | jq '.status';;&
dew2|all) do_api "/Driver/PPBAdvance/Dew/2/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Dew Heater 2..." | jq '.status';;&
autodew|all) do_api "/Driver/PPBAdvance/Dew/Auto/Off?DriverUniqueKey=${PPBAkey}" POST "Turning Off Auto Dew..." | jq '.status';;
Quad|quad*|All|all) do_api "/Driver/PPBAdvance/Power/Hub/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Quad Power..." | jq '.status';;&
Var|var*|All|all) do_api "/Driver/PPBAdvance/Power/Variable/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Variable Power..." | jq '.status';;&
Dew1|dew1|All|all) do_api "/Driver/PPBAdvance/Dew/1/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Dew Heater 1..." | jq '.status';;&
Dew2|dew2|All|all) do_api "/Driver/PPBAdvance/Dew/2/Off?DriverUniqueKey=${PPBAkey}" PUT "Turning Off Dew Heater 2..." | jq '.status';;&
Auto*|auto*|All|all) do_api "/Driver/PPBAdvance/Dew/Auto/Off?DriverUniqueKey=${PPBAkey}" POST "Turning Off Auto Dew..." | jq '.status';;
esac
}
do_poweron() {
do_getKey
case "$myDevice" in
quad*|all) do_api "/Driver/PPBAdvance/Power/Hub/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Quad Power..." | jq '.status';;&
var*|all) do_api "/Driver/PPBAdvance/Power/Variable/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Variable Power..." | jq '.status';;&
dew1|all) do_api "/Driver/PPBAdvance/Dew/1/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Dew Heater 1..." | jq '.status';;&
dew2|all) do_api "/Driver/PPBAdvance/Dew/2/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Dew Heater 2..." | jq '.status';;&
autodew|all) do_api "/Driver/PPBAdvance/Dew/Auto/On?DriverUniqueKey=${PPBAkey}" POST "Turning on Auto Dew..." | jq '.status';;
Quad|quad*|All|all) do_api "/Driver/PPBAdvance/Power/Hub/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Quad Power..." | jq '.status';;&
Var*|var*|All|all) do_api "/Driver/PPBAdvance/Power/Variable/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Variable Power..." | jq '.status';;&
Dew1|dew1|All|all) do_api "/Driver/PPBAdvance/Dew/1/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Dew Heater 1..." | jq '.status';;&
Dew2|dew2|All|all) do_api "/Driver/PPBAdvance/Dew/2/On?DriverUniqueKey=${PPBAkey}" PUT "Turning on Dew Heater 2..." | jq '.status';;&
Auto*|auto|All|all) do_api "/Driver/PPBAdvance/Dew/Auto/On?DriverUniqueKey=${PPBAkey}" POST "Turning on Auto Dew..." | jq '.status';;
esac
}

@ -17,14 +17,22 @@ if [[ -z "$API_KEY" ]]; then
fi
get_info() {
local entry="router/api/v1/user/devices"
json=$(curl -s -k ${API_BASE}/${entry} \
local reqid
reqid="$(uuid)"
# local entry="router/api/v1/user/devices"
# json=$(curl -s -k ${API_BASE}/${entry} \
# -H "Content-Type: application/json" \
# -H "Govee-API-Key: ${API_KEY}")
# sku=$(echo "$json" | jq -r ".data[].sku")
# device=$(echo "$json" | jq -r ".data[].device")
echo curl -s -k -X POST "${API_BASE}/router/api/v1/device/state" \
-H "Content-Type: application/json" \
-H "Govee-API-Key: ${API_KEY}")
sku=$(echo "$json" | jq -r ".data[].sku")
device=$(echo "$json" | jq -r ".data[].device")
echo "SKU=$sku"
echo "device=$device"
-H "Govee-API-Key: ${API_KEY}" \
-d "{ \"requestId\": \"${uuid}\", \"payload\": { \"sku\": \"${mySKU}\", \"device\": \"${myID}\" } }"
# echo "SKU=$sku"
# echo "device=$device"
# echo "json:"
echo "$json"
}
# helpers

Loading…
Cancel
Save