红外空调反馈来袭!是时候丢掉你的X米X联了

一直以来,红外遥控被吐槽,无论是你买的博联还是其它红外,多数只能单向,接收器也只是拿来学习,市面唯一知道的也就是小米的空调可以做到接收发送同步,但是今天IRremoteMQTT也做到了!虽然目前支持不是很多,但实际上这是一项复杂的工程,没有各位的参与是不可能完成的!

##如何确定空调是否支持

当然了,你必须准备好一块ESP8266,另外具备一枚红外接收管,最好的办法就是借拆一枚,分别接好线,将OUT脚接入到esp8266 gpio14 [D5] 5V供电。将以下bin文件刷入,刷入完成后,使用TTL串口工具查看串口信息,
IRrecvDumpV2.ino.generic.zip (235 KB)

接下来是你展示你遥控器的时候了,按下你的遥控器,TTL显示类似如下信息:



Timestamp : 006910.551
Encoding  : PANASONIC_AC
Code      : 0220E004000000060220E00400313680A100000660000085000079 (216 bits)
Mesg Desc.: Model: 4 (JKE), Power: On, Mode: 3 (COOL), Temp: 27C, Fan: 7 (AUTO), Swing (Vertical): 1 (Full Up), Quiet: Off, Powerful: Off, Clock: 0:00, On Timer: Off, Off Timer: Off
Library   : v2.6.0

Raw Timing[439]:
   +  3548, -  1702,    +   480, -   398,    +   426, -  1304,    +   508, -   400, 
   +   478, -   404,    +   480, -   400,    +   480, -   404,    +   480, -   400, 
   +   428, -   462,    +   428, -   452,    +   428, -   454,    +   428, -   454, 
   +   428, -   454,    +   428, -   454,    +   428, -  1302,    +   428, -   454, 
   +   428, -   462,    +   428, -   452,    +   426, -   454,    +   426, -   454, 
   +   428, -   454,    +   428, -   454,    +   426, -  1306,    +   478, -  1252, 
   +   428, -  1312,    +   480, -   402,    +   428, -   454,    +   426, -  1304, 
   +   428, -   454,    +   428, -   454,    +   426, -   454,    +   428, -   454, 
   +   426, -   462,    +   428, -   452,    +   426, -   454,    +   480, -   402, 
   +   428, -   456,    +   428, -   454,    +   426, -   454,    +   428, -   456, 
   +   426, -   464,    +   428, -   452,    +   428, -   454,    +   428, -   454, 
   +   426, -   456,    +   426, -   454,    +   428, -   454,    +   426, -   456, 
   +   452, -   438,    +   454, -   448,    +   428, -   454,    +   426, -   456, 
   +   428, -   456,    +   426, -   454,    +   426, -   454,    +   428, -   454, 
   +   428, -   464,    +   426, -   454,    +   426, -  1304,    +   428, -  1302, 
   +   426, -   456,    +   426, -   454,    +   428, -   454,    +   428, -   454, 
   +   428, -   462,    +   436, - 10992,    +  3548, -  1700,    +   428, -   452, 
   +   478, -  1252,    +   428, -   454,    +   480, -   402,    +   428, -   454, 
   +   480, -   402,    +   480, -   402,    +   480, -   410,    +   428, -   450, 
   +   480, -   402,    +   430, -   452,    +   426, -   456,    +   480, -   402, 
   +   478, -  1250,    +   428, -   454,    +   428, -   464,    +   478, -   400, 
   +   480, -   402,    +   428, -   454,    +   480, -   402,    +   428, -   454, 
   +   480, -  1250,    +   480, -  1250,    +   428, -  1310,    +   480, -   400, 
   +   480, -   400,    +   428, -  1304,    +   478, -   404,    +   480, -   402, 
   +   426, -   456,    +   478, -   402,    +   480, -   410,    +   482, -   398, 
   +   480, -   402,    +   428, -   454,    +   480, -   402,    +   428, -   454, 
   +   478, -   404,    +   426, -   456,    +   478, -   410,    +   478, -  1250, 
   +   426, -   454,    +   428, -   456,    +   426, -   454,    +   480, -  1250, 
   +   428, -  1304,    +   478, -   404,    +   426, -   462,    +   482, -   398, 
   +   428, -  1302,    +   428, -  1304,    +   426, -   456,    +   478, -  1252, 
   +   428, -  1302,    +   426, -   454,    +   428, -   462,    +   428, -   452, 
   +   428, -   454,    +   478, -   404,    +   478, -   404,    +   426, -   454, 
   +   478, -   402,    +   480, -   402,    +   428, -  1312,    +   434, -  1292, 
   +   480, -   402,    +   426, -   454,    +   480, -   402,    +   478, -   402, 
   +   482, -  1250,    +   478, -   404,    +   480, -  1258,    +   480, -   400, 
   +   480, -   402,    +   478, -   406,    +   428, -   454,    +   482, -   400, 
   +   482, -   400,    +   480, -   402,    +   482, -   408,    +   480, -   400, 
   +   480, -   400,    +   480, -   400,    +   480, -   402,    +   482, -   400, 
   +   480, -   402,    +   480, -   402,    +   482, -   408,    +   482, -   396, 
   +   482, -  1250,    +   482, -  1250,    +   480, -   402,    +   482, -   400, 
   +   480, -   402,    +   480, -   402,    +   480, -   412,    +   480, -   398, 
   +   480, -   400,    +   480, -   400,    +   482, -   400,    +   482, -   400, 
   +   480, -  1250,    +   482, -  1250,    +   480, -   408,    +   480, -   400, 
   +   478, -   402,    +   482, -   400,    +   452, -   430,    +   480, -   400, 
   +   480, -   402,    +   480, -   402,    +   480, -   410,    +   482, -   398, 
   +   480, -   402,    +   480, -   402,    +   428, -   456,    +   428, -   452, 
   +   482, -   402,    +   428, -   454,    +   482, -   408,    +   482, -  1244, 
   +   482, -   400,    +   480, -  1250,    +   508, -   376,    +   480, -   400, 
   +   482, -   400,    +   480, -   400,    +   428, -  1310,    +   482, -   398, 
   +   428, -   452,    +   482, -   400,    +   482, -   402,    +   482, -   400, 
   +   482, -   400,    +   482, -   400,    +   480, -   410,    +   480, -   398, 
   +   480, -   400,    +   480, -   400,    +   482, -   400,    +   482, -   400, 
   +   482, -   400,    +   482, -   402,    +   480, -   416,    +   480, -  1246, 
   +   484, -   400,    +   480, -   400,    +   480, -  1250,    +   482, -  1248, 
   +   480, -  1250,    +   482, -  1250,    +   482, -   408,    +   482

uint16_t rawData[439] = {3548, 1702,  480, 398,  426, 1304,  508, 400,  478, 404,  480, 400,  480, 404,  480, 400,  428, 462,  428, 452,  428, 454,  428, 454,  428, 454,  428, 454,  428, 1302,  428, 454,  428, 462,  428, 452,  426, 454,  426, 454,  428, 454,  428, 454,  426, 1306,  478, 1252,  428, 1312,  480, 402,  428, 454,  426, 1304,  428, 454,  428, 454,  426, 454,  428, 454,  426, 462,  428, 452,  426, 454,  480, 402,  428, 456,  428, 454,  426, 454,  428, 456,  426, 464,  428, 452,  428, 454,  428, 454,  426, 456,  426, 454,  428, 454,  426, 456,  452, 438,  454, 448,  428, 454,  426, 456,  428, 456,  426, 454,  426, 454,  428, 454,  428, 464,  426, 454,  426, 1304,  428, 1302,  426, 456,  426, 454,  428, 454,  428, 454,  428, 462,  436, 10992,  3548, 1700,  428, 452,  478, 1252,  428, 454,  480, 402,  428, 454,  480, 402,  480, 402,  480, 410,  428, 450,  480, 402,  430, 452,  426, 456,  480, 402,  478, 1250,  428, 454,  428, 464,  478, 400,  480, 402,  428, 454,  480, 402,  428, 454,  480, 1250,  480, 1250,  428, 1310,  480, 400,  480, 400,  428, 1304,  478, 404,  480, 402,  426, 456,  478, 402,  480, 410,  482, 398,  480, 402,  428, 454,  480, 402,  428, 454,  478, 404,  426, 456,  478, 410,  478, 1250,  426, 454,  428, 456,  426, 454,  480, 1250,  428, 1304,  478, 404,  426, 462,  482, 398,  428, 1302,  428, 1304,  426, 456,  478, 1252,  428, 1302,  426, 454,  428, 462,  428, 452,  428, 454,  478, 404,  478, 404,  426, 454,  478, 402,  480, 402,  428, 1312,  434, 1292,  480, 402,  426, 454,  480, 402,  478, 402,  482, 1250,  478, 404,  480, 1258,  480, 400,  480, 402,  478, 406,  428, 454,  482, 400,  482, 400,  480, 402,  482, 408,  480, 400,  480, 400,  480, 400,  480, 402,  482, 400,  480, 402,  480, 402,  482, 408,  482, 396,  482, 1250,  482, 1250,  480, 402,  482, 400,  480, 402,  480, 402,  480, 412,  480, 398,  480, 400,  480, 400,  482, 400,  482, 400,  480, 1250,  482, 1250,  480, 408,  480, 400,  478, 402,  482, 400,  452, 430,  480, 400,  480, 402,  480, 402,  480, 410,  482, 398,  480, 402,  480, 402,  428, 456,  428, 452,  482, 402,  428, 454,  482, 408,  482, 1244,  482, 400,  480, 1250,  508, 376,  480, 400,  482, 400,  480, 400,  428, 1310,  482, 398,  428, 452,  482, 400,  482, 402,  482, 400,  482, 400,  482, 400,  480, 410,  480, 398,  480, 400,  480, 400,  482, 400,  482, 400,  482, 400,  482, 402,  480, 416,  480, 1246,  484, 400,  480, 400,  480, 1250,  482, 1248,  480, 1250,  482, 1250,  482, 408,  482};  // PANASONIC_AC
uint8_t state[27] = {0x02, 0x20, 0xE0, 0x04, 0x00, 0x00, 0x00, 0x06, 0x02, 0x20, 0xE0, 0x04, 0x00, 0x31, 0x36, 0x80, 0xA1, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x85, 0x00, 0x00, 0x79};

在以上信息中,我们可以看到decode Mesg Desc.: 信息,展示了目前遥控的代码和结构,如果你的遥控器按下后生成类似消息 ,那么恭喜你,你的空调代码无损支持,并且使用此源码将可以使用MQTT来同步显示和操作空调,所有遥控操作将同步到MQTT消息中。

然而如果你的是这样的:

Timestamp : 007100.353
Encoding  : UNKNOWN
Code      : 9BBD013B (106 bits)
Library   : v2.6.0

Raw Timing[211]:
   +  9010, -  4648,    +   456, -  1854,    +   428, -  1854,    +   430, -   698, 
   +   402, -   648,    +   454, -   700,    +   426, -   674,    +   426, -  1780, 
   +   456, -  1798,    +   456, -   730,    +   402, -   644,    +   426, -   730, 
   +   220, -  2010,    +   296, -   776,    +   430, -   700,    +   374, -   728, 
   +   404, -  1852,    +   430, -   620,    +   454, -   648,    +   454, -   674, 
   +   456, -   618,    +   458, -   672,    +   428, -  1828,    +   430, -  1804, 
   +   452, -  1828,    +   428, -   700,    +   324, -   750,    +   428, -   652, 
   +   454, -   694,    +   402, -   700,    +   418, -   684,    +   430, -   672, 
   +   430, -   648,    +   426, -   648,    +   452, -   766,    +   364, -   726, 
   +   296, -   698,    +   456, -   700,    +   350, -  1878,    +   432, -   674, 
   +   380, -  1872,    +   430, -   644,    +   454, -   702,    +   402, -   674, 
   +   454, -   672,    +   406, -   644,    +   482, -   646,    +   428, -   700, 
   +   404, -   698,    +   402, -   644,    +   456, -   754,    +   348, -   672, 
   +   458, -   616,    +   458, -   670,    +   404, -   726,    +   402, -   726, 
   +   376, -  1828,    +   430, -   698,    +   404, -   750,    +   380, -   616, 
   +   432, -   724,    +   400, -   702,    +   426, -   674,    +   406, -   644, 
   +   456, -   776,    +   402, -   726,    +   402, -   674,    +   376, -   674, 
   +   454, -   724,    +   378, -   700,    +   378, -   766,    +   360, -   670, 
   +   432, -   670,    +   430, -   674,    +   406, -   692,    +   432, -   674, 
   +   452, -   726,    +   326, -   724,    +   428, -  1776,    +   478, -   678, 
   +   402, -   698,    +   428, -   620,    +   458, -   724,    +   376, -   674, 
   +   376, -   698,    +   456, -   698,    +   376, -   728,    +   402, -   700, 
   +   378, -   790,    +   336, -   644,    +   454, -  1828,    +   430, -  1802, 
   +   454, -   674,    +   454, -   672,    +   402, -   674,    +   428, -   700, 
   +   424, -   676,    +   404, -  1800,    +   430, -   698,    +   430, -   672, 
   +   458, -   644,    +   428, -  1856,    +   402, -  1802,    +   458, -  1800, 
   +   456, -   644,    +   456

uint16_t rawData[211] = {9010, 4648,  456, 1854,  428, 1854,  430, 698,  402, 648,  454, 700,  426, 674,  426, 1780,  456, 1798,  456, 730,  402, 644,  426, 730,  220, 2010,  296, 776,  430, 700,  374, 728,  404, 1852,  430, 620,  454, 648,  454, 674,  456, 618,  458, 672,  428, 1828,  430, 1804,  452, 1828,  428, 700,  324, 750,  428, 652,  454, 694,  402, 700,  418, 684,  430, 672,  430, 648,  426, 648,  452, 766,  364, 726,  296, 698,  456, 700,  350, 1878,  432, 674,  380, 1872,  430, 644,  454, 702,  402, 674,  454, 672,  406, 644,  482, 646,  428, 700,  404, 698,  402, 644,  456, 754,  348, 672,  458, 616,  458, 670,  404, 726,  402, 726,  376, 1828,  430, 698,  404, 750,  380, 616,  432, 724,  400, 702,  426, 674,  406, 644,  456, 776,  402, 726,  402, 674,  376, 674,  454, 724,  378, 700,  378, 766,  360, 670,  432, 670,  430, 674,  406, 692,  432, 674,  452, 726,  326, 724,  428, 1776,  478, 678,  402, 698,  428, 620,  458, 724,  376, 674,  376, 698,  456, 698,  376, 728,  402, 700,  378, 790,  336, 644,  454, 1828,  430, 1802,  454, 674,  454, 672,  402, 674,  428, 700,  424, 676,  404, 1800,  430, 698,  430, 672,  458, 644,  428, 1856,  402, 1802,  458, 1800,  456, 644,  456};  // UNKNOWN 9BBD013B

很遗憾,两种情况,一种库不包含这种空调代码,另外一种情况,源码包含了这个品牌,但解码长度和值不对,针对这种情况你可以 收集一操作 然后把操作注明,提交issue给作者,他可以根据你的操作和原始值分析码长和值的一些情况。我富士通是通过这种方法沟通完成的!

需要指出的是,由于空调厂家变动一些代码阀值,部分显示也会unknow,但是刷完IRMQTTSERVER固件后,仍然可以控制空调,却不能Decode解析,此类情况请参考上面的分析完所有的操作原始值,提交给作者修改码长和阀值等信息

##喜普大奔,支持了怎么用?

移步作者源码https://github.com/markszabo/IRremoteESP8266,下载到arduino库,示例IRMQTTSERVER,对应编译即可。不会操作,请下载
IRMQTTServer.ino.generic.zip (333 KB)

使用编译请修改IRMQTTSERVER.h文件中的IR_LED 和IR_RX ,其对应的是发射脚IO和接收IO

下载已经编译的固件请:

红外发射管请 GND接IO短脚] D2 V接 电源3V长脚] ,接收管out脚接 IO D5.

刷入完成后,上电默认AP模式,手机连入后配网操作,务必配置MQTT,配置完成后,可使用IP进入IRMQTTSERVER ,操作如下图

请务必确认你的测试是可以发码的,使用手机摄像头对着红外管,操作后有灯闪表示发码成功,所有操作均无灯闪请检查自己的GPIO接线


使用AIRCON操作的时候,如果你的空调不支持swing v&H 扫风模式,请不要开启,所有功能空调没有的,均不要开启,否则发码不成功!


操作时model可以默认,没有反应可以再选择1、2、3、4、5、6,均无反应则PASS,不支持

##MQTT

至于接入方面,通过上图,大概你们也清楚,设备网页info里也已经展示。调用接口均匀 已经出现,不再赘述!

有测试OK的基友,请贴出你的遥控器型号及图片,thanks,,,,

美的风管机: RM51D

富士通将军:AR-RCE1C

松下: A75C4627

以上三款测试通过,全部反馈成功

赞,又有新的玩了:lol

这个牛逼啊 ,强烈推荐!

膜拜一下H大。

重要的事情说三遍:感谢H大,感谢H大,感谢H大。格力YAD0F 完美接入

H大牛皮。可惜我的空调不支持,在尝试提交issue了

先买个8266回来看看我家空调行不行。

特别感谢H大造车
美的挂机:KFR-26G

测试了,无损支持,就等开车了啊。

格力空调遥控型号:YBOFB2 翻车。

我测试了格力的 完美支持

我也是这个型号,我才焊完就看到这个 :scream:还没来得及试呢

想问下H大,固件更新吗?

H大牛批,你的那款方的成品可以直接刷这个么

风管机遥控器支持吗

更新吗,格力不支持

格力的Y502S翻车