agentpass — Home Assistant Gateway
Execute Home Assistant actions through a secure approval gateway. Read-only queries execute instantly. State-changing actions (turning lights on/off, calling services) are sent to a human guardian on Telegram for approval before execution.
IMPORTANT: The agentpass request command is a BLOCKING command. For tools that need approval, it will wait up to 15 minutes for the guardian to respond on Telegram. You MUST use background: false when executing agentpass request commands to prevent auto-backgrounding. The command returns the actual execution result once approved, or an error if denied/timed out. Do NOT tell the user to "check Telegram" or "approve the request" — just wait silently for the command to finish and then report the result.
Commands
List available tools
CODEBLOCK0
Execute a tool
CODEBLOCK1
Output is JSON on stdout. Errors go to stderr.
Exit codes: 0 = success, 1 = denied, 2 = timeout, 3 = connection error, 4 = invalid args.
Available Tools
Read-only (auto-approved, instant)
Get a single entity state:
CODEBLOCK2
Get all entity states:
CODEBLOCK3
List available HA services and their fields:
CODEBLOCK4
Get state history for an entity (last 24h):
CODEBLOCK5
Get logbook entries for an entity (last 24h):
CODEBLOCK6
Get Home Assistant configuration:
CODEBLOCK7
Requires human approval (command blocks until resolved)
These commands block until approved or denied. Always use background: false to prevent auto-backgrounding.
Call a Home Assistant service:
CODEBLOCK8
The domain and service args are used for the URL path. All other args (entityid, brightness, colorname, temperature, etc.) are sent as the JSON request body.
Render a Home Assistant template:
CODEBLOCK9
Always denied (blocked by policy)
- -
ha_fire_event — firing custom events is blocked - INLINECODE7 with
domain=lock — lock control is blocked
Important Notes
- - entityid format: Always
domain.object_id, e.g. light.living_room, sensor.temperature, switch.garden_pump. Must be lowercase with underscores. - domain/service format: Lowercase with underscores, e.g.
light, turn_on, set_temperature. - Approval timeout: If the human guardian doesn't respond within 15 minutes, the request is automatically denied.
- Discover entities first: If you don't know an entity's ID, run
ha_get_states to list all entities, or ha_get_services to see available services and their parameters. - Service parameters: Use
ha_get_services to discover which parameters a service accepts (e.g. brightness, colorname, rgbcolor, temperature, hvacmode).
agentpass — Home Assistant 网关
通过安全审批网关执行 Home Assistant 操作。只读查询即时执行。状态变更操作(开关灯、调用服务)会发送至 Telegram 上的人类守护者进行审批,审批通过后方可执行。
重要提示:agentpass request 命令是一个阻塞命令。对于需要审批的工具,它将等待最多 15 分钟,等待守护者在 Telegram 上响应。执行 agentpass request 命令时,必须使用 background: false 以防止自动后台运行。该命令在审批通过后返回实际执行结果,若被拒绝或超时则返回错误。不要告诉用户查看 Telegram或批准请求——只需静待命令完成,然后报告结果。
命令
列出可用工具
bash
agentpass tools
执行工具
bash
agentpass request <工具名称> [键=值 ...]
输出为 JSON 格式至标准输出。错误信息输出至标准错误。
退出码:0 = 成功,1 = 拒绝,2 = 超时,3 = 连接错误,4 = 无效参数。
可用工具
只读(自动批准,即时执行)
获取单个实体状态:
bash
agentpass request hagetstate entityid=light.livingroom
获取所有实体状态:
bash
agentpass request hagetstates
列出可用的 HA 服务及其字段:
bash
agentpass request hagetservices
获取实体的状态历史记录(最近 24 小时):
bash
agentpass request hagethistory entity_id=sensor.temperature
获取实体的日志条目(最近 24 小时):
bash
agentpass request hagetlogbook entityid=light.livingroom
获取 Home Assistant 配置:
bash
agentpass request hagetconfig
需要人工审批(命令阻塞直至解决)
这些命令会阻塞直至被批准或拒绝。始终使用 background: false 以防止自动后台运行。
调用 Home Assistant 服务:
bash
使用 background: false 执行
agentpass request ha
callservice domain=light service=turn
on entityid=light.living_room
agentpass request ha
callservice domain=light service=turn
on entityid=light.bedroom brightness=128 color_name=red
agentpass request ha
callservice domain=switch service=toggle entity_id=switch.fan
agentpass request ha
callservice domain=climate service=set
temperature entityid=climate.thermostat temperature=21
domain 和 service 参数用于 URL 路径。所有其他参数(entityid、brightness、colorname、temperature 等)作为 JSON 请求体发送。
渲染 Home Assistant 模板:
bash
使用 background: false 执行
agentpass request ha
rendertemplate template={{ states(sensor.temperature) }} degrees
始终拒绝(被策略阻止)
- - hafireevent — 触发自定义事件被阻止
- domain=lock 的 hacallservice — 锁控制被阻止
重要说明
- - entityid 格式:始终为 domain.objectid,例如 light.livingroom、sensor.temperature、switch.gardenpump。必须使用小写字母和下划线。
- domain/service 格式:小写字母加下划线,例如 light、turnon、settemperature。
- 审批超时:如果人类守护者在 15 分钟内未响应,请求将自动被拒绝。
- 先发现实体:如果不知道实体的 ID,运行 hagetstates 列出所有实体,或运行 hagetservices 查看可用服务及其参数。
- 服务参数:使用 hagetservices 发现服务接受的参数(例如 brightness、colorname、rgbcolor、temperature、hvac_mode)。