robovac_connect_discovered
Connect to an Eufy RoboVac device by IP using its device ID and local key for remote control and management via the Eufy RoboVac MCP Server.
Instructions
Connect to a discovered RoboVac device by IP (requires device ID and local key)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | Yes | The device ID of your Eufy RoboVac | |
| ip | Yes | IP address of the discovered device | |
| localKey | Yes | The local key for your Eufy RoboVac |
Implementation Reference
- src/server.ts:395-437 (handler)Main execution logic for the robovac_connect_discovered tool: attempts connection with provided IP or falls back to auto-discovery via network scan, initializes RoboVac instance.case "robovac_connect_discovered": // Auto-discover best IP if not provided or if connection fails let targetIP = args?.ip as string; let discoveredSuccess = false; if (targetIP) { discoveredSuccess = await this.initializeRoboVac( args?.deviceId as string, args?.localKey as string, targetIP ); } if (!discoveredSuccess) { console.error( "[DEBUG] Initial connection failed or no IP provided, trying auto-discovery..." ); const discoveredIP = await this.discoverBestRoboVacIP(); if (discoveredIP) { targetIP = discoveredIP; discoveredSuccess = await this.initializeRoboVac( args?.deviceId as string, args?.localKey as string, targetIP ); } } return { content: [ { type: "text", text: discoveredSuccess ? `Successfully connected to RoboVac at ${targetIP}!` : `Failed to connect to device. ${ targetIP ? `Tried ${targetIP} but` : "" } Check your device ID and local key, and ensure the RoboVac is on the same network.`, }, ], isError: !discoveredSuccess, };
- src/server.ts:298-319 (schema)Input schema and tool metadata definition for robovac_connect_discovered, registered in the listTools handler.name: "robovac_connect_discovered", description: "Connect to a discovered RoboVac device by IP (requires device ID and local key)", inputSchema: { type: "object", properties: { ip: { type: "string", description: "IP address of the discovered device", }, deviceId: { type: "string", description: "The device ID of your Eufy RoboVac", }, localKey: { type: "string", description: "The local key for your Eufy RoboVac", }, }, required: ["ip", "deviceId", "localKey"], }, },
- src/server.ts:43-59 (helper)Core helper function called by the handler to create and connect the RoboVac instance using provided credentials and IP.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 function for auto-discovering the optimal RoboVac IP address on the local network, used as fallback in the 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; } }