diff --git a/homeassistant/components/file/__init__.py b/homeassistant/components/file/__init__.py index 9e91aa07103..aa3e241cc81 100644 --- a/homeassistant/components/file/__init__.py +++ b/homeassistant/components/file/__init__.py @@ -2,7 +2,13 @@ from homeassistant.components.notify import migrate_notify_issue from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry -from homeassistant.const import CONF_FILE_PATH, CONF_NAME, CONF_PLATFORM, Platform +from homeassistant.const import ( + CONF_FILE_PATH, + CONF_NAME, + CONF_PLATFORM, + CONF_SCAN_INTERVAL, + Platform, +) from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import ( @@ -63,6 +69,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if item[CONF_PLATFORM] == DOMAIN: file_config_item = IMPORT_SCHEMA[domain](item) file_config_item[CONF_PLATFORM] = domain + if CONF_SCAN_INTERVAL in file_config_item: + del file_config_item[CONF_SCAN_INTERVAL] hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, diff --git a/tests/components/file/test_sensor.py b/tests/components/file/test_sensor.py index d2059f4d564..60a81df2b1e 100644 --- a/tests/components/file/test_sensor.py +++ b/tests/components/file/test_sensor.py @@ -21,6 +21,7 @@ async def test_file_value_yaml_setup( config = { "sensor": { "platform": "file", + "scan_interval": 30, "name": "file1", "file_path": get_fixture_path("file_value.txt", "file"), }