本帖最后由 lidicn 于 2017-11-18 20:28 编辑
小米万能遥控器【创米万能遥控】代码来源:https://github.com/SchumyHao/cus ... itch/chuangmi_ir.py
适用于格力空调,遥控器型号YB0F2
空调控制部分代码参考了菲神的代码【仰望着天空,抄袭了一遍代码】
依赖需求:
1、需要python-miio
2、要学红外码的要装妖神的,chuangmi_ir.py3、有另一个以python-mirobo为核心的版本的chuangmi_ir.py https://github.com/syssi/chuangmi_ir【用法跟妖神的一模一样】
climate:
- platform: gree
name: GREE
host: 192.168.2.205
token: 你的token
target_temp: 27
target_sensor: sensor.caiyun_realtime_temperature
target_sensor:这里填你的室内温度传感器的entity_id
使用方法:
下载解压,复制到相应文件夹
楼主的格力空调遥控器型号是YB0F2,如果你的也是。可以直接用。否则,需要自行学红外码复制进去。因楼主的空调没有制热功能,因此没有学制热的红外码。红外码在gree.py 第314行 到328行
def _sendpacket(self,retry=2):
"""Send packet to device."""
cool = ("Z6WLAAkCAACnAgAASwYAAGARAAAqIwAA100AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IQEBIQEBAQEBAQEBAQEBAQEBAQEBISEBAQEBASEBIQEBIQFRAQEBAQEBAQEBAQEBASEBAQEBAQEBAQEBAQEBASEBIQEB",
"Z6WLABcCAACZAgAAXAYAAGIRAAAoIwAA3k0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IQEBIQEBAQEhAQEBAQEBAQEBAQEBISEBAQEBASEBIQEBIQFRAQEBAQEBAQEBAQEBASEBAQEBAQEBAQEBAQEBAQEhIQEB",
"Z6WLADUCAAB7AgAAegYAAIERAAAIIwAA+00AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IQEBIQEBAQEBIQEBAQEBAQEBAQEBISEBAQEBASEBIQEBIQFRAQEBAQEBAQEBAQEBASEBAQEBAQEBAQEBAQEBASEhIQEB",
"Z6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AAAAAAAAAAAAAA0IQEBIQEBAQEBISEhAQEBAQEBAQEBISEBAQEBASEBIQEBIQFRAQEBAQEBAQEBAQEBASEBAQEBAQEBAQEBAQEBASEhAQEB"
)
分别是16度制冷风速自动 到 30度制冷风速自动。
37楼有美的的遥控码,需要的去复制替换下。
2017年11月18日更新:
将miio替换为更广泛使用的 mirobo
climate.zip
(21.15 KB, 下载次数: 201)
|