diff --git a/components/text_sensor/uart.rst b/components/text_sensor/uart.rst index a7d1d3a85d..5a578aa299 100644 --- a/components/text_sensor/uart.rst +++ b/components/text_sensor/uart.rst @@ -49,8 +49,10 @@ With this you can use automations or lambda to set switch or sensor states. void loop() override { const int max_line_length = 80; static char buffer[max_line_length]; - if (available() && readline(read(), buffer, max_line_length) > 0) { - publish_state(buffer); + while (available()) { + if(readline(read(), buffer, max_line_length) > 0) { + publish_state(buffer); + } } } };