mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Allow TimePeriod for time_period_str_unit (#815)
This commit is contained in:
parent
09d1846261
commit
dde70c95a4
1 changed files with 2 additions and 0 deletions
|
@ -461,6 +461,8 @@ def time_period_str_unit(value):
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
raise Invalid("Don't know what '{0}' means as it has no time *unit*! Did you mean "
|
raise Invalid("Don't know what '{0}' means as it has no time *unit*! Did you mean "
|
||||||
"'{0}s'?".format(value))
|
"'{0}s'?".format(value))
|
||||||
|
if isinstance(value, TimePeriod):
|
||||||
|
value = str(value)
|
||||||
if not isinstance(value, string_types):
|
if not isinstance(value, string_types):
|
||||||
raise Invalid("Expected string for time period with unit.")
|
raise Invalid("Expected string for time period with unit.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue