Wiz智能灯泡MCP服务器
MCP服务器,用于通过UDP命令控制Wiz智能灯/灯泡。
特性
- 打开灯
- 关灯
- 设置暖白色
- 设置日光颜色
- 更改亮度
- 检查当前灯光状态
设置
- 安装依赖项:
pip install -r requirements.txt- 设置环境变量(可选):
export WIZ_BULB_IP="192.168.1.XX"
export WIZ_BULB_PORT="38899"您可以通过传递特定的灯泡来瞄准多个灯泡 bulb_ip 可选 bulb_port 任何工具。当没有提供目标时,服务器使用上述默认IP和端口。
用法
运行MCP服务器
python wiz_bulb_mcp.py可用工具
服务器提供以下MCP工具:
- turn_on_bulb(bulb_ip:str|None=无,bulb_port:int| None=无) -打开灯(可选择针对特定灯泡)
- turn_off_bulb(bulb_ip:str|None=无,bulb_port:int| None=无) -关闭灯(可选择针对特定灯泡)
- set_warm_white(调光:int=100,bulb_ip:str|无=无,bulb_port:int|无=没有) -设置暖白色(始终设置暖白色)
- set_dayllight(调光:int=100,bulb_ip:str|无=无,bulb_port:int|无=没有) -设置日光颜色(始终设置日光)
- adjust_brightness(brightness_percent:int,bulb_ip:str|无=无,bulb_port:int|无=没有) -在保持当前色彩场景的同时调整亮度
- get_bulb_status(bulb_ip:str|None=无,bulb_port:int| None=无) -检查当前灯光状态(开/关、亮度、颜色模式)
- get_bulb_info(bulb_ip:str|None=无,bulb_port:int| None=无) -获取灯光配置信息
示例命令
服务器将这些命令转换为UDP消息:
关掉:
{"id":1,"method":"setState","params":{"state":false}}暖白色:
{"id":1,"method":"setPilot","params":{"sceneId":11,"dimming":100}}日光:
{"id":1,"method":"setPilot","params":{"sceneId":12,"dimming":100}}获取状态:
{"method":"getPilot","params":{}}用户请求示例
服务器能够理解各种自然语言请求:
- “Turn on the Light”/“Schalte das licht ein”/“打开灯”
- “Turn off the light”/“Schalte das licht aus”/“关灯”
- “Make it warm white”/“Mach es warmweiß”
- “Set to daylight”(设置日光)
- “Make it brighter”/“Mach es Heller”/“Make it brighter”/“Make it brighter”/“Mach es Heller”/“Make it brighter”/“Make it brighter”/“Mach es Heller”/“Make it bright
- “Dim the Lights”“Dimm das Licht”
- “将亮度设置为50%”/“Stelle helligkeit auf 50%”/“将亮度设置为50%”
