[remote_receiver] Add better error message for tolerance breaking change (#6784)

This commit is contained in:
Jesse Hills 2024-05-21 10:53:16 +12:00
parent efde677ca9
commit cd0f557940
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 8 additions and 1 deletions

View file

@ -63,7 +63,13 @@ def validate_tolerance(value):
if "%" in str(value):
type_ = TYPE_PERCENTAGE
else:
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(
{

View file

@ -3,6 +3,7 @@ remote_receiver:
pin: ${pin}
rmt_channel: ${rmt_channel}
dump: all
tolerance: 25%
on_abbwelcome:
then:
- logger.log: