From dde70c95a46974562e982c780557df176eec993f Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Thu, 31 Oct 2019 20:09:57 +0100 Subject: [PATCH] Allow TimePeriod for time_period_str_unit (#815) --- esphome/config_validation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/config_validation.py b/esphome/config_validation.py index 405d695b51..956779f655 100644 --- a/esphome/config_validation.py +++ b/esphome/config_validation.py @@ -461,6 +461,8 @@ def time_period_str_unit(value): if isinstance(value, int): raise Invalid("Don't know what '{0}' means as it has no time *unit*! Did you mean " "'{0}s'?".format(value)) + if isinstance(value, TimePeriod): + value = str(value) if not isinstance(value, string_types): raise Invalid("Expected string for time period with unit.")