Skip to main content
Glama
aldilaff
by aldilaff

wyze_get_device_status

Retrieve current status information for Wyze smart home devices, including power state and brightness levels, to monitor device conditions.

Instructions

Get accurate current status for a Wyze device (power state, brightness, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_macYes

Implementation Reference

  • The handler function for the 'wyze_get_device_status' tool, decorated with @mcp.tool() for automatic registration. It retrieves the current status of a Wyze device by MAC address, providing detailed information like power state, brightness, color temperature, and color for light devices, or online status for others.
    @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)}"}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aldilaff/mcp-wyze-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server