[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 committed by GitHub
parent bad400e1cd
commit 9de67feccd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

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

View file

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