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

 找回密码
 立即注册
查看: 2294|回复: 23

[经验分享] 用esp8266红外发射器将永速直流风扇接入home assistant

[复制链接]

43

主题

202

帖子

925

积分

高级会员

Rank: 4

积分
925
金钱
723
HASS币
0
发表于 2024-5-16 22:24:27 | 显示全部楼层 |阅读模式
本帖最后由 inevitab 于 2024-5-17 19:53 编辑

最近这个风扇比较火,算是性价比比较高的直流风扇了。 (永速快给我广告费)

屏幕截图 2024-05-16 221952.png

注意,本文是用外部红外发射器将带遥控功能的永速直流风扇接入HA,而不是给机械版的永速直流风扇加装遥控功能,也不是改动内部电路直接接入HA。


硬件:
我使用这个esp8266+红外模块,购买地址 https://item.taobao.com/item.htm?id=763731464447

屏幕截图 2024-05-16 205408.png

你可以使用任何esp8266/esp32模块加红外模块自行组装。
如果使用其他模块,请自行修改代码里的引脚设置。

home assistant 截图:
屏幕截图 2024-05-16 205638.png

支持原遥控器所有按键。

esphome代码:


esphome:
  name: esphome-yongsu
  friendly_name: ESPHome_YongSu
  on_boot:
    priority: 249
    then:
      - light.turn_on: status_led1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "dxmLMeeu4TQLv/rYQ89rau6/FUMDctYplFHwpOz7vvc="
  reboot_timeout: 0s
  on_client_connected:
    - light.turn_on: status_led1
  on_client_disconnected:
    - light.turn_off: status_led1

ota:
  password: "abb3cf27762459f2a35f9af83d483e81"

wifi:
  ssid: "12345678"
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "esphome_yongsu"
    password: ""

captive_portal:
    
# 让设备开启网页功能
web_server:
  port: 80

output:
  - platform: gpio
    id: led1
    pin:
      number: GPIO2
      inverted: True

light:
  - platform: status_led
    id: status_led1
    output: led1
    internal: True

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

remote_transmitter:
  pin: GPIO4
  carrier_duty_percent: 50%

button:

  # 风扇加档
  - platform: template
    name: "Speed Up"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz

  # 风扇减档
  - platform: template
    name: "Speed Down"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz

  # 风扇定时
  - platform: template
    name: "Timer"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1352, -371, 1349, -401, 477, -1256, 1318, -430, 1292, -430, 450, -1279, 449, -1274, 449, -1274, 449, -1275, 1292, -430, 449, -1274, 449, -7964, 1291, -431, 1292, -430, 449, -1283, 1291, -433, 1290, -430, 449, -1279, 448, -1275, 449, -1274, 449, -1275, 1291, -430, 450, -1274, 448, -7965, 1292, -430, 1292, -431, 449, -1282, 1292, -431, 1291, -431, 449, -1279, 449, -1273, 449, -1275, 449, -1274, 1292, -430, 449, -1274, 449, -7965, 1292, -431, 1291, -431, 449, -1283, 1291, -434, 1289, -430, 450, -1278, 449, -1275, 448, -1275, 449, -1274, 1291, -431, 449, -1275, 448, -7966, 1291, -432, 1295, -426, 449, -1284, 1291, -431, 1291, -431, 448, -1280, 448, -1274, 449, -1275, 449, -1274, 1291, -431, 451, -1273, 448]
          carrier_frequency: 38kHz

  # 风扇摇头
  - platform: template
    name: "Oscillation"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -371, 1352, -397, 482, -1251, 1320, -406, 1317, -433, 445, -1255, 474, -1249, 474, -1274, 1292, -430, 450, -1273, 450, -1250, 473, -7964, 1292, -407, 1316, -430, 450, -1283, 1292, -430, 1293, -430, 449, -1279, 450, -1274, 449, -1277, 1289, -430, 450, -1274, 449, -1274, 450, -7966, 1291, -431, 1292, -430, 450, -1283, 1292, -430, 1292, -430, 449, -1280, 449, -1274, 449, -1274, 1293, -429, 450, -1274, 449, -1275, 449, -7966, 1292, -430, 1292, -431, 449, -1282, 1293, -430, 1292, -431, 449, -1279, 449, -1274, 449, -1275, 1291, -430, 450, -1274, 449, -1274, 451, -7965, 1291, -431, 1291, -431, 449, -1283, 1291, -433, 1290, -431, 449, -1279, 448, -1275, 449, -1275, 1292, -430, 449, -1275, 449, -1275, 450]
          carrier_frequency: 38kHz

  # 风扇待机
  - platform: template
    name: "Standby"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1350, -372, 1351, -397, 483, -1252, 1318, -406, 1317, -405, 475, -1253, 475, -1248, 475, -1249, 475, -1248, 475, -1249, 1318, -404, 475, -7938, 1317, -406, 1317, -405, 475, -1257, 1318, -405, 1318, -404, 475, -1253, 475, -1248, 475, -1249, 475, -1248, 475, -1253, 1314, -404, 475, -7941, 1317, -405, 1318, -405, 474, -1257, 1318, -405, 1317, -405, 475, -1253, 474, -1249, 475, -1248, 474, -1250, 474, -1249, 1318, -404, 475, -7940, 1316, -431, 1292, -406, 474, -1258, 1317, -406, 1317, -405, 474, -1254, 475, -1249, 474, -1249, 474, -1249, 475, -1249, 1317, -405, 474, -7942, 1317, -406, 1317, -405, 474, -1258, 1317, -406, 1317, -406, 474, -1254, 474, -1249, 474, -1249, 475, -1251, 472, -1250, 1317, -406, 473]
          carrier_frequency: 38kHz

  # 风扇1档
  - platform: template
    name: "Speed level 1"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 0
            wait_time: 300ms

  # 风扇2档
  - platform: template
    name: "Speed level 2"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 1
            wait_time: 300ms

  # 风扇3档
  - platform: template
    name: "Speed level 3"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 2
            wait_time: 300ms

  # 风扇4档
  - platform: template
    name: "Speed level 4"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 3
            wait_time: 300ms

  # 风扇5档
  - platform: template
    name: "Speed level 5"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 4
            wait_time: 300ms

  # 风扇6档
  - platform: template
    name: "Speed level 6"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 5
            wait_time: 300ms

  # 风扇7档
  - platform: template
    name: "Speed level 7"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 6
            wait_time: 300ms

  # 风扇8档
  - platform: template
    name: "Speed level 8"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 7
            wait_time: 300ms

  # 风扇9档
  - platform: template
    name: "Speed level 9"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 8
            wait_time: 300ms

  # 风扇10档
  - platform: template
    name: "Speed level 10"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 9
            wait_time: 300ms

  # 风扇11档
  - platform: template
    name: "Speed level 11"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 10
            wait_time: 300ms

  # 风扇12档
  - platform: template
    name: "Speed level 12"
    on_press:
      - remote_transmitter.transmit_raw:
          code: [1351, -372, 1350, -398, 481, -1252, 1320, -405, 1318, -404, 480, -1249, 475, -1248, 1319, -404, 476, -1248, 480, -1244, 475, -1248, 476, -7936, 1318, -405, 1318, -405, 475, -1256, 1318, -405, 1319, -404, 475, -1253, 475, -1249, 1318, -404, 476, -1248, 475, -1248, 476, -1248, 475, -7942, 1318, -405, 1317, -405, 477, -1255, 1318, -405, 1318, -405, 475, -1253, 475, -1249, 1318, -404, 475, -1249, 475, -1249, 475, -1249, 474, -7941, 1318, -406, 1317, -404, 475, -1258, 1318, -404, 1318, -405, 475, -1253, 475, -1249, 1318, -405, 474, -1250, 474, -1249, 475, -1249, 474, -7945, 1313, -407, 1316, -405, 474, -1259, 1316, -406, 1317, -405, 475, -1254, 474, -1250, 1317, -406, 474, -1250, 473, -1250, 474, -1253, 470]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
      - delay: 
          300ms
      - remote_transmitter.transmit_raw:
          code: [1352, -367, 1356, -395, 484, -1249, 1321, -430, 1293, -430, 449, -1278, 451, -1273, 449, -1274, 449, -1274, 451, -1273, 449, -1275, 1292, -7119, 1293, -432, 1291, -430, 450, -1282, 1292, -431, 1292, -430, 450, -1278, 450, -1274, 449, -1274, 449, -1275, 449, -1274, 450, -1274, 1292, -7123, 1292, -431, 1292, -430, 449, -1283, 1293, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1274, 450, -1274, 449, -1274, 450, -1277, 1289, -7122, 1291, -431, 1295, -428, 449, -1283, 1292, -431, 1291, -431, 449, -1279, 449, -1274, 449, -1275, 449, -1275, 448, -1275, 450, -1274, 1292, -7127, 1287, -431, 1291, -431, 449, -1283, 1291, -433, 1291, -431, 450, -1278, 449, -1275, 451, -1273, 448, -1275, 448, -1275, 448, -1277, 1290]
          carrier_frequency: 38kHz
          repeat:
            times: 11
            wait_time: 300ms
            




评分

参与人数 1金钱 +5 收起 理由
pengguilian + 5 大神666!

查看全部评分

回复

使用道具 举报

24

主题

579

帖子

2685

积分

金牌会员

Rank: 6Rank: 6

积分
2685
金钱
2106
HASS币
0
发表于 2024-5-16 23:11:12 | 显示全部楼层
能盲操开关风扇吗?
回复

使用道具 举报

43

主题

202

帖子

925

积分

高级会员

Rank: 4

积分
925
金钱
723
HASS币
0
 楼主| 发表于 2024-5-16 23:51:28 | 显示全部楼层
kjjuhfv 发表于 2024-5-16 23:11
能盲操开关风扇吗?

这个不行
回复

使用道具 举报

51

主题

1340

帖子

5600

积分

论坛DIY达人

积分
5600
金钱
4260
HASS币
20
发表于 2024-5-17 09:10:51 | 显示全部楼层
可惜没有壁挂的,我喜欢壁挂的
回复

使用道具 举报

20

主题

133

帖子

850

积分

高级会员

Rank: 4

积分
850
金钱
717
HASS币
0
发表于 2024-5-17 09:50:21 | 显示全部楼层
,这个方法非常简单,很不错
回复

使用道具 举报

18

主题

278

帖子

2263

积分

金牌会员

Rank: 6Rank: 6

积分
2263
金钱
1985
HASS币
0
发表于 2024-5-17 13:53:04 | 显示全部楼层
红外码是如何获得的?
回复

使用道具 举报

43

主题

202

帖子

925

积分

高级会员

Rank: 4

积分
925
金钱
723
HASS币
0
 楼主| 发表于 2024-5-17 13:55:06 | 显示全部楼层
zhuzhuaini 发表于 2024-5-17 13:53
红外码是如何获得的?

看上面图片的红外模块有红外接收头,再看代码里注释的那几行就是红外抓包的,然后用原版遥控器抓取一下。
回复

使用道具 举报

1

主题

68

帖子

493

积分

中级会员

Rank: 3Rank: 3

积分
493
金钱
425
HASS币
0
发表于 2024-5-17 13:58:47 | 显示全部楼层
厉害!这都会玩。
回复

使用道具 举报

18

主题

278

帖子

2263

积分

金牌会员

Rank: 6Rank: 6

积分
2263
金钱
1985
HASS币
0
发表于 2024-5-17 14:01:11 | 显示全部楼层
inevitab 发表于 2024-5-17 13:55
看上面图片的红外模块有红外接收头,再看代码里注释的那几行就是红外抓包的,然后用原版遥控器抓取一下。 ...

感谢,下单一个试试
回复

使用道具 举报

18

主题

278

帖子

2263

积分

金牌会员

Rank: 6Rank: 6

积分
2263
金钱
1985
HASS币
0
发表于 2024-5-19 22:28:26 | 显示全部楼层
老哥你好 我把学习红外的代码解除注释刷入后,在遥控学习这个服务当中,没有查到这个学习的设备,是需要怎么特殊处理一下吗
1.jpg
2.png
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 10:47 , Processed in 0.099273 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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