v0.11.6
This commit is contained in:
Executable → Regular
+29
@@ -41,6 +41,11 @@ curl -fsS -X POST -H 'Content-Type: application/json' \
|
||||
"http://127.0.0.1:$PORT/api/devices/sim-salon/command" >"$TMP/command.json"
|
||||
grep -q '"power":true' "$TMP/command.json"
|
||||
|
||||
curl -fsS -X POST \
|
||||
"http://127.0.0.1:$PORT/api/devices/sim-salon/probe" >"$TMP/probe.json"
|
||||
grep -q '"ok":true' "$TMP/probe.json"
|
||||
grep -q '"response_time_ms":0' "$TMP/probe.json"
|
||||
|
||||
curl -fsS -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"name":"Test","device_id":"sim-salon","enabled":true,"mode":"cool","setpoint":23,"hysteresis":0.6,"min_on_seconds":0,"min_off_seconds":0,"sensor_source":"device"}' \
|
||||
"http://127.0.0.1:$PORT/api/zones" >"$TMP/zone.json"
|
||||
@@ -181,4 +186,28 @@ curl -fsS -X POST -H "Authorization: Bearer $HA_ACCESS_TOKEN" -H 'Content-Type:
|
||||
"http://127.0.0.1:$PORT/api/integrations/home-assistant/devices/sim-salon/command" >"$TMP/ha-command.json"
|
||||
grep -q '"power":false' "$TMP/ha-command.json"
|
||||
|
||||
# Disabled thermostat zones require an explicit direct-control override on the admin API,
|
||||
# while the restricted Home Assistant direct-device endpoint stays blocked.
|
||||
curl -fsS "http://127.0.0.1:$PORT/api/zones/$ZONE_ID" >"$TMP/zone-before-disable.json"
|
||||
python3 - "$TMP/zone-before-disable.json" "$TMP/zone-disable.json" <<'PYZONE'
|
||||
import json,sys
|
||||
zone=json.load(open(sys.argv[1]))
|
||||
zone["enabled"]=False
|
||||
json.dump(zone,open(sys.argv[2],"w"))
|
||||
PYZONE
|
||||
curl -fsS -X PUT -H 'Content-Type: application/json' --data-binary @"$TMP/zone-disable.json" \
|
||||
"http://127.0.0.1:$PORT/api/zones/$ZONE_ID" >"$TMP/zone-disabled.json"
|
||||
grep -q '"enabled":false' "$TMP/zone-disabled.json"
|
||||
BLOCKED_STATUS="$(curl -sS -o "$TMP/blocked-manual.json" -w '%{http_code}' -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"power":true}' "http://127.0.0.1:$PORT/api/devices/sim-salon/command")"
|
||||
[[ "$BLOCKED_STATUS" == "400" ]]
|
||||
grep -q 'manual_override=true' "$TMP/blocked-manual.json"
|
||||
curl -fsS -X POST -H 'Content-Type: application/json' \
|
||||
-d '{"power":true,"manual_override":true}' \
|
||||
"http://127.0.0.1:$PORT/api/devices/sim-salon/command" >"$TMP/override-manual.json"
|
||||
grep -q '"power":true' "$TMP/override-manual.json"
|
||||
HA_BLOCKED_STATUS="$(curl -sS -o "$TMP/ha-blocked-manual.json" -w '%{http_code}' -X POST -H "Authorization: Bearer $HA_ACCESS_TOKEN" -H 'Content-Type: application/json' \
|
||||
-d '{"power":false}' "http://127.0.0.1:$PORT/api/integrations/home-assistant/devices/sim-salon/command")"
|
||||
[[ "$HA_BLOCKED_STATUS" == "400" ]]
|
||||
|
||||
echo "Smoke test OK (port $PORT)"
|
||||
|
||||
Reference in New Issue
Block a user