v0.10.0
This commit is contained in:
@@ -8,5 +8,5 @@ bb7cd2c5b27c9dceec1d1d2846fbad9600df9c08e0ad07d13fcde97af533091c ./install.sh
|
||||
e00d211e3885e30d7fed1e43b44e6fdad40a67019060156c0641816a93e3365f ./network-debug.sh
|
||||
01952aa92b217f8eae2493b88870e2dec595100cd15c4d561ff11ae2b936c46f ./regenerate-sha.sh
|
||||
81345b6a0b51736bdbc98fd23199b62e4c721b4e7437e02dab7ea79b97dff29a ./service.sh
|
||||
8ccca8ed49576cf0b8e3453436ac3ff9c2a222cd41b27db98ceb62bd5f87aeef ./smoke.sh
|
||||
fec8b0362e763bbc115b5cc5c56f9ebe815730cee161632d81c5dc0ee1475f80 ./smoke.sh
|
||||
b50782b3742dfbf8a319c60571c968e93fdf8547db747c759edcffae68cb98bf ./update.sh
|
||||
|
||||
@@ -83,6 +83,49 @@ grep -q '"revision":2' "$TMP/flow-updated.json"
|
||||
STALE_STATUS="$(curl -sS -o /dev/null -w '%{http_code}' -X PUT -H 'Content-Type: application/json' --data-binary @"$TMP/flow-update.json" "http://127.0.0.1:$PORT/api/flows/$FLOW_ID")"
|
||||
[[ "$STALE_STATUS" == "409" ]]
|
||||
|
||||
# Shared Flow inputs are source-only; comparisons belong exclusively to Flow references.
|
||||
curl -fsS "http://127.0.0.1:$PORT/api/settings" >"$TMP/settings-shared-input.json"
|
||||
python3 - "$TMP/settings-shared-input.json" "$TMP/settings-shared-input-put.json" <<'PYFLOW'
|
||||
import json,sys
|
||||
settings=json.load(open(sys.argv[1]))
|
||||
items=settings.setdefault("home_assistant",{}).setdefault("flow_inputs",[])
|
||||
items=[item for item in items if item.get("id") != "smoke-shared-outdoor"]
|
||||
items.append({"id":"smoke-shared-outdoor","name":"Smoke outdoor value","kind":"outdoor_temperature","config":{}})
|
||||
settings["home_assistant"]["flow_inputs"]=items
|
||||
json.dump(settings,open(sys.argv[2],"w"))
|
||||
PYFLOW
|
||||
curl -fsS -X PUT -H 'Content-Type: application/json' --data-binary @"$TMP/settings-shared-input-put.json" \
|
||||
"http://127.0.0.1:$PORT/api/settings" >"$TMP/settings-shared-input-result.json"
|
||||
python3 - "$TMP/settings-shared-input-result.json" <<'PYFLOW'
|
||||
import json,sys
|
||||
settings=json.load(open(sys.argv[1]))
|
||||
item=next(item for item in settings["home_assistant"]["flow_inputs"] if item["id"] == "smoke-shared-outdoor")
|
||||
assert item["config"] == {}, item
|
||||
PYFLOW
|
||||
python3 - "$TMP/settings-shared-input-put.json" "$TMP/settings-shared-input-invalid.json" <<'PYFLOW'
|
||||
import json,sys
|
||||
settings=json.load(open(sys.argv[1]))
|
||||
item=next(item for item in settings["home_assistant"]["flow_inputs"] if item["id"] == "smoke-shared-outdoor")
|
||||
item["config"]={"operator":"lt","value":20}
|
||||
json.dump(settings,open(sys.argv[2],"w"))
|
||||
PYFLOW
|
||||
INVALID_SHARED_STATUS="$(curl -sS -o /dev/null -w '%{http_code}' -X PUT -H 'Content-Type: application/json' --data-binary @"$TMP/settings-shared-input-invalid.json" "http://127.0.0.1:$PORT/api/settings")"
|
||||
[[ "$INVALID_SHARED_STATUS" == "400" ]]
|
||||
cat >"$TMP/flow-shared-value.json" <<EOF
|
||||
{"flow":{"name":"Shared value comparisons","enabled":true,"nodes":[{"id":"low","kind":"shared_input","x":20,"y":20,"config":{"input_id":"smoke-shared-outdoor","operator":"lt","value":20}},{"id":"high","kind":"shared_input","x":20,"y":140,"config":{"input_id":"smoke-shared-outdoor","operator":"gt","value":30}},{"id":"either","kind":"logic_or","x":220,"y":80,"config":{}},{"id":"action","kind":"zone_thermostat","x":420,"y":80,"config":{"zone_id":"$ZONE_ID","preset":"comfort","mode":"auto","cooldown_seconds":60}}],"edges":[{"id":"e1","from":"low","to":"either"},{"id":"e2","from":"high","to":"either"},{"id":"e3","from":"either","to":"action"}]},"overrides":{"low":15,"high":15},"log":false}
|
||||
EOF
|
||||
curl -fsS -X POST -H 'Content-Type: application/json' --data-binary @"$TMP/flow-shared-value.json" \
|
||||
"http://127.0.0.1:$PORT/api/flows/simulate" >"$TMP/flow-shared-value-result.json"
|
||||
python3 - "$TMP/flow-shared-value-result.json" <<'PYFLOW'
|
||||
import json,sys
|
||||
result=json.load(open(sys.argv[1]))
|
||||
action=result["actions"][0]
|
||||
assert action["matched"] is True, result
|
||||
trace={item["node_id"]:item for item in action["trace"]}
|
||||
assert trace["low"]["matched"] is True and trace["low"]["expected"] == 20, trace
|
||||
assert trace["high"]["matched"] is False and trace["high"]["expected"] == 30, trace
|
||||
PYFLOW
|
||||
|
||||
# A schedule-compatible Flow must keep using the native schedule engine.
|
||||
cat >"$TMP/flow-schedule.json" <<EOF
|
||||
{"name":"Native schedule Flow","enabled":true,"nodes":[{"id":"days","kind":"weekday","x":20,"y":20,"config":{"days":[1,2,3,4,5,6,7]}},{"id":"time","kind":"time_range","x":180,"y":20,"config":{"start":"06:00","end":"08:00"}},{"id":"action","kind":"zone_thermostat","x":360,"y":20,"config":{"zone_id":"$ZONE_ID","preset":"comfort","mode":"auto","cooldown_seconds":60}}],"edges":[{"id":"e1","from":"days","to":"time"},{"id":"e2","from":"time","to":"action"}]}
|
||||
|
||||
Reference in New Issue
Block a user