找回密码
 立即注册

微信扫码登录

搜索
查看: 1582|回复: 5

[硬件DIY] CB3S方案涂鸦wifi万能红外盒子刷入esphome

[复制链接]

87

主题

451

回帖

5266

积分

元老级技术达人

积分
5266
金钱
4688
HASS币
230
发表于 2026-4-6 21:17:25 | 显示全部楼层 |阅读模式
本帖最后由 gasment 于 2026-4-6 21:20 编辑

不久前用极联小π更新了一下家里的红外模块
{6588011B-F8D0-4D63-B8EE-D991F6FB4E72}.png
换下来一个能接入涂鸦的wifi版万能红外盒子
image.png
搜了下应该是第三方兼容的不是涂鸦官方的玩意,用的不是esp方案,拆开看是CB3S的模块,CB3S也就是BK72xx系列的芯片 image.png
这玩意esphome也支持,研究了一下,顺利刷上,把板载组件跑通了
image.png
image.png

IO使用情况
{790E2372-1D9C-42C0-9310-283B51EEDC69}.png
详细参考涂鸦文档:CB3S 模组规格书-涂鸦开发者平台-涂鸦开发者

刷机注意事项:
  • 这个模块有两路uart,连接TXD1/RXD1烧录,连接TXD2/RXD1日志输出
  • 板上没有现成的外接焊盘,需要飞线焊接到模块对应引脚
  • 给板子usb供电,TXD1/RXD1/GND分别连接到USB串口工具的RX/TX/GND
  • 如果无法进入下载模式,尝试短接引脚3与GND

esphome yaml配置(我分开为了4个文件,保存到同一目录下然后esphome run main.yaml即可)
主入口main.yaml:
packages:
  - !include network.yaml
  - !include onboard_led.yaml
  - !include ir.yaml
  
esphome:
  name: "cb3s-ir-controler"
  friendly_name: "CB3S红外收发"

bk72xx:
  board: cb3s
  framework:
    version: recommended

logger:
  hardware_uart: UART2
  level: DEBUG

api:

ota:
  - platform: esphome

captive_portal:

web_server:

button:
  - platform: restart  #重启按钮
    name: "Reset Device"
    entity_category: "diagnostic"
    icon: "mdi:restart"
    id: system_reset_bt

sensor:
  - platform: uptime  #运行时间
    type: seconds
    id: uptime_seconds
    internal: true 

text_sensor:
  - platform: version #esphome版本
    id: esphome_ver
    entity_category: "diagnostic"
    name: "ESPHome Ver"
    hide_timestamp: true
    filters:
      - lambda: |-
          auto s = x;
          size_t p = s.find(" (");
          if (p != std::string::npos) s = s.substr(0, p);
            return s;

  - platform: template  #运行时间(模板化)
    id: uptime_format
    name: "Uptime"
    entity_category: diagnostic
    icon: "mdi:clock-start"
    update_interval: 60s
    lambda: |-
      float secs = id(uptime_seconds).state;
      // 如果未初始化或为0,直接返回0d:00h:00m
      if (isnan(secs) || secs < 1.0) {
        return std::string("0d:00h:00m");
      }
      uint32_t total_seconds = (uint32_t)secs;
      uint32_t days = total_seconds / 86400;
      uint32_t hours = (total_seconds % 86400) / 3600;
      uint32_t minutes = (total_seconds % 3600) / 60;
      char buf[32];
      snprintf(buf, sizeof(buf), "%ud:%02uh:%02um", days, hours, minutes);
      return std::string(buf);





网路相关配置
network.yaml:
wifi:
  ssid: #你的wifi名
  password:  #你的wifi密码
  use_address: cb3s-ir-controler.local
  ap:
    ssid: "CB3S Fallback"
    password: "12345678"



sensor:
  - platform: wifi_signal  #wifi信号
    id: wifi_signal_value
    name: "WIFI Signal"
    icon: "mdi:wifi"
    update_interval: 60s
    entity_category: "diagnostic"


text_sensor:

  - platform: wifi_info  #>wifi信息
    ip_address:
      entity_category: "diagnostic"
      name: "IP"
      icon: "mdi:ip"
      id: wifi_ip
    ssid:
      id: wifi_ssid
      internal: true
      on_value:
        then:
          - component.update: wifi_ap_template_sensor
    bssid:
      id: wifi_bssid
      internal: true
      on_value:
        then:
          - component.update: wifi_ap_template_sensor
      
  - platform: template  #>wifi信息(模板化)
    name: "WIFI AP"
    entity_category: "diagnostic"
    icon: "mdi:wifi-marker"
    id: wifi_ap_template_sensor
    lambda: |-
      if (id(wifi_ssid).state.empty() || id(wifi_bssid).state.empty()) {
        return {"- - -"};
      }
      return (id(wifi_ssid).state + " / " + id(wifi_bssid).state);
    update_interval: 60s
板载LED配置:
onboard_led.yaml
switch:
  - platform: template  #板载LED开关
    name: "SYS LED"
    id: sys_led_enable
    restore_mode: RESTORE_DEFAULT_ON
    entity_category: "config"
    optimistic: true

output:
  - platform: gpio  #板载LED输出
    pin: GPIO8
    id: sys_led

interval:
  - interval: 100ms
    then:
      - lambda: |-  #板载LED闪烁逻辑,wifi未连接快闪,已连接慢闪
          static uint32_t last = 0;
          static int last_wifi_state = -1;
          uint32_t now = millis();

          bool wifi = wifi::global_wifi_component->is_connected();
          bool en = id(sys_led_enable).state;
          bool should_be_on = false;

          if (!wifi) {
            should_be_on = ((now / 200) % 2) == 0;
          }
          else if (en) {
            uint32_t t = now % 1800;
            should_be_on = (t < 1000);
          }

          id(sys_led).set_state(should_be_on);

红外收发配置,仅简单测试配置,需要红外码学习录入功能的可以看下其他esphome红外模块帖子
ir.yaml

########红外收发部分####################################################################

remote_receiver:
  - id: IR_receiver
    pin:
      number: GPIO7
      inverted: True
    dump: all

remote_transmitter:
  pin: GPIO26
  carrier_duty_percent: 50%



button:  #测试按钮
  - platform: template
    name: "AC-POWER-TEST"
    on_press:
      - remote_transmitter.transmit_toshiba_ac:
          rc_code_1: 0xB24DBF40906F
          rc_code_2: 0xD5660000003B
  
PS:
空闲IO应该也可以接其他传感器用,未做尝试


✅以上


评分

参与人数 1金钱 +20 收起 理由
sorrypqa + 20 感谢楼主分享!

查看全部评分

全网同名,只发干货
回复

使用道具 举报

31

主题

166

回帖

2711

积分

金牌会员

积分
2711
金钱
2514
HASS币
0
发表于 2026-4-7 09:30:32 | 显示全部楼层
极联小π旁边接的啥?
回复

使用道具 举报

7

主题

204

回帖

1746

积分

金牌会员

积分
1746
金钱
1535
HASS币
0
发表于 2026-4-7 09:52:37 | 显示全部楼层
盲猜 人在雷达
回复

使用道具 举报

87

主题

451

回帖

5266

积分

元老级技术达人

积分
5266
金钱
4688
HASS币
230
 楼主| 发表于 2026-4-7 12:31:05 | 显示全部楼层
qiaofei828 发表于 2026-4-7 09:30
极联小π旁边接的啥?

温湿度+光照
全网同名,只发干货
回复

使用道具 举报

2

主题

125

回帖

1128

积分

金牌会员

积分
1128
金钱
1001
HASS币
0
发表于 2026-4-25 23:32:26 | 显示全部楼层

不知道这个芯片,加了温湿度,光照!还能不能加个LD2420雷达
回复

使用道具 举报

87

主题

451

回帖

5266

积分

元老级技术达人

积分
5266
金钱
4688
HASS币
230
 楼主| 发表于 2026-4-25 23:48:57 | 显示全部楼层
kmart 发表于 2026-4-25 23:32
不知道这个芯片,加了温湿度,光照!还能不能加个LD2420雷达

应该都可以,不过内存有点小,加太多组件怕崩溃
全网同名,只发干货
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )|网站地图

GMT+8, 2026-11-15 13:55 , Processed in 0.014299 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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