From 864c5d89085876432ac8e466709a92c513a3a7c9 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.")