1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

HassIO -> dashboard

This commit is contained in:
Otto Winter
2018-05-27 14:15:24 +02:00
parent 2e7d8540fb
commit 93d962dd43
15 changed files with 79 additions and 57 deletions

View File

@@ -461,6 +461,12 @@ hex_uint32_t = vol.All(hex_int, vol.Range(min=0, max=4294967295))
i2c_address = hex_uint8_t
def percentage(value):
if isinstance(value, (str, unicode)) and value.endswith('%'):
value = float(value[:-1].rstrip()) / 100.0
return zero_to_one_float(value)
def invalid(message):
def validator(value):
raise vol.Invalid(message)