diff --git a/esphome/components/remote_receiver/__init__.py b/esphome/components/remote_receiver/__init__.py index 6fe20153f4..e5085bb33c 100644 --- a/esphome/components/remote_receiver/__init__.py +++ b/esphome/components/remote_receiver/__init__.py @@ -63,7 +63,13 @@ def validate_tolerance(value): if "%" in str(value): type_ = TYPE_PERCENTAGE else: - type_ = TYPE_TIME + try: + cv.positive_time_period_microseconds(value) + type_ = TYPE_TIME + except cv.Invalid as exc: + raise cv.Invalid( + "Tolerance must be a percentage or time. Configurations made before 2024.5.0 treated the value as a percentage." + ) from exc return TOLERANCE_SCHEMA( { diff --git a/tests/components/remote_receiver/esp32-common.yaml b/tests/components/remote_receiver/esp32-common.yaml index c2b5a2cf19..c3987f8cd9 100644 --- a/tests/components/remote_receiver/esp32-common.yaml +++ b/tests/components/remote_receiver/esp32-common.yaml @@ -3,6 +3,7 @@ remote_receiver: pin: ${pin} rmt_channel: ${rmt_channel} dump: all + tolerance: 25% on_abbwelcome: then: - logger.log: