Hi, I used custom components to read rs232 data from a weighing scale through esp8266 using max232 mini board. By esphome logs I can see the correct continuous serial data, but I cannot display the values as a sensor in homeassistant. my need is to continuously update the homeassistant sensor using the text sensor serial data. Any help is highly appreciated.
esphome:
name: a12e
platform: ESP8266 # Use ESP32 if applicable
board: nodemcuv2 # Adjust this according to your ESP module
includes:
- uart_read_line_sensor.h
wifi:
ssid:
password:
logger:
api:
encryption:
key:
ota:
password:
uart:
id: uart_bus
tx_pin: GPIO15
rx_pin: GPIO13
baud_rate: 9600
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
id: "uart_readline"
By figuring the below configuration the values got exposed in homeassistant.
internal (Optional, boolean): Mark this component as internal. Internal components will not be exposed to the frontend (like Home Assistant). Only specifying an id without a name will implicitly set this to true.
I added the name for the text sensor in the code.
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
name: "Weight Machine"
id: "uart_readline"
Now I’m trying to separate ‘ww’ text from the output.