send_custom_action
Control Bond smart home devices by sending custom commands like TurnOn, TurnOff, or SetSpeed to manage fans, shades, lights, and other RF-controlled devices.
Instructions
Send a custom action to a Bond device.
Args: device_id: The Bond device identifier action: Bond action name (e.g., "TurnOn", "TurnOff", "SetSpeed") argument: Optional argument for the action
Returns: Result of the custom action.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes | ||
| action | Yes | ||
| argument | No |
Implementation Reference
- src/bond_mcp/server.py:295-320 (handler)The handler function for the 'send_custom_action' tool, decorated with @mcp.tool() which also serves as registration. It sends a custom action to the specified Bond device using the BondClient, handling errors and returning the result.@mcp.tool() async def send_custom_action(device_id: str, action: str, argument: Optional[int] = None) -> Dict[str, Any]: """Send a custom action to a Bond device. Args: device_id: The Bond device identifier action: Bond action name (e.g., "TurnOn", "TurnOff", "SetSpeed") argument: Optional argument for the action Returns: Result of the custom action. """ try: async with await get_bond_client() as client: result = await client.send_action(device_id, action, argument) return { "device_id": device_id, "action": action, "argument": argument, "result": result } except BondAPIError as e: return {"error": f"Failed to send custom action: {str(e)}"} except Exception as e: logger.error(f"Unexpected error sending custom action: {e}") return {"error": f"Unexpected error: {str(e)}"}