Assistance in creating new sensor from value in data received from uart

Hi,
currently I have ESPHome with an esp32dev configured to read uart RX with the follow data getting captured.
[08:12:08][D][text_sensor:064]: ‘uart_readline’: Sending state '| Volts = 231.30 | Amps = 0.00 | Watts = 0.00

I was looking to create 3 entities from the data above. One for volts, one for Amps and another one for watts.
Can someone give me an idea on the best way to achieve this?

What config have you got?

There’s a few ways to tackle it depending on how that data is coming in.

uart:
id: uart_bus
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600
stop_bits: 1

debug:
direction: RX
dummy_receiver: true
after:
delimiter: “\n”
sequence:
- lambda: |-
UARTDebug::log_string(direction, bytes);
if(bytes.size() > 49)
id(volts1).publish_state( (float) bytes[0] );
else
ESP_LOGD(“main”, “Response data only had %d bytes!!”, bytes.size() );

sensor:

  • platform: template
    id: “volts1”
    unit_of_measurement: “V”
    name: “volts1”
    accuracy_decimals: 0

Id go ask in the Discord server for this.

I’m having a hard time linking your OP data to your config (especially as your code isn’t formatted, (please figure out how to do that for the future).

Personally I’d probably be looking at the mulcmu approach for this unless you are already competent in cpp.