Add the ability to reload filesize platforms from yaml (#39347)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-08-27 23:53:27 -05:00
1 parent 0db5bb27a8
commit f449620d38
5 files changed
+64 -1

No files matched your search

@@ -1 +1,4 @@
"""The filesize component."""
DOMAIN = "filesize"
PLATFORMS = ["sensor"]
@@ -9,6 +9,9 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import DATA_MEGABYTES
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.reload import setup_reload_service
from . import DOMAIN, PLATFORMS
_LOGGER = logging.getLogger(__name__)
@@ -23,6 +26,9 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the file size sensor."""
setup_reload_service(hass, DOMAIN, PLATFORMS)
sensors = []
for path in config.get(CONF_FILE_PATHS):
if not hass.config.is_allowed_path(path):
@@ -0,0 +1,2 @@
reload:
description: Reload all filesize entities.