wyze_device_info
Retrieve detailed information about a Wyze smart home device using its MAC address. Identify device-specific data for monitoring and management within the MCP Wyze Server.
Instructions
Get detailed information about a specific Wyze device by MAC address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_mac | Yes |
Implementation Reference
- src/mcp_wyze_server/server.py:91-117 (handler)The handler function for the 'wyze_device_info' tool. It fetches the list of devices using the Wyze client, finds the device by MAC address, extracts relevant info, and returns it structured in a dictionary. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() def wyze_device_info(device_mac: str) -> Dict[str, Any]: """Get detailed information about a specific Wyze device by MAC address""" try: client = get_wyze_client() devices = client.devices_list() for device in devices: if device.mac == device_mac: device_info = { "mac": str(device.mac) if device.mac else "Unknown", "nickname": str(device.nickname) if device.nickname else "Unknown", "product_model": str(getattr(device, 'product_model', 'Unknown')) if getattr(device, 'product_model', 'Unknown') else "Unknown", "product_type": str(getattr(device, 'product_type', 'Unknown')) if getattr(device, 'product_type', 'Unknown') else "Unknown", "is_online": bool(getattr(device, 'is_online', True)), "firmware_ver": str(getattr(device, 'firmware_ver', 'N/A')), "device_model": str(getattr(device, 'device_model', 'Unknown')), } return {"status": "success", "device": device_info} return {"status": "error", "message": f"Device with MAC {device_mac} not found"} except WyzeClientConfigurationError as e: return {"status": "error", "message": f"Configuration error: {str(e)}"} except WyzeRequestError as e: return {"status": "error", "message": f"API error: {str(e)}"} except Exception as e: return {"status": "error", "message": f"Unexpected error: {str(e)}"}
- src/mcp_wyze_server/server.py:21-44 (helper)Helper function to get or initialize the Wyze SDK client using environment variables, used by the wyze_device_info handler.def get_wyze_client() -> Client: """Get or create Wyze client instance with auto-login if credentials available""" global _wyze_client if _wyze_client is None: # Get credentials from environment email = os.getenv("WYZE_EMAIL") password = os.getenv("WYZE_PASSWORD") key_id = os.getenv("WYZE_KEY_ID") api_key = os.getenv("WYZE_API_KEY") if not all([email, password, key_id, api_key]): raise WyzeClientConfigurationError( "Missing required environment variables: WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY" ) _wyze_client = Client( email=email, password=password, key_id=key_id, api_key=api_key ) return _wyze_client