set_security_status
Set the security panel to disarm (0), arm home (1), or arm away (2) using your security code.
Instructions
Set the security panel status. secstatus: 0=Disarm, 1=Arm Home, 2=Arm Away.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| secstatus | Yes | ||
| seccode | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:1055-1060 (handler)The `set_security_status` tool handler function. It is a `@mcp.tool()` decorated async function that accepts `secstatus` (int: 0=Disarm, 1=Arm Home, 2=Arm Away) and `seccode` (str) parameters. It calls the Domoticz API endpoint `setsecstatus` with the provided security status and code, and returns the response.
@mcp.tool() async def set_security_status(secstatus: int, seccode: str) -> str: """Set the security panel status. secstatus: 0=Disarm, 1=Arm Home, 2=Arm Away.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=setsecstatus&secstatus={secstatus}&seccode={urllib.parse.quote(seccode)}") return response.text - src/domoticz_mcp/server.py:1055-1055 (registration)The tool is registered via the `@mcp.tool()` decorator on line 1055, which is the standard FastMCP tool registration mechanism. The function name `set_security_status` becomes the tool name exposed to the MCP client.
@mcp.tool() - src/domoticz_mcp/server.py:1056-1058 (schema)The input schema is defined in the function signature: `secstatus: int` (0=Disarm, 1=Arm Home, 2=Arm Away) and `seccode: str` (the security code). The docstring describes the valid secstatus values.
async def set_security_status(secstatus: int, seccode: str) -> str: """Set the security panel status. secstatus: 0=Disarm, 1=Arm Home, 2=Arm Away.""" async with create_client() as client: - src/domoticz_mcp/server.py:1161-1166 (helper)The `get_security_resource` resource handler (domoticz://security) is a related helper that reads the current security status via the `getsecstatus` API endpoint.
@mcp.resource("domoticz://security") async def get_security_resource() -> str: """Read the current status of the security panel.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getsecstatus") return response.text - src/domoticz_mcp/server.py:1048-1053 (helper)The `get_security_status` tool is a companion read-only tool that retrieves the current security panel status by calling `getsecstatus`.
@mcp.tool() async def get_security_status() -> str: """Get the current status of the security panel.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getsecstatus") return response.text