1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00

Update esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2026-01-14 16:28:26 -10:00
committed by GitHub
parent 66e80fe13b
commit 5b6be2c8d9

View File

@@ -24,7 +24,7 @@ void ModbusTextSensor::parse_and_publish(const std::vector<uint8_t> &data) {
break;
}
case RawEncoding::COMMA: {
// max 5: ","(1) + uint8(3) + null
// max 5: optional ','(1) + uint8(3) + null, for both ",%d" and "%d"
char dec_buf[5];
snprintf(dec_buf, sizeof(dec_buf), index != this->offset ? ",%d" : "%d", b);
output_str += dec_buf;