『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: David_dongye

[硬件DIY] 涂鸦红外遥控器刷ESPHome

[复制链接]

0

主题

122

帖子

518

积分

高级会员

Rank: 4

积分
518
金钱
396
HASS币
0
发表于 2024-3-18 20:18:50 | 显示全部楼层
本帖最后由 summ99111 于 2024-3-18 21:14 编辑
esphome:
  name: tuya-ir-1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "12345678"
ota:
  password: "12345678"

wifi:
  ssid: Xiaomi_60A4
  password: abcD@0808

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "tuya-ir-121"
    password: "12345678"
  manual_ip:
    static_ip: 192.168.31.66   #自己定义的地址
    gateway: 192.168.31.1       #网关
    subnet: 255.255.255.0   

time:
  - platform: homeassistant
    id: timetuya

captive_portal:

mqtt:
  broker: 192.168.31.27
  username: admin
  password: suMIAO44
  discovery: true

remote_receiver:
  pin: 
    number: GPIO5
    inverted: True
    mode: INPUT_PULLUP
  dump: raw
  idle: 40ms

remote_transmitter:
  pin: GPIO14
  carrier_duty_percent: 50%
 
switch:
  - platform: template
    name: "客厅空调"
    id: esp32_ac_swi
    turn_on_action:
      then:
        - switch.template.publish:
            id: esp32_ac_swi
            state: ON
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3252, -1635, 419, -393, 419, -420, 366, -1236, 420, -394, 415, -1211, 416, -396, 393, -420, 419, -402, 418, -1210, 419, -1208, 419, -393, 392, -420, 421, -418, 391, -1215, 413, -1210, 417, -404, 419, -393, 420, -393, 417, -396, 417, -394, 418, -421, 392, -396, 418, -393, 419, -402, 392, -422, 392, -419, 417, -397, 416, -394, 419, -1209, 418, -394, 420, -394, 418, -429, 392, -395, 416, -395, 420, -419, 392, -395, 417, -1212, 419, -391, 418, -396, 418, -402, 419, -419, 394, -1208, 419, -1209, 421, -1206, 419, -1209, 418, -1208, 418, -1211, 416, -1222, 418, -1207, 417, -397, 417, -395, 391, -1236, 417, -397, 418, -393, 419, -392, 421, -401, 418, -395, 416, -395, 419, -393, 420, -419, 393, -1210, 417, -1210, 418, -394, 416, -406, 419, -1210, 416, -394, 420, -393, 416, -396, 418, -1210, 418, -395, 417, -1209, 420, -402, 420, -1208, 418, -394, 391, -421, 419, -394, 418, -394, 392, -446, 392, -395, 419, -402, 391, -448, 391, -395, 390, -422, 417, -396, 419, -396, 415, -395, 417, -395, 418, -404, 415, -397, 417, -395, 421, -392, 417, -394, 417, -396, 420, -395, 417, -393, 390, -431, 417, -396, 394, -420, 415, -396, 416, -396, 418, -395, 417, -395, 417, -396, 417, -403, 417, -394, 419, -394, 417, -397, 417, -395, 418, -395, 418, -395, 416, -395, 419, -403, 414, -398, 416, -397, 417, -395, 416, -399, 414, -396, 418, -1209, 417, -396, 418, -403, 419, -392, 419, -1208, 418, -1211, 419, -1209, 391, -1236, 415, -397, 417, -1210, 418, -395, 419]  #这个code改成自己识别到的raw码
   
    turn_off_action:
      then:
        - switch.template.publish:
            id: esp32_ac_swi
            state: OFF
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3252, -1637, 415, -398, 417, -395, 418, -1210, 391, -422, 415, -1214, 391, -419, 392, -421, 416, -404, 392, -1236, 418, -1209, 420, -394, 419, -392, 417, -396, 404, -1224, 417, -1210, 419, -402, 394, -419, 416, -397, 418, -395, 390, -422, 417, -394, 420, -392, 419, -395, 391, -430, 417, -395, 420, -392, 417, -422, 392, -394, 416, -1212, 416, -396, 420, -394, 417, -402, 418, -395, 419, -394, 446, -366, 420, -392, 419, -1209, 418, -394, 418, -395, 417, -403, 418, -396, 419, -1207, 418, -396, 418, -394, 418, -395, 416, -395, 419, -393, 420, -401, 399, -1230, 420, -392, 420, -1208, 417, -1211, 419, -1207, 420, -1208, 418, -1209, 419, -1210, 416]  #这个code改成自己识别到的raw码             

  - platform: template
    name: "空调强劲风"
    id: esp32_fan_swi
    turn_on_action:
      then:
        - switch.template.publish:
            id: esp32_fan_swi
            state: ON
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3255, -1635, 416, -396, 419, -419, 390, -1238, 391, -396, 418, -1210, 420, -395, 420, -389, 420, -402, 418, -1208, 420, -1207, 422, -418, 391, -420, 392, -395, 403, -1225, 420, -1207, 418, -403, 418, -395, 418, -420, 394, -420, 390, -396, 418, -397, 416, -394, 417, -394, 392, -456, 391, -395, 418, -394, 420, -394, 417, -394, 419, -1209, 418, -394, 392, -421, 419, -402, 417, -396, 416, -396, 421, -391, 419, -394, 419, -1209, 415, -396, 418, -396, 418, -402, 420, -1208, 417, -396, 416, -395, 418, -1210, 417, -1210, 419, -1211, 420, -390, 417, -405, 417, -394, 421, -1220, 379, -1237, 420, -391, 418, -397, 416, -420, 365, -1237, 418, -1210, 416]  #这个code改成自己识别到的raw码
   
    turn_off_action:
      then:
        - switch.template.publish:
            id: esp32_fan_swi
            state: OFF
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3253, -1636, 418, -395, 418, -398, 413, -1211, 421, -392, 417, -1210, 397, -441, 393, -395, 420, -402, 417, -1208, 419, -1209, 418, -396, 418, -394, 416, -397, 416, -1210, 418, -1208, 394, -430, 389, -423, 417, -395, 392, -421, 417, -394, 417, -396, 420, -393, 419, -394, 419, -401, 418, -395, 418, -393, 418, -397, 416, -394, 417, -1210, 419, -395, 415, -397, 417, -405, 419, -392, 419, -394, 393, -444, 390, -398, 417, -1211, 423, -389, 391, -422, 416, -404, 392, -1237, 416, -395, 418, -394, 419, -1210, 416, -1210, 419, -1209, 420, -393, 418, -403, 418, -394, 418, -1210, 418, -1210, 417, -395, 418, -394, 419, -394, 417, -1210, 418, -1210, 419]  #这个code改成自己识别到的raw码             

  - platform: template
    name: "电视盒子"
    id: esp32_box_swi
    turn_on_action:
      then:
        - switch.template.publish:
            id: esp32_box_swi
            state: ON
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [8980, -2292, 547]

    turn_off_action:
      then:
        - switch.template.publish:
            id: esp32_box_swi
            state: OFF
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [9007, -2290, 518] 

  - platform: template
    name: "电视"
    id: esp32_TV_swi
    turn_on_action:
      then:
        - switch.template.publish:
            id: esp32_TV_swi
            state: ON
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3989, -3998, 528, -1997, 526, -1998, 526, -1998, 526, -1998, 527, -991, 525, -993, 527, -1995, 528, -990, 526, -1998, 525, -997, 522, -1997, 526, -994, 525, -990, 527, -992, 527, -990, 526, -992, 526, -1997, 526, -2001, 524, -991, 526, -1999, 525, -993, 525, -1997, 527, -992, 525, -1998, 475, -8949, 3989, -3999, 527, -1998, 525, -1999, 525, -1999, 527, -1996, 526, -992, 526, -992, 526, -1999, 528, -989, 526, -1997, 526, -993, 528, -1996, 527, -994, 524, -991, 528, -989, 528, -990, 528, -989, 530, -1994, 528, -1996, 529, -989, 529, -1995, 529, -989, 529, -1995, 530, -989, 528, -1994, 478, -8947, 4017, -3971, 531, -1993, 531, -1993, 530, -1995, 530, -1994, 531, -987, 530, -987, 530, -1994, 557, -961, 555, -1969, 530, -989, 530, -1992, 531, -988, 530, -987, 534, -984, 531, -987, 556, -961, 556, -1968, 532, -1992, 531, -988, 530, -1993, 532, -987, 530, -1994, 529, -988, 531, -1993, 479]  #这个code改成自己识别到的raw码
   
    turn_off_action:
      then:
        - switch.template.publish:
            id: esp32_TV_swi
            state: OFF
        - remote_transmitter.transmit_raw:
              carrier_frequency: 38kHz
              code: [3991, -3995, 529, -1996, 528, -1996, 525, -1999, 526, -1998, 527, -991, 525, -992, 526, -1997, 527, -991, 527, -1999, 522, -994, 526, -1998, 526, -992, 524, -993, 526, -991, 527, -991, 526, -991, 525, -1999, 526, -1998, 529, -989, 526, -1998, 525, -992, 528, -1996, 526, -992, 525, -1999, 475, -8948, 3990, -3998, 526, -1999, 525, -1999, 525, -1998, 528, -1998, 525, -992, 525, -992, 527, -1997, 526, -992, 530, -1994, 527, -990, 526, -1998, 526, -992, 526, -992, 527, -990, 525, -993, 525, -992, 526, -1998, 527, -1997, 525, -993, 526, -1998, 527, -991, 525, -2000, 525, -992, 526, -1997, 475, -8949, 3991, -3998, 525, -2000, 527, -1999, 524, -1999, 527, -1996, 526, -991, 525, -993, 525, -1999, 526, -992, 527, -1999, 524, -991, 527, -1998, 528, -989, 528, -990, 529, -989, 526, -993, 525, -991, 529, -1996, 526, -1998, 526, -992, 527, -1996, 529, -989, 529, -1994, 530, -989, 529, -1994, 478]  #这个code改成自己识别到的raw码             

  - platform: gpio
    id: signal_light
    pin: GPIO4  #D4
    name: "signal_light"

button:
  - platform: template
    name: "客厅空调加1度"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [3253, -1634, 419, -394, 418, -395, 420, -1207, 420, -393, 420, -1208, 419, -395, 414, -397, 419, -402, 420, -1208, 418, -1209, 423, -391, 390, -421, 419, -393, 421, -1208, 416, -1211, 392, -430, 418, -394, 418, -394, 420, -394, 419, -394, 418, -394, 392, -420, 415, -397, 446, -375, 421, -391, 395, -420, 415, -397, 418, -394, 419, -1210, 419, -392, 418, -395, 392, -429, 420, -393, 418, -394, 418, -395, 418, -394, 420, -1207, 418, -396, 417, -395, 420, -401, 418, -395, 392, -1235, 419, -1209, 420, -1208, 418, -1210, 391, -1237, 391, -1237, 416, -1219, 418, -1210, 420, -392, 419, -395, 394, -1233, 417, -395, 421, -393, 417, -395, 417, -405, 418, -394, 417, -397, 415, -396, 419, -393, 392, -1236, 392, -1236, 418, -394, 394, -427, 417, -396, 393, -420, 418, -394, 418, -395, 393, -1235, 393, -419, 392, -1235, 393, -430, 392, -419, 417, -396, 422, -391, 420, -392, 418, -395, 419, -392, 420, -393, 394, -428, 420, -392, 421, -1207, 393, -421, 416, -396, 417, -395, 392, -421, 420, -392, 418, -403, 417, -396, 393, -421, 416, -394, 420, -393, 391, -422, 416, -395, 420, -394, 419, -402, 391, -421, 420, -393, 418, -394, 419, -395, 419, -393, 392, -420, 393, -419, 398, -424, 392, -421, 417, -395, 392, -420, 417, -396, 418, -395, 417, -395, 419, -393, 393, -429, 416, -396, 391, -423, 418, -394, 414, -397, 393, -421, 418, -1209, 391, -421, 421, -401, 391, -421, 418, -1210, 393, -1235, 419, -1208, 392, -1237, 393, -419, 392, -1236, 420, -393, 417]  #这个code改成自己识别到的raw码
  - platform: template
    name: "客厅空调降1度"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [3285, -1602, 425, -389, 423, -389, 424, -1203, 450, -363, 424, -1203, 426, -387, 428, -385, 448, -373, 424, -1204, 424, -1203, 425, -389, 424, -388, 424, -390, 427, -1199, 425, -1202, 425, -397, 425, -388, 449, -363, 425, -388, 423, -389,425, -388, 426, -386, 450, -363, 448, -372, 450, -363, 450, -363, 449, -363, 424, -389, 449, -1178, 450, -364, 424, -388, 450, -371, 424, -389, 423, -389, 426, -387, 423, -389, 425, -1203, 448, -365, 423, -389, 425, -396, 436, -377, 424, -1203, 424, -1204, 424, -1204, 449, -1178, 429, -1200, 450, -1177, 425, -1211, 425, -1203, 425, -393, 419, -389, 449, -1178, 425, -388, 425, -388, 424, -388, 425, -397, 448, -363, 450, -363, 449, -363, 425, -388, 426, -1202, 425, -1203, 425, -388, 424, -397, 449, -364, 424, -388, 424, -388, 424, -389, 449, -363, 425, -388, 425, -1202, 426, -396, 449, -364, 424, -389, 424, -388, 424, -388, 445, -368, 425, -387, 424, -388, 425, -397, 424, -388, 450, -1178, 450, -363, 449, -363, 449, -364, 449, -364, 449, -363, 450, -371, 454, -358, 450, -363, 448, -365, 448, -364, 450, -362, 425, -388, 450, -362, 425, -397, 449, -364, 425, -388, 424, -388, 449, -362, 434, -379, 452, -361, 425, -388, 448, -373, 448, -365, 424, -388, 425, -388, 424, -388, 426, -386, 451, -363, 423, -389, 449, -371, 450, -363, 450, -363, 449, -364, 424, -388, 425, -388, 448, -1180, 424, -388, 424, -397, 448, -364, 424, -1205, 449, -1178, 425, -1203, 424, -388, 449, -1179, 449, -1179, 425, -388, 425]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子返回"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9017, -2261, 577]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子音量加"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9047, -2232, 582]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子音量减"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9042, -2234, 579]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子静音"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9035, -2264, 495]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子应用"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [8813, -2372, 467]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子下"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9013, -2262, 578]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子上"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9013, -2262, 578]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子左"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9049, -2231, 608]  #这个code改成自己识别到的raw码
  - platform: template
    name: "盒子右"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [9022, -2261, 578]  #这个code改成自己识别到的raw码
  - platform: template
    name: "客厅风向"
    on_press:
      - script.execute: show_light
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [3259, -1631, 392, -421, 418, -394, 419, -1209, 418, -395, 420, -1207, 392, -421, 393, -419, 422, -399, 422, -1206, 418, -1210, 419, -393, 422, -391, 421, -392, 422, -1205, 423, -1204, 424, -398, 419, -393, 423, -390, 423, -389, 423, -390, 424, -389, 422, -390, 423, -389, 423, -402, 418, -392, 423, -389, 422, -391, 422, -391, 422, -1205, 423, -390, 421, -391, 423, -398, 424, -389, 422, -390, 424, -389, 422, -390, 423, -1206, 392, -420, 392, -421, 420, -400, 423, -390, 423, -390, 422, -1205, 393, -1235, 423, -390, 422, -1207, 420, -1206, 423, -398, 423, -1204, 425, -1203, 423, -391, 423, -389, 422, -1205, 423, -390, 421, -391, 423, -1206, 423]  #这个code改成自己识别到的raw码


sensor:
  - platform: wifi_signal
    name: "${device_name}_RSSI"
    update_interval: 60s

text_sensor:
  - platform: wifi_info
    ip_address:
      name: '${device_name}_IP'
    mac_address:
      name: '${device_name}_MAC'

script:
  - id: show_light
    then:
      - switch.turn_on:
          id: signal_light
      - delay: 0.1s
      - switch.turn_off:
          id: signal_light

web_server:
  port: 80

微信截图_20240318211424.png
回复

使用道具 举报

4

主题

55

帖子

1039

积分

金牌会员

Rank: 6Rank: 6

积分
1039
金钱
984
HASS币
20
 楼主| 发表于 2024-3-19 12:43:06 | 显示全部楼层

没看出来有啥问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-28 05:50 , Processed in 0.051393 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表