剛入門HA的時候,有看到網路上有人在賣IRMQTT的套件,當時HA還剛起步尚未玩到這麼進階,也不了解反饋的用途是什麼,後來利用broadlink紅外線遙控一些非智能家電,才慢慢體會到和實際生活上的衝突,就是當你的家人拿起遙控器操作的時候,你會無法同步設備狀態,這在冷氣上的應用會比較明顯,尤其是你將設備轉到Homekit後,這邊就來稍微分享一下利用ESPhome進行紅外線反饋的步驟和一些我發現要注意的地方。
硬體:
ESPhome的起手式不外乎是自建模組或是買現成產品回來刷機,不管哪種方式都有一點門檻,刷機部分這裡先不討論,紅外線產品基本上能刷的以塗鴉為大宗,但近期塗鴉更換芯片模組後這條路已被關上, 剩下的就是自建模組,要做到完全整合,當然會希望能將發射和接收整合在一起,但要同時做到兩者,必須要整合transmitter以及receiver兩者,有點麻煩,這點在偶然間看見版大Edwin分享的整合好的模組後才意外激起我的興致,模組連結如下:https://www.wemos.cc/en/latest/d1_mini_shield/ir.html
借用官網圖片介紹一下,由外型可以看出這是Wemos為了D1 mini出的整合式模塊,有四顆很可愛的IR LED(紅框)搭配二極體增益訊號強度來作為transmitter,以及一個receiver(綠色)
實際使用上,此款模組的訊號還是不夠,實測距離大約三~四公尺左右,而且隨距離方向性問題會越明顯,這也能夠理解,畢竟這LED真的很迷你;Receiver的部分效果就很好,在空間較大的客廳,即便我不對著打,隨便朝任意方向都能夠接收到IR訊號,和D1 mini組合起來之後長這樣:
軟體:
官方的敘述都很清楚了,我是使用SmartIR搭配ESPhome的功能,相關連結如下:
這邊針對我發現的一些需要注意的地方分享一下心得:
- 學碼的時候太舊的遙控器好像會有點問題?我家十幾年的禾聯冷氣能接收的到訊號,但每次的Raw差異有點大,導致設定的接收訊號常常無法作動,剛好有兩種不同的遙控器拿來亂試了一下才能用
- SmartIR的說明沒有提到需要額外設定carrier frequency,我學完後按了半天沒反應,後來爬文看到有人加上此設定就可以了,在家電上最常見的是NEC protocol,對應的頻率是38khz,我的禾聯剛好就是對應這個頻率,其他的品牌可能要try and error一下
# Enable Home Assistant API
api:
services:
- service: send_raw_command
variables:
command: int[]
then:
- remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: !lambda 'return command;'
- 要做到訊號同步必須先按照官方說明建立每一個function對應的binary sensor,當你按了特定按鍵該binary sensor就會作動,但這會有一個問題,冷氣function超多,不同運轉模式對應不同溫度你會有一大票binary sensor,如下…
binary_sensor:
#Climate
- platform: remote_receiver
id: heran_off
raw:
code: [698, -3422, 546, -697, 546, -693, 570, -674, 567, -678, 543, -694, 573, -671, 568, -673, 567, -678, 547, -717, 548, -671, 569, -668, 545, -701, 570, -676, 567, -674, 565, -675, 568, -677, 567, -697, 547, -693, 545, -675, 566, -679, 566, -675, 544, -697, 570, -695, 545, -696, 524, -700, 564, -676, 565, -695, 546, -699, 522, -722, 543, -697, 546, -693, 545, -680, 564, -678, 565, -676, 540, -722, 520, -726, 543, -697, 521, -721, 542, -698, 542, -705, 541, -701, 541, -699, 541, -700, 542, -703, 518, -1799, 519, -722, 518, -723, 542, -1781, 540, -704, 515, -1799, 517, -1802, 514, -730, 567, -3433, 646]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_mode
state: "off"
#Auto
- platform: remote_receiver
# name: "Heran_auto_23"
id: auto_23
raw:
code: [737, -3397, 605, -642, 603, -640, 608, -636, 606, -642, 604, -642, 601, -642, 604, -1719, 603, -1725, 608, -638, 603, -640, 603, -641, 605, -644, 602, -643, 606, -638, 603, -641, 603, -645, 604, -641, 605, -638, 607, -637, 610, -638, 609, -637, 607, -636, 602, -642, 606, -642, 604, -641, 604, -640, 609, -634, 602, -646, 603, -643, 603, -640, 604, -639, 603, -645, 605, -641, 606, -637, 578, -666, 607, -641, 605, -640, 604, -640, 604, -639, 604, -644, 606, -640, 605, -637, 602, -642, 606, -643, 605, -640, 603, -1719, 604, -1718, 604, -1725, 604, -642, 604, -1717, 604, -640, 602, -1725, 630, -3382, 732]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "23"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
- platform: remote_receiver
# name: "Heran_auto_24"
id: auto_24
raw:
code: [741, -3394, 578, -669, 606, -637, 602, -642, 612, -637, 634, -611, 606, -638, 605, -1717, 610, -1718, 609, -637, 612, -632, 633, -610, 603, -645, 577, -669, 575, -668, 610, -633, 607, -642, 606, -640, 602, -641, 603, -641, 607, -641, 607, -639, 607, -636, 604, -639, 605, -644, 602, -643, 610, -634, 605, -638, 607, -642, 606, -639, 606, -637, 609, -635, 605, -643, 609, -637, 603, -641, 604, -638, 611, -638, 611, -634, 610, -634, 601, -642, 603, -645, 605, -641, 607, -637, 610, -633, 602, -647, 610, -1714, 610, -634, 605, -638, 605, -644, 600, -645, 601, -1722, 603, -641, 601, -647, 636, -3375, 738]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "24"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
- platform: remote_receiver
# name: "Heran_auto_25"
id: auto_25
raw:
code: [737, -3397, 603, -644, 602, -642, 602, -641, 576, -672, 576, -669, 603, -641, 603, -1719, 576, -1751, 579, -668, 603, -640, 604, -639, 600, -649, 602, -644, 601, -642, 577, -667, 604, -644, 602, -644, 602, -641, 603, -641, 603, -645, 601, -645, 576, -668, 604, -639, 603, -645, 603, -643, 602, -641, 606, -637, 602, -647, 602, -644, 602, -641, 602, -641, 602, -647, 602, -643, 602, -640, 577, -668, 605, -643, 604, -641, 604, -640, 601, -642, 602, -646, 576, -670, 576, -667, 603, -641, 603, -645, 601, -1724, 604, -640, 603, -640, 601, -1726, 605, -642, 604, -639, 603, -1720, 604, -1724, 630, -3381, 734]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "25"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
- platform: remote_receiver
# name: "Heran_auto_26"
id: auto_26
raw:
code: [737, -3398, 604, -643, 612, -631, 604, -640, 605, -643, 604, -642, 605, -639, 608, -1714, 609, -1719, 602, -644, 575, -669, 602, -641, 604, -645, 609, -636, 609, -635, 605, -638, 602, -646, 600, -646, 600, -643, 606, -638, 604, -644, 612, -634, 605, -638, 602, -642, 606, -642, 601, -645, 602, -641, 610, -633, 610, -639, 607, -638, 601, -643, 605, -639, 606, -642, 602, -643, 611, -633, 606, -637, 604, -644, 601, -644, 606, -638, 603, -640, 610, -639, 611, -635, 606, -636, 604, -640, 608, -640, 607, -1717, 602, -643, 600, -1722, 603, -646, 603, -643, 602, -641, 601, -1722, 600, -648, 635, -3376, 732]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "26"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
- platform: remote_receiver
# name: "Heran_auto_27"
id: auto_27
raw:
code: [741, -3393, 605, -642, 606, -637, 605, -639, 607, -641, 610, -636, 606, -637, 577, -1746, 603, -1725, 602, -644, 604, -640, 609, -634, 605, -644, 603, -642, 601, -642, 603, -640, 606, -643, 607, -639, 606, -637, 606, -637, 602, -647, 603, -642, 603, -640, 601, -643, 610, -638, 603, -642, 612, -632, 602, -641, 601, -647, 603, -643, 603, -641, 610, -633, 609, -639, 632, -614, 603, -640, 602, -641, 604, -645, 606, -639, 605, -638, 609, -635, 605, -644, 605, -640, 603, -640, 603, -641, 608, -640, 605, -1719, 603, -641, 604, -1719, 605, -1722, 604, -642, 610, -634, 604, -640, 600, -1727, 636, -3375, 742]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "27"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
- platform: remote_receiver
# name: "Heran_auto_28"
id: auto_28
raw:
code: [735, -3401, 608, -639, 608, -635, 610, -634, 609, -639, 612, -634, 608, -636, 600, -1722, 604, -1724, 605, -642, 605, -638, 606, -638, 603, -646, 602, -644, 605, -639, 605, -638, 605, -644, 603, -642, 601, -642, 603, -641, 605, -644, 606, -639, 608, -636, 604, -639, 607, -642, 605, -641, 608, -635, 604, -640, 604, -644, 602, -643, 576, -668, 611, -632, 606, -642, 609, -637, 634, -610, 603, -640, 607, -642, 609, -636, 604, -640, 601, -642, 576, -672, 602, -643, 606, -638, 605, -638, 602, -647, 604, -1720, 608, -1716, 605, -638, 604, -645, 604, -641, 605, -638, 608, -636, 606, -643, 630, -3381, 735]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "28"
- text_sensor.template.publish:
id: room_heran_mode
state: "auto"
#High
- platform: remote_receiver
id: high_23
raw:
code: [704, -3432, 572, -700, 546, -673, 571, -674, 571, -701, 545, -678, 569, -698, 545, -1754, 570, -1757, 572, -700, 547, -697, 546, -698, 547, -702, 548, -675, 569, -698, 546, -672, 574, -700, 548, -698, 548, -695, 547, -697, 545, -704, 551, -673, 568, -698, 547, -696, 547, -678, 570, -677, 569, -675, 569, -697, 546, -703, 546, -701, 545, -698, 545, -699, 546, -681, 569, -698, 545, -677, 568, -699, 546, -680, 570, -698, 547, -697, 547, -697, 546, -703, 547, -1753, 571, -698, 545, -676, 570, -702, 572, -673, 546, -1753, 575, -1749, 572, -1757, 572, -1753, 577, -1748, 573, -699, 544, -1756, 599, -3416, 704]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "23"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
- platform: remote_receiver
id: high_24
raw:
code: [735, -3404, 605, -639, 608, -637, 606, -640, 605, -641, 604, -642, 607, -637, 606, -1717, 606, -1723, 609, -637, 607, -637, 605, -639, 603, -649, 602, -640, 606, -639, 609, -634, 602, -647, 613, -633, 606, -638, 605, -639, 610, -638, 605, -642, 607, -637, 604, -639, 606, -643, 605, -641, 609, -635, 607, -637, 608, -641, 603, -643, 606, -638, 606, -637, 603, -646, 605, -641, 633, -611, 605, -639, 607, -642, 607, -639, 605, -639, 605, -639, 606, -643, 607, -1718, 606, -638, 608, -636, 606, -643, 605, -1719, 605, -639, 607, -637, 606, -644, 604, -1720, 607, -1717, 607, -637, 605, -644, 630, -3382, 736]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "24"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
- platform: remote_receiver
id: high_25
raw:
code: [734, -3402, 609, -639, 603, -640, 606, -638, 606, -643, 607, -639, 604, -639, 606, -1717, 608, -1721, 608, -642, 602, -638, 607, -637, 604, -645, 608, -638, 606, -638, 606, -638, 603, -646, 606, -640, 607, -638, 604, -639, 604, -645, 604, -642, 603, -640, 633, -611, 606, -643, 605, -641, 606, -638, 607, -637, 605, -644, 604, -642, 605, -638, 606, -638, 607, -643, 603, -643, 606, -637, 607, -638, 604, -644, 605, -641, 606, -638, 605, -638, 607, -643, 604, -1721, 605, -639, 606, -638, 607, -643, 605, -1720, 605, -640, 607, -637, 605, -1724, 607, -1722, 601, -640, 605, -1719, 604, -1725, 632, -3381, 741]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "25"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
- platform: remote_receiver
id: high_26
raw:
code: [737, -3400, 607, -641, 606, -637, 605, -639, 608, -641, 605, -642, 603, -641, 606, -1717, 607, -1722, 607, -640, 608, -636, 608, -635, 631, -618, 610, -637, 607, -637, 603, -640, 606, -643, 606, -640, 606, -639, 605, -638, 607, -642, 606, -640, 605, -639, 609, -636, 605, -643, 605, -643, 606, -636, 605, -639, 605, -644, 604, -642, 606, -637, 609, -636, 604, -645, 606, -640, 606, -638, 602, -642, 604, -644, 607, -638, 605, -640, 607, -637, 605, -644, 604, -1721, 604, -643, 602, -639, 605, -647, 601, -1721, 606, -639, 607, -1716, 604, -645, 604, -1722, 606, -639, 606, -1716, 608, -642, 631, -3381, 737]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "26"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
- platform: remote_receiver
# name: "Heran_auto_27"
id: high_27
raw:
code: [731, -3407, 605, -641, 604, -640, 603, -642, 599, -650, 577, -668, 581, -663, 599, -1724, 578, -1751, 604, -644, 602, -641, 600, -645, 603, -649, 599, -644, 577, -667, 577, -666, 602, -651, 599, -644, 604, -640, 576, -668, 575, -674, 577, -669, 600, -644, 577, -668, 576, -672, 579, -668, 600, -643, 601, -644, 600, -650, 601, -645, 575, -669, 599, -645, 577, -673, 602, -643, 576, -668, 602, -642, 576, -674, 577, -669, 602, -642, 576, -668, 576, -674, 599, -1729, 599, -643, 600, -643, 576, -673, 575, -1751, 577, -667, 600, -1724, 600, -1732, 576, -1748, 577, -668, 576, -668, 575, -1754, 625, -3389, 707]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "27"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
- platform: remote_receiver
# name: "Heran_auto_28"
id: high_28
raw:
code: [737, -3399, 606, -641, 610, -635, 608, -634, 608, -641, 605, -641, 607, -638, 605, -1718, 605, -1726, 603, -641, 607, -636, 605, -638, 611, -639, 608, -637, 606, -638, 607, -637, 602, -647, 607, -638, 608, -637, 605, -638, 608, -641, 606, -640, 606, -641, 604, -637, 606, -643, 606, -640, 606, -638, 605, -642, 600, -646, 605, -640, 607, -637, 608, -636, 608, -641, 608, -638, 606, -638, 605, -638, 607, -643, 604, -641, 607, -637, 607, -637, 605, -644, 609, -1716, 605, -639, 604, -639, 607, -643, 604, -1721, 608, -1715, 604, -641, 608, -640, 607, -1718, 606, -638, 605, -638, 607, -642, 631, -3382, 736]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "28"
- text_sensor.template.publish:
id: room_heran_mode
state: "high"
#Mid
- platform: remote_receiver
id: mid_23
raw:
code: [737, -3399, 632, -615, 632, -612, 604, -640, 607, -642, 608, -637, 606, -639, 605, -1720, 607, -1720, 607, -642, 603, -638, 604, -640, 606, -642, 607, -639, 606, -638, 605, -639, 608, -641, 607, -639, 608, -638, 600, -642, 603, -645, 608, -638, 606, -638, 605, -639, 607, -642, 606, -640, 607, -637, 607, -637, 609, -639, 604, -642, 604, -640, 605, -638, 610, -639, 606, -640, 605, -641, 602, -639, 606, -642, 610, -637, 605, -639, 606, -637, 607, -1721, 609, -639, 605, -639, 605, -638, 607, -1721, 608, -639, 606, -1718, 606, -1718, 605, -1723, 607, -640, 605, -640, 606, -1716, 605, -1723, 633, -3381, 735]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "23"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
- platform: remote_receiver
id: mid_24
raw:
code: [735, -3401, 605, -643, 604, -639, 603, -642, 579, -669, 602, -646, 599, -643, 601, -1722, 606, -1723, 605, -642, 606, -638, 604, -640, 603, -647, 602, -644, 602, -641, 579, -667, 603, -644, 601, -645, 601, -642, 605, -640, 603, -646, 604, -642, 602, -641, 602, -645, 600, -646, 605, -641, 602, -642, 604, -640, 604, -645, 604, -642, 603, -640, 602, -643, 601, -648, 603, -643, 578, -666, 601, -643, 577, -671, 602, -644, 605, -639, 603, -641, 603, -1725, 605, -641, 608, -638, 600, -644, 600, -1726, 603, -1723, 601, -644, 576, -668, 603, -646, 604, -642, 604, -640, 603, -1720, 601, -649, 629, -3383, 713]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "24"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
- platform: remote_receiver
id: mid_25
raw:
code: [736, -3401, 606, -641, 601, -643, 602, -642, 604, -645, 603, -643, 603, -641, 602, -1722, 605, -1724, 604, -642, 579, -665, 604, -640, 606, -643, 602, -644, 604, -640, 602, -641, 601, -648, 603, -643, 604, -640, 606, -638, 605, -644, 580, -666, 605, -639, 601, -643, 603, -645, 606, -640, 603, -642, 602, -641, 606, -644, 602, -643, 602, -642, 603, -641, 602, -646, 603, -644, 601, -643, 603, -640, 603, -646, 577, -673, 598, -642, 603, -640, 578, -1750, 579, -669, 602, -641, 603, -640, 579, -1750, 602, -1723, 604, -640, 578, -666, 603, -1726, 603, -643, 603, -641, 604, -641, 602, -1726, 629, -3384, 734]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "25"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
- platform: remote_receiver
id: mid_26
raw:
code: [738, -3400, 606, -639, 606, -638, 606, -638, 604, -645, 606, -640, 603, -640, 605, -1719, 607, -1721, 607, -640, 606, -637, 608, -636, 606, -643, 610, -636, 605, -638, 603, -642, 607, -642, 606, -640, 606, -637, 606, -639, 605, -643, 605, -641, 607, -636, 605, -640, 609, -640, 607, -638, 606, -642, 603, -637, 607, -642, 608, -637, 609, -636, 607, -637, 608, -645, 603, -639, 606, -638, 608, -636, 606, -642, 608, -639, 606, -638, 606, -637, 606, -1722, 606, -641, 606, -639, 606, -637, 607, -1721, 604, -1722, 606, -638, 606, -1718, 606, -643, 605, -641, 607, -638, 602, -641, 607, -642, 630, -3382, 737]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "26"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
- platform: remote_receiver
# name: "Heran_auto_27"
id: mid_27
raw:
code: [740, -3396, 606, -641, 607, -638, 607, -637, 607, -642, 605, -640, 606, -638, 607, -1716, 604, -1724, 608, -638, 607, -637, 607, -637, 605, -644, 608, -638, 608, -635, 606, -639, 604, -645, 606, -639, 607, -638, 603, -641, 606, -642, 610, -636, 604, -640, 607, -637, 606, -643, 607, -639, 607, -637, 607, -637, 605, -644, 606, -639, 608, -637, 608, -635, 608, -641, 607, -639, 604, -640, 605, -639, 608, -641, 608, -638, 607, -637, 605, -638, 607, -1721, 609, -638, 603, -641, 605, -639, 608, -1725, 604, -1717, 606, -639, 608, -1716, 607, -1722, 606, -1720, 609, -1714, 608, -1716, 609, -1720, 633, -3380, 739]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "27"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
- platform: remote_receiver
# name: "Heran_auto_28"
id: mid_28
raw:
code: [739, -3398, 609, -638, 602, -642, 609, -637, 606, -641, 604, -642, 604, -642, 605, -1717, 604, -1725, 606, -640, 607, -637, 606, -638, 607, -643, 606, -639, 606, -638, 606, -639, 610, -638, 609, -637, 606, -639, 605, -639, 607, -642, 603, -643, 607, -638, 606, -638, 605, -643, 609, -637, 610, -634, 606, -638, 606, -643, 605, -641, 606, -638, 606, -638, 604, -646, 606, -638, 606, -638, 605, -639, 605, -644, 609, -636, 609, -636, 608, -636, 606, -1722, 606, -640, 605, -640, 605, -639, 605, -1727, 603, -1720, 604, -1719, 607, -638, 608, -642, 606, -1719, 608, -1716, 605, -1719, 605, -645, 632, -3382, 735]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "28"
- text_sensor.template.publish:
id: room_heran_mode
state: "mid"
#Low
- platform: remote_receiver
id: low_23
raw:
code: [738, -3398, 608, -638, 607, -638, 607, -636, 606, -644, 606, -639, 609, -635, 605, -1719, 604, -1724, 607, -640, 605, -639, 606, -639, 605, -642, 607, -639, 605, -638, 603, -642, 606, -643, 605, -641, 607, -637, 608, -638, 600, -646, 606, -640, 607, -638, 602, -641, 605, -644, 604, -641, 605, -639, 606, -637, 606, -644, 605, -641, 607, -638, 603, -639, 608, -641, 606, -639, 606, -638, 606, -638, 606, -643, 605, -641, 605, -639, 604, -1718, 605, -645, 606, -639, 604, -640, 607, -1716, 606, -643, 606, -639, 604, -1720, 607, -1716, 606, -1723, 606, -641, 606, -638, 604, -639, 605, -1725, 629, -3382, 737]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "23"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
- platform: remote_receiver
id: low_24
raw:
code: [735, -3399, 608, -639, 605, -639, 607, -637, 607, -642, 608, -638, 603, -641, 606, -1717, 605, -1724, 608, -639, 602, -641, 605, -639, 606, -643, 606, -639, 604, -640, 606, -638, 604, -645, 606, -643, 602, -639, 607, -637, 606, -642, 607, -640, 605, -639, 605, -638, 608, -640, 604, -643, 605, -639, 606, -638, 603, -646, 605, -640, 605, -642, 634, -607, 606, -643, 604, -642, 605, -639, 608, -638, 603, -644, 603, -643, 605, -639, 605, -1718, 608, -641, 607, -639, 606, -638, 605, -1718, 604, -646, 606, -1719, 606, -639, 604, -641, 605, -643, 605, -641, 604, -640, 607, -636, 606, -643, 633, -3380, 737]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "24"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
- platform: remote_receiver
id: low_25
raw:
code: [737, -3399, 607, -640, 608, -636, 605, -642, 601, -645, 607, -638, 607, -638, 606, -1717, 609, -1720, 608, -638, 606, -639, 604, -640, 605, -643, 605, -641, 604, -640, 604, -641, 608, -640, 607, -638, 611, -633, 606, -638, 607, -642, 606, -641, 606, -637, 606, -637, 609, -642, 605, -640, 606, -638, 607, -637, 603, -645, 608, -638, 605, -639, 606, -638, 604, -644, 607, -639, 606, -639, 606, -638, 605, -643, 611, -635, 606, -638, 607, -1716, 605, -645, 605, -640, 606, -640, 606, -1715, 606, -643, 606, -1719, 607, -639, 603, -640, 608, -1720, 605, -1720, 610, -1715, 605, -1718, 609, -1720, 630, -3382, 738]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "25"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
- platform: remote_receiver
id: low_26
raw:
code: [735, -3401, 611, -638, 605, -636, 606, -638, 606, -646, 602, -641, 605, -639, 604, -1719, 608, -1723, 605, -640, 605, -638, 607, -637, 604, -645, 605, -641, 607, -638, 607, -636, 605, -644, 604, -643, 606, -637, 607, -637, 604, -645, 606, -640, 603, -641, 607, -637, 606, -643, 607, -639, 607, -636, 605, -640, 605, -644, 605, -641, 608, -636, 606, -638, 611, -637, 607, -640, 606, -638, 607, -637, 606, -643, 607, -638, 608, -638, 604, -1717, 607, -644, 607, -638, 606, -638, 607, -1717, 607, -643, 605, -1720, 608, -636, 606, -1718, 609, -640, 606, -1720, 608, -1716, 606, -1718, 608, -641, 634, -3379, 741]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "26"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
- platform: remote_receiver
# name: "Heran_auto_27"
id: low_27
raw:
code: [736, -3399, 608, -639, 605, -639, 606, -638, 602, -647, 604, -643, 604, -638, 606, -1719, 605, -1722, 605, -644, 603, -637, 604, -640, 605, -644, 607, -638, 608, -638, 605, -637, 604, -645, 607, -639, 604, -639, 605, -639, 606, -643, 605, -640, 605, -639, 605, -639, 605, -643, 606, -640, 609, -635, 605, -639, 604, -644, 605, -643, 602, -640, 607, -637, 606, -642, 580, -666, 608, -636, 605, -639, 606, -642, 607, -639, 605, -639, 605, -1718, 605, -644, 608, -638, 606, -638, 604, -1718, 608, -641, 609, -1717, 605, -639, 607, -1716, 607, -1724, 603, -1720, 606, -1717, 609, -636, 605, -1723, 631, -3384, 733]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "27"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
- platform: remote_receiver
# name: "Heran_auto_28"
id: low_28
raw:
code: [740, -3397, 609, -638, 606, -639, 605, -639, 608, -641, 606, -640, 608, -636, 607, -1717, 605, -1725, 604, -640, 610, -635, 608, -636, 608, -640, 606, -640, 605, -639, 605, -639, 605, -644, 606, -639, 607, -637, 609, -636, 605, -644, 607, -638, 607, -637, 607, -637, 606, -643, 608, -639, 607, -636, 604, -640, 605, -643, 606, -640, 605, -640, 607, -636, 606, -643, 606, -640, 604, -639, 608, -637, 606, -642, 605, -641, 607, -637, 606, -1717, 606, -644, 605, -641, 605, -638, 610, -1713, 605, -645, 605, -1720, 608, -1720, 603, -638, 605, -644, 606, -1719, 607, -1717, 605, -640, 607, -641, 634, -3379, 738]
on_press:
then:
- text_sensor.template.publish:
id: room_heran_temp
state: "28"
- text_sensor.template.publish:
id: room_heran_mode
state: "low"
常用的放進去也會有二三十個,全部expose到HA再去做自動化想到就頭痛,仔細研究了一下ESPhome發現他可以自建sensor,搭配ESPhome的自動化,就可以大大簡化,這邊仔細說明一下我的作法:
- 建立text_sensor Template Text Sensor 這邊我是分別建立溫度和風速
text_sensor:
- platform: version
name: "ESP IR Room Version"
- platform: template
name: "Room Heran Temperature"
id: room_heran_temp
- platform: template
name: "Room Heran mode"
id: room_heran_mode
這邊我有嘗試了一下其他種類的template sensor,但邏輯跟HA不太一樣,可能剛整併還沒做兩邊的同步
-
ESPhome內的binary_sensor只要不打名字改用ID就可以不expose到HA內
-
搭配自動化將訊息帶到text sensor,當按下遙控器,Receiver收到後會將指定的文字訊息pass到text_sensor,其中id要對應到你建立的text_sensor
-
HA內就只剩簡潔的兩個sensor
-
最後只需要將此兩sensor狀態和冷氣的entity做連動就大功告成
最後分享一些整合的心得,起初想直接用這個取代broadlink達成同室設備全部用此模組操作,但帶入坑的朋友提醒IR發射的距離問題不好解,市面上賣的IR開發版模組距離都不夠,實測後包含Wemos此款也一樣,自己兜麻煩又不美觀,但receiver就沒這問題,Wemos此款不帶任何額外電路在receiver上,我的建議是如果已有broadlink在使用,剛好同一個室內空間也有自建ESPhome裝置,可以嘗試整合receiver在該裝置上搭配broadlink做使用效果應該就不錯,後面如果有嘗試出來會再分享給大家。