Allow zero purge_interval to disable recorder purge (#12220)

pull/12146/merge
Anders Melchiorsen 2018-02-08 07:59:09 +01:00 committed by Paulus Schoutsen
parent aa9b5e6ea5
commit 945606238c
1 changed files with 3 additions and 3 deletions

View File

@ -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: