Skip to main content
Glama
madorn
by madorn

set_fan_speed

Control ceiling fan speed levels from 0 (off) to 8 using the Bond Bridge smart home system. Adjust fan operation for comfort and energy efficiency.

Instructions

Set fan speed for a ceiling fan device.

Args: device_id: The Bond fan device identifier speed: Fan speed level (0-8, where 0 is off)

Returns: Result of the speed change operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYes
speedYes

Implementation Reference

  • The async handler function for the 'set_fan_speed' MCP tool. It performs input validation, interacts with the Bond client to set the fan speed, and handles errors appropriately.
    @mcp.tool()
    async def set_fan_speed(device_id: str, speed: int) -> Dict[str, Any]:
        """Set fan speed for a ceiling fan device.
        
        Args:
            device_id: The Bond fan device identifier
            speed: Fan speed level (0-8, where 0 is off)
            
        Returns:
            Result of the speed change operation.
        """
        if not (0 <= speed <= 8):
            return {"error": "Fan speed must be between 0 and 8"}
        
        try:
            async with await get_bond_client() as client:
                result = await client.set_speed(device_id, speed)
                return {
                    "device_id": device_id,
                    "speed": speed,
                    "action": "off" if speed == 0 else f"set to speed {speed}",
                    "result": result
                }
        except BondAPIError as e:
            return {"error": f"Failed to set fan speed: {str(e)}"}
        except Exception as e:
            logger.error(f"Unexpected error setting fan speed: {e}")
            return {"error": 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/madorn/bond-mcp-server'

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