Add hand-raised patrol routes with greeting stops and round counts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -281,6 +281,9 @@ def go(body: GoBody):
|
||||
class RouteBody(BaseModel):
|
||||
markers: list[str] = Field(examples=[["p1", "p3", "home"]], min_length=1)
|
||||
pause: float = Field(1.0, ge=0, le=60, description="seconds to wait at each marker")
|
||||
loop: bool = Field(False, description="there and back again (a, b, c, b, a, ...); needs the assistant "
|
||||
"(Greeter / Patrol on)")
|
||||
rounds: int = Field(0, ge=0, le=99, description="with loop: this many times there and back, 0 = until stopped")
|
||||
|
||||
|
||||
class RouteRunner:
|
||||
@@ -333,8 +336,10 @@ def go_route(body: RouteBody):
|
||||
if unknown:
|
||||
raise HTTPException(400, f"unknown markers {unknown}; markers: {names}")
|
||||
if assistant_pids():
|
||||
send_to_assistant("route", markers=body.markers, pause=body.pause)
|
||||
send_to_assistant("route", markers=body.markers, pause=body.pause, loop=body.loop, rounds=body.rounds)
|
||||
return {"ok": True, "route": body.markers, "by": "assistant"}
|
||||
if body.loop:
|
||||
raise HTTPException(409, SWITCHES_OFF)
|
||||
held_to_look()
|
||||
_route.start(body.markers, body.pause)
|
||||
return {"ok": True, "route": body.markers, "by": "api"}
|
||||
|
||||
Reference in New Issue
Block a user