1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-21 12:42:21 +01:00

Improve one_of validator (#240)

This commit is contained in:
Otto Winter
2018-11-23 13:51:22 +01:00
committed by GitHub
parent b4c4dc8cfb
commit bb9c1faffa
30 changed files with 61 additions and 56 deletions

View File

@@ -37,7 +37,7 @@ def validate_range(value):
value = cv.string(value)
if value.endswith(u'µT') or value.endswith('uT'):
value = value[:-2]
return cv.one_of(*HMC5883L_RANGES)(int(value))
return cv.one_of(*HMC5883L_RANGES, int=True)(value)
SENSOR_KEYS = [CONF_FIELD_STRENGTH_X, CONF_FIELD_STRENGTH_Y, CONF_FIELD_STRENGTH_Z,