第1步 配置Esp8266 arduino环境,配置tasmota编译环境 参考我的另外两个教程
基于ESP8266的Arduino环境搭建 https://www.jianshu.com/p/cf6f69137227
通过Arduino IDE编译属于自己的tasmota固件 https://www.jianshu.com/p/ca8ad4570cb1
第2步 修改3处
a、 工程目录下my_user_config.h
#define USE_IR_RECEIVE // Support for IR receiver (+7k2 code, 264 iram)
#define IR_RCV_BUFFER_SIZE 2048 // Max number of packets allowed in capture buffer (default 100 (*2 bytes ram))
#define IR_RCV_TIMEOUT 200 // Number of milli-Seconds of no-more-data before we consider a message ended (default 15)
#define IR_RCV_MIN_UNKNOWN_SIZE 6 // Set the smallest sized "UNKNOWN" message packets we actually care about (default 6, max 255)
b、库目录下C:\Program Files (x86)\Arduino\libraries\PubSubClient-EspEasy-2.7.12\src\PubSubClient.h
// MQTT_MAX_PACKET_SIZE : Maximum packet size
#ifndef MQTT_MAX_PACKET_SIZE
//#define MQTT_MAX_PACKET_SIZE 128
#define MQTT_MAX_PACKET_SIZE 2048 // Tasmota v5.11.1c
#endif
c、工程目录下sonoff_post.h
#ifndef MQTT_MAX_PACKET_SIZE
#define MQTT_MAX_PACKET_SIZE 2048 // Bytes
#endif
第4步 修改SetOption58 =1,打开原始数据显示
可通过MQTT的方式,cmnd/your topic/SetOption58 1
第5步 红外遥控器发送红外码,MQTT订阅(tele/your topic/RESULT)后得到原始码
第6步 MQTT发送(cmnd/your topic/IRsend) 0,原始码 模拟遥控器发送
OK!
附录:
海尔空调的原始码,我的空调型号是KFR-23GW/16GAB13U1
开空调
0,3082,3006,3036,4368,568,1638,592,510,568,1612,590,512,590,510,592,1588,592,1612,568,534,590,1588,592,510,590,1614,590,1590,590,512,590,512,566,1614,618,484,590,512,568,536,570,532,592,512,592,510,592,484,592,510,590,512,592,510,590,512,566,536,592,484,590,512,590,510,566,536,592,510,568,534,592,1586,592,510,566,536,590,510,592,484,592,510,594,508,568,1638,592,484,618,1588,592,508,592,512,592,484,610,492,618,484,592,510,592,510,590,512,592,484,618,484,590,512,592,510,592,510,592,508,592,484,620,482,592,510,592,510,592,510,592,512,592,510,590,484,566,536,592,510,594,510,590,510,592,486,646,456,592,510,592,510,592,510,590,512,584,490,616,486,590,512,592,510,592,508,592,510,590,484,618,484,592,510,592,510,590,512,592,510,590,512,566,510,568,534,590,512,592,510,566,534,592,484,616,486,590,510,592,1614,590,512,590,484,592,510,592,510,594,1612,592,482,618,1586,592,1612,568,508,566,1638,592,1586,618,1586,568,1638,568,510,566,1638,566
关空调
0,3114,2976,3090,4314,622,1584,622,480,622,1558,650,452,620,482,620,1558,646,1558,622,480,622,1558,620,482,620,1586,620,1558,620,482,622,480,620,482,620,480,622,454,648,456,622,480,620,482,620,482,620,482,618,456,646,456,620,482,620,482,620,480,622,482,620,456,648,456,620,482,620,482,620,484,618,484,618,456,646,458,618,484,618,482,620,484,618,482,618,1560,618,484,620,1586,618,458,618,482,618,484,618,484,618,482,618,486,618,456,620,484,618,484,618,484,618,482,620,482,620,456,620,484,618,482,620,484,618,484,618,482,620,456,620,482,620,482,620,482,620,484,618,482,620,456,620,482,620,482,620,482,620,482,620,482,620,456,620,482,620,482,618,482,620,482,620,482,620,456,620,482,620,482,618,482,620,482,620,482,620,456,620,482,620,482,620,482,618,484,620,482,620,456,620,482,620,482,620,480,622,482,620,1558,620,482,620,484,618,482,620,482,620,1558,620,482,620,1586,620,456,620,1584,620,1584,620,1558,620,1586,618,456,620,1584,620,1558,620