set_fan_direction
Control ceiling fan airflow direction to optimize cooling or heating efficiency. Change fan rotation between forward and reverse modes for seasonal comfort.
Instructions
Set fan direction for a ceiling fan device.
Args: device_id: The Bond fan device identifier direction: Fan direction ("forward" or "reverse")
Returns: Result of the direction change operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes | ||
| direction | Yes |
Implementation Reference
- src/bond_mcp/server.py:186-215 (handler)The @mcp.tool() decorator registers this async function as the MCP tool handler for 'set_fan_direction'. It validates the direction input, maps it to 1 or -1, calls BondClient.set_direction, and returns the result or error.@mcp.tool() async def set_fan_direction(device_id: str, direction: str) -> Dict[str, Any]: """Set fan direction for a ceiling fan device. Args: device_id: The Bond fan device identifier direction: Fan direction ("forward" or "reverse") Returns: Result of the direction change operation. """ direction_map = {"forward": 1, "reverse": -1} if direction.lower() not in direction_map: return {"error": "Direction must be 'forward' or 'reverse'"} try: async with await get_bond_client() as client: dir_value = direction_map[direction.lower()] result = await client.set_direction(device_id, dir_value) return { "device_id": device_id, "direction": direction.lower(), "result": result } except BondAPIError as e: return {"error": f"Failed to set fan direction: {str(e)}"} except Exception as e: logger.error(f"Unexpected error setting fan direction: {e}") return {"error": f"Unexpected error: {str(e)}"}