Add config validator helper positive_float (#41640)

This commit is contained in:
Matthias Alphart
2020-10-11 22:04:49 +02:00
committed by GitHub
parent 874e1f6103
commit 93a9a11065
19 changed files with 26 additions and 43 deletions

View File

@@ -98,6 +98,7 @@ TIME_PERIOD_ERROR = "offset {} should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS
byte = vol.All(vol.Coerce(int), vol.Range(min=0, max=255))
small_float = vol.All(vol.Coerce(float), vol.Range(min=0, max=1))
positive_int = vol.All(vol.Coerce(int), vol.Range(min=0))
positive_float = vol.All(vol.Coerce(float), vol.Range(min=0))
latitude = vol.All(
vol.Coerce(float), vol.Range(min=-90, max=90), msg="invalid latitude"
)