From 945606238c12ff957fa5c52aae6a1c3ab1819c04 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Thu, 8 Feb 2018 07:59:09 +0100 Subject: [PATCH] Allow zero purge_interval to disable recorder purge (#12220) --- homeassistant/components/recorder/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index db208dada4f..b2628f954fc 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -79,7 +79,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_PURGE_KEEP_DAYS): vol.All(vol.Coerce(int), vol.Range(min=1)), vol.Optional(CONF_PURGE_INTERVAL, default=1): - vol.All(vol.Coerce(int), vol.Range(min=1)), + vol.All(vol.Coerce(int), vol.Range(min=0)), vol.Optional(CONF_DB_URL): cv.string, }) }, extra=vol.ALLOW_EXTRA) @@ -122,11 +122,11 @@ def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: keep_days = conf.get(CONF_PURGE_KEEP_DAYS) purge_interval = conf.get(CONF_PURGE_INTERVAL) - if keep_days is None: + if keep_days is None and purge_interval != 0: _LOGGER.warning( "From version 0.64.0 the 'recorder' component will by default " "purge data older than 10 days. To keep data longer you must " - "configure a 'purge_keep_days' value.") + "configure 'purge_keep_days' or 'purge_interval'.") db_url = conf.get(CONF_DB_URL, None) if not db_url: