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

 找回密码
 立即注册
查看: 7362|回复: 9

[求助] 请教 利用esphome 实现uart透传功能

[复制链接]

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
发表于 2020-10-23 09:55:28 | 显示全部楼层 |阅读模式
  请教 怎么利用esphome 实现uart透传功能 (利用esp8266 的TX RX )来传数据到   mqtt,然后用nodered 来实现自动化,爬了几天没有爬出来。

零星的资料类似这种:这个是接收
remote_receiver:
  pin:
    number: GPIO14
    inverted: True
  dump: all
  on_rec:
    then:
    - mqtt.publish:
        topic: 0/a/b/c/rec
        payload: !lambda |-
          char temp[20];
          sprintf(temp, "%d:%d", x.address, x.command);
          ESP_LOGI("main", "rec: %s", temp);
          return temp;






回复

使用道具 举报

6

主题

243

帖子

1864

积分

金牌会员

Rank: 6Rank: 6

积分
1864
金钱
1621
HASS币
0
发表于 2020-10-23 10:17:48 | 显示全部楼层
不错 学习了
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

发表于 2020-10-23 16:05:37 | 显示全部楼层
如果只是透传,没必要非用esphome吧?好几个现成的固件都可以做到,比如tasmota啥的。

如果非要用esphome的话,应该也可以做到——我自己没这么弄过,纸上谈兵说点子思路哈~~

1、编程,也就是esphome下面的custom

2、esphome的自动化

可能用得到的文档:
https://esphome.io/components/mqtt.html
https://esphome.io/components/uart.html
https://esphome.io/custom/uart.html
https://esphome.io/components/text_sensor/uart.html
回复

使用道具 举报

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
 楼主| 发表于 2020-10-23 17:57:11 | 显示全部楼层
XCray 发表于 2020-10-23 16:05
如果只是透传,没必要非用esphome吧?好几个现成的固件都可以做到,比如tasmota啥的。

如果非要用esphome ...

收到,谢谢。我试试其他固件。这几个文档反复看了几遍,没有整明白
回复

使用道具 举报

0

主题

5

帖子

80

积分

注册会员

Rank: 2

积分
80
金钱
75
HASS币
0
发表于 2023-3-9 10:56:31 | 显示全部楼层
既然有NODERED可以直接弄成TCP透传,然后在nodered拉一个TCP IN和TCP OUT就可以了
回复

使用道具 举报

23

主题

243

帖子

2319

积分

金牌会员

Rank: 6Rank: 6

积分
2319
金钱
2076
HASS币
0
发表于 2023-3-9 12:27:15 来自手机 | 显示全部楼层
试试这个
external_components:
  - source: github://oxan/esphome-stream-server



uart:
   id: uart_bus
   # add further configuration for the UART here

stream_server:
   uart_id: uart_bus
   port: 1234
回复

使用道具 举报

59

主题

673

帖子

4289

积分

论坛元老

Rank: 8Rank: 8

积分
4289
金钱
3611
HASS币
20
发表于 2023-3-16 09:24:34 | 显示全部楼层
bhc1365 发表于 2023-3-9 12:27
试试这个
external_components:
  - source: github://oxan/esphome-stream-server

老哥这个是esphome吗 可以放下完成配置吗
回复

使用道具 举报

4

主题

34

帖子

488

积分

论坛分享达人

积分
488
金钱
454
HASS币
0
QQ
发表于 2024-1-26 11:47:27 | 显示全部楼层
XCray 发表于 2020-10-23 16:05
如果只是透传,没必要非用esphome吧?好几个现成的固件都可以做到,比如tasmota啥的。

如果非要用esphome ...

tasmota透传该怎么操作啊?官方文档我看不明白,求指教
回复

使用道具 举报

34

主题

312

帖子

1452

积分

金牌会员

Rank: 6Rank: 6

积分
1452
金钱
1140
HASS币
0
发表于 2024-5-22 22:35:25 | 显示全部楼层
bhc1365 发表于 2023-3-9 12:27
试试这个
external_components:
  - source: github://oxan/esphome-stream-server

这个不知道怎么回事,编译的时候报错
回复

使用道具 举报

34

主题

312

帖子

1452

积分

金牌会员

Rank: 6Rank: 6

积分
1452
金钱
1140
HASS币
0
发表于 2024-5-22 22:37:13 | 显示全部楼层
bhc1365 发表于 2023-3-9 12:27
试试这个
external_components:
  - source: github://oxan/esphome-stream-server
Compiling .pioenvs/p1test/src/main.cpp.o
Linking .pioenvs/p1test/firmware.elf
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent11on_shutdownEv':
stream_server.cpp:(.text._ZN21StreamServerComponent11on_shutdownEv+0x0): multiple definition of `_ZN21StreamServerComponent11on_shutdownEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent11on_shutdownEv+0x0): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent11dump_configEv':
stream_server.cpp:(.text._ZN21StreamServerComponent11dump_configEv+0x1c): multiple definition of `_ZN21StreamServerComponent11dump_configEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent11dump_configEv+0x1c): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent14publish_sensorEv':
stream_server.cpp:(.text._ZN21StreamServerComponent14publish_sensorEv+0x0): multiple definition of `_ZN21StreamServerComponent14publish_sensorEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent14publish_sensorEv+0x0): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent4readEv':
stream_server.cpp:(.text._ZN21StreamServerComponent4readEv+0x14): multiple definition of `_ZN21StreamServerComponent4readEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent4readEv+0x14): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent5flushEv':
stream_server.cpp:(.text._ZN21StreamServerComponent5flushEv+0x24): multiple definition of `_ZN21StreamServerComponent5flushEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent5flushEv+0x24): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent5writeEv':
stream_server.cpp:(.text._ZN21StreamServerComponent5writeEv+0x24): multiple definition of `_ZN21StreamServerComponent5writeEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent5writeEv+0x24): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj':
stream_server.cpp:(.text._ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj+0x4): multiple definition of `_ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj+0x4): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj':
stream_server.cpp:(.text._ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj+0x4): multiple definition of `_ZN21StreamServerComponent6ClientC1ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent6ClientC2ESt10unique_ptrIN7esphome6socket6SocketESt14default_deleteIS4_EENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj+0x4): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent5setupEv':
stream_server.cpp:(.text._ZN21StreamServerComponent5setupEv+0x24): multiple definition of `_ZN21StreamServerComponent5setupEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent5setupEv+0x24): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent6acceptEv':
stream_server.cpp:(.text._ZN21StreamServerComponent6acceptEv+0x28): multiple definition of `_ZN21StreamServerComponent6acceptEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent6acceptEv+0x28): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent7cleanupEv':
stream_server.cpp:(.text._ZN21StreamServerComponent7cleanupEv+0x14): multiple definition of `_ZN21StreamServerComponent7cleanupEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent7cleanupEv+0x14): first defined here
/config/.esphome/platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: .pioenvs/p1test/src/stream_server.cpp.o: in function `_ZN21StreamServerComponent4loopEv':
stream_server.cpp:(.text._ZN21StreamServerComponent4loopEv+0x14): multiple definition of `_ZN21StreamServerComponent4loopEv'; .pioenvs/p1test/src/esphome/components/stream_server/stream_server.cpp.o:stream_server.cpp:(.text._ZN21StreamServerComponent4loopEv+0x14): first defined here
collect2: error: ld returned 1 exit status
*** [.pioenvs/p1test/firmware.elf] Error 1
========================= [FAILED] Took 10.03 seconds =========================
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-23 13:27 , Processed in 0.204105 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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