wyze_turn_off_device
Control Wyze smart home devices by turning off a specified light using its MAC address. Integrates with the MCP Wyze Server for efficient smart home management.
Instructions
Turn off a Wyze light device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_mac | Yes |
Implementation Reference
- src/mcp_wyze_server/server.py:156-189 (handler)The handler function decorated with @mcp.tool() that implements the wyze_turn_off_device tool. It authenticates with Wyze API, lists devices, finds the target by MAC, verifies it's a light device, and calls the SDK's turn_off method.@mcp.tool() def wyze_turn_off_device(device_mac: str) -> Dict[str, str]: """Turn off a Wyze light device""" try: client = get_wyze_client() devices = client.devices_list() for device in devices: if device.mac == device_mac: # Get device type - try multiple approaches device_type = (getattr(device, 'product_type', None) or getattr(device, 'type', None) or (hasattr(device, 'product') and getattr(device.product, 'type', None)) or 'Unknown') device_model = (getattr(device, 'product_model', None) or getattr(device, 'model', None) or (hasattr(device, 'product') and getattr(device.product, 'model', None)) or 'Unknown') if device_type in ['Light', 'Bulb', 'MeshLight', 'LightStrip']: client.bulbs.turn_off(device_mac=device_mac, device_model=device_model) else: return {"status": "error", "message": f"Device type '{device_type}' is not a supported light device"} return {"status": "success", "message": f"Device {device.nickname} turned off"} 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)}"}