robovac_connect
Connect and configure your Eufy RoboVac using device credentials, including device ID and local key, for manual setup and control via the MCP server.
Instructions
Connect to your RoboVac using device credentials (manual setup)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | Yes | The device ID of your Eufy RoboVac | |
| ip | No | The IP address of your Eufy RoboVac (optional, defaults to 192.168.1.100) | |
| localKey | Yes | The local key for your Eufy RoboVac |
Implementation Reference
- src/server.ts:438-492 (handler)Handler for the robovac_connect tool. Connects to RoboVac using deviceId and localKey, with optional IP. Falls back to auto-discovery and default IP (192.168.1.100). Returns success/error message.case "robovac_connect": // Auto-discover best IP if not provided or if connection fails let connectTargetIP = args?.ip as string | undefined; let connectSuccess = false; if (connectTargetIP) { connectSuccess = await this.initializeRoboVac( args?.deviceId as string, args?.localKey as string, connectTargetIP ); } if (!connectSuccess) { console.error( "[DEBUG] Manual connection failed or no IP provided, trying auto-discovery..." ); const discoveredIP = await this.discoverBestRoboVacIP(); if (discoveredIP) { connectTargetIP = discoveredIP; connectSuccess = await this.initializeRoboVac( args?.deviceId as string, args?.localKey as string, connectTargetIP ); } } // Fallback to default IP if still not successful if (!connectSuccess && !connectTargetIP) { connectTargetIP = "192.168.1.100"; connectSuccess = await this.initializeRoboVac( args?.deviceId as string, args?.localKey as string, connectTargetIP ); } return { content: [ { type: "text", text: connectSuccess ? `RoboVac connected successfully at ${connectTargetIP}!` : `Failed to connect to RoboVac. ${ connectTargetIP ? `Tried ${connectTargetIP} but connection failed.` : "" } Check your device ID, local key, and network connection.`, }, ], isError: !connectSuccess, };
- src/server.ts:320-343 (registration)Registration of the robovac_connect tool in the ListTools response, including name, description, and input schema.{ name: "robovac_connect", description: "Connect to your RoboVac using device credentials (manual setup)", inputSchema: { type: "object", properties: { deviceId: { type: "string", description: "The device ID of your Eufy RoboVac", }, localKey: { type: "string", description: "The local key for your Eufy RoboVac", }, ip: { type: "string", description: "The IP address of your Eufy RoboVac (optional, defaults to 192.168.1.100)", }, }, required: ["deviceId", "localKey"], }, },
- src/server.ts:324-342 (schema)Input schema definition for robovac_connect tool.inputSchema: { type: "object", properties: { deviceId: { type: "string", description: "The device ID of your Eufy RoboVac", }, localKey: { type: "string", description: "The local key for your Eufy RoboVac", }, ip: { type: "string", description: "The IP address of your Eufy RoboVac (optional, defaults to 192.168.1.100)", }, }, required: ["deviceId", "localKey"], },
- src/server.ts:43-60 (helper)Helper method to create and connect the RoboVac instance, called by the robovac_connect handler.private async initializeRoboVac( deviceId: string, localKey: string, ip?: string ): Promise<boolean> { try { this.robovac = new RoboVac({ deviceId: deviceId, localKey: localKey, ip: ip || "192.168.1.100", }); await this.robovac.connect(); return true; } catch (error) { console.error("Failed to initialize RoboVac:", error); return false; } }
- src/server.ts:70-112 (helper)Helper method for auto-discovering the best RoboVac IP address via network scanning, used as fallback in the connect handler.private async discoverBestRoboVacIP(): Promise<string | null> { try { console.error("[DEBUG] Auto-discovering RoboVac devices..."); const devices = await this.networkDiscovery.discoverDevices(); if (devices.length === 0) { console.error("[DEBUG] No devices found during auto-discovery"); return null; } // Filter for likely RoboVac devices const likelyRoboVacs = devices.filter((device) => device.isLikelyRoboVac); if (likelyRoboVacs.length > 0) { const bestDevice = likelyRoboVacs[0]; // Take the first likely device console.error( `[DEBUG] Found likely RoboVac at ${bestDevice.ip} (MAC: ${bestDevice.mac}, Vendor: ${bestDevice.vendor})` ); return bestDevice.ip; } // If no likely RoboVacs, try devices with port 6668 open const devicesWithPort6668 = devices.filter((device) => device.ports.includes(6668) ); if (devicesWithPort6668.length > 0) { const potentialDevice = devicesWithPort6668[0]; console.error( `[DEBUG] Found potential RoboVac at ${potentialDevice.ip} with port 6668 open` ); return potentialDevice.ip; } console.error("[DEBUG] No suitable RoboVac candidates found"); return null; } catch (error) { console.error( `[DEBUG] Auto-discovery failed: ${(error as Error).message}` ); return null; } }