diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index 6e665ccd1c2..9226cf7260e 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -9,6 +9,7 @@ import voluptuous as vol from homeassistant.components.camera import PLATFORM_SCHEMA, Camera from homeassistant.const import ATTR_ENTITY_ID, CONF_FILE_PATH, CONF_NAME +from homeassistant.core import ServiceCall from homeassistant.helpers import config_validation as cv from .const import DATA_LOCAL_FILE, DEFAULT_NAME, DOMAIN, SERVICE_UPDATE_FILE_PATH @@ -24,7 +25,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( CAMERA_SERVICE_UPDATE_FILE_PATH = vol.Schema( { - vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids, + vol.Required(ATTR_ENTITY_ID): cv.comp_entity_ids, vol.Required(CONF_FILE_PATH): cv.string, } ) @@ -39,16 +40,15 @@ def setup_platform(hass, config, add_entities, discovery_info=None): camera = LocalFile(config[CONF_NAME], file_path) hass.data[DATA_LOCAL_FILE].append(camera) - def update_file_path_service(call): + def update_file_path_service(call: ServiceCall) -> None: """Update the file path.""" - file_path = call.data.get(CONF_FILE_PATH) - entity_ids = call.data.get(ATTR_ENTITY_ID) + file_path = call.data[CONF_FILE_PATH] + entity_ids = call.data[ATTR_ENTITY_ID] cameras = hass.data[DATA_LOCAL_FILE] for camera in cameras: if camera.entity_id in entity_ids: camera.update_file_path(file_path) - return True hass.services.register( DOMAIN,