Hi.
I have a strange issue with my setup. I try to connect two components via RS232 to an ESP32 ( a reader on GPIO1 and GPIO3 and a scale on GPIO17 and GPIO16 ). So far so good. The reader on GPIO01/03 works fine. When I send a text to the RS232 that is connected to 16/17, the input is not shown on the sensor scale, instead it is shown on reader. In other words all inputs on both rx pins are shown in reader.
I have checked that I use different references in my code. For me it looks perfect. I even tried two different components. Same behavior. Any ideas?
I have none. Do I need to tell ESPHOME which Hardware UART to use?
Thanks for the help!
My YAML:
esphome:
name: reader
includes:
- reader.h
- scale.h
esp32:
board: esp32dev
framework:
type: arduino
web_server:
port: 80
include_internal: true
mqtt:
broker: 192.168.10.115
port: 1883
birth_message:
topic: "abc"
payload: "reader online"
# Enable logging
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
api:
uart:
- id: reader_uart
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 57600
- id: scale_uart
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 57600
ota:
password: "XXX"
text_sensor:
- platform: custom
lambda: |-
auto reader_sensor = new readerComponent (id(reader_uart));
App.register_component(reader_sensor);
return {reader_sensor};
text_sensors:
id: "reader"
on_value:
then:
- mqtt.publish:
topic: "tag"
payload: !lambda |-
return x.c_str();
- platform: custom
lambda: |-
auto scale_sensor = new scaleComponent(id(scale_uart));
App.register_component(scale_sensor);
return {scale_sensor};
text_sensors:
id: "scale"
on_value:
then:
- mqtt.publish:
topic: "scale"
payload: !lambda |-
return x.c_str();
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: 192.168.10.127
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Reader Fallback Hotspot"
password: "z9n8b9xqwals"
captive_portal:
My scale.h:
#include "esphome.h"
class scaleComponent : public Component, public UARTDevice, public TextSensor {
public:
scaleComponent (UARTComponent *parent) : UARTDevice(parent) {}
[...]
My reader.h:
#include "esphome.h"
class readerComponent : public Component, public UARTDevice, public TextSensor {
public:
readerComponent (UARTComponent *parent) : UARTDevice(parent) {}
[...]