wyze_get_device_status
Retrieve the current status of a Wyze smart device, including power state and brightness, by providing its MAC address for real-time monitoring.
Instructions
Get accurate current status for a Wyze device (power state, brightness, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_mac | Yes |
Implementation Reference
- src/mcp_wyze_server/server.py:355-407 (handler)The primary handler function decorated with @mcp.tool(), which defines, registers, and provides schema for the wyze_get_device_status tool. It fetches device status using the Wyze SDK, handling lights with detailed info (on/off, brightness, color) and others with basic status.@mcp.tool() def wyze_get_device_status(device_mac: str) -> Dict[str, Any]: """Get accurate current status for a Wyze device (power state, brightness, etc.)""" try: client = get_wyze_client() devices = client.devices_list() # Find the device first target_device = None for device in devices: if device.mac == device_mac: target_device = device break if not target_device: return {"status": "error", "message": f"Device with MAC {device_mac} not found"} device_type = getattr(target_device, 'product_type', 'Unknown') device_status = { "mac": device_mac, "nickname": target_device.nickname, "product_type": device_type, "product_model": getattr(target_device, 'product_model', 'Unknown'), } # Get detailed status based on device type if device_type in ['Light', 'Bulb', 'MeshLight', 'LightStrip']: try: detailed_device = client.bulbs.info(device_mac=device_mac) if detailed_device: device_status.update({ "is_on": getattr(detailed_device, 'is_on', None), "brightness": getattr(detailed_device, 'brightness', None), "color_temp": getattr(detailed_device, 'color_temp', None), "color": getattr(detailed_device, 'color', None), }) else: device_status["error"] = "Could not retrieve detailed bulb information" except Exception as e: device_status["error"] = f"Error getting bulb status: {str(e)}" else: # For other device types, show basic online status device_status["is_online"] = getattr(target_device, 'is_online', None) return {"status": "success", "device_status": device_status} 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)}"}