diff --git a/CODEOWNERS b/CODEOWNERS index b1d81bafa2a..1add37b865c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -147,7 +147,6 @@ homeassistant/components/hikvision/* @mezz64 homeassistant/components/hikvisioncam/* @fbradyirl homeassistant/components/hisense_aehw4a1/* @bannhead homeassistant/components/history/* @home-assistant/core -homeassistant/components/history_graph/* @andrey-git homeassistant/components/hive/* @Rendili @KJonline homeassistant/components/homeassistant/* @home-assistant/core homeassistant/components/homekit_controller/* @Jc2k diff --git a/homeassistant/components/demo/__init__.py b/homeassistant/components/demo/__init__.py index a5b8aa9db7f..3ea05ff6ae8 100644 --- a/homeassistant/components/demo/__init__.py +++ b/homeassistant/components/demo/__init__.py @@ -196,22 +196,6 @@ async def finish_setup(hass, config): switches = sorted(hass.states.async_entity_ids("switch")) lights = sorted(hass.states.async_entity_ids("light")) - # Set up history graph - await bootstrap.async_setup_component( - hass, - "history_graph", - { - "history_graph": { - "switches": { - "name": "Recent Switches", - "entities": switches, - "hours_to_show": 1, - "refresh": 60, - } - } - }, - ) - # Set up scripts await bootstrap.async_setup_component( hass, diff --git a/homeassistant/components/history_graph/__init__.py b/homeassistant/components/history_graph/__init__.py deleted file mode 100644 index e132b1d5d4c..00000000000 --- a/homeassistant/components/history_graph/__init__.py +++ /dev/null @@ -1,84 +0,0 @@ -"""Support to graphs card in the UI.""" -import logging - -import voluptuous as vol - -from homeassistant.const import ATTR_ENTITY_ID, CONF_ENTITIES, CONF_NAME -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity -from homeassistant.helpers.entity_component import EntityComponent - -_LOGGER = logging.getLogger(__name__) - -DOMAIN = "history_graph" - -CONF_HOURS_TO_SHOW = "hours_to_show" -CONF_REFRESH = "refresh" -ATTR_HOURS_TO_SHOW = CONF_HOURS_TO_SHOW -ATTR_REFRESH = CONF_REFRESH - - -GRAPH_SCHEMA = vol.Schema( - { - vol.Required(CONF_ENTITIES): cv.entity_ids, - vol.Optional(CONF_NAME): cv.string, - vol.Optional(CONF_HOURS_TO_SHOW, default=24): vol.Range(min=1), - vol.Optional(CONF_REFRESH, default=0): vol.Range(min=0), - } -) - - -CONFIG_SCHEMA = vol.Schema( - {DOMAIN: cv.schema_with_slug_keys(GRAPH_SCHEMA)}, extra=vol.ALLOW_EXTRA -) - - -async def async_setup(hass, config): - """Load graph configurations.""" - _LOGGER.warning( - "The history_graph integration has been deprecated and is pending for removal " - "in Home Assistant 0.107.0." - ) - - component = EntityComponent(_LOGGER, DOMAIN, hass) - graphs = [] - - for object_id, cfg in config[DOMAIN].items(): - name = cfg.get(CONF_NAME, object_id) - graph = HistoryGraphEntity(name, cfg) - graphs.append(graph) - - await component.async_add_entities(graphs) - - return True - - -class HistoryGraphEntity(Entity): - """Representation of a graph entity.""" - - def __init__(self, name, cfg): - """Initialize the graph.""" - self._name = name - self._hours = cfg[CONF_HOURS_TO_SHOW] - self._refresh = cfg[CONF_REFRESH] - self._entities = cfg[CONF_ENTITIES] - - @property - def should_poll(self): - """No polling needed.""" - return False - - @property - def name(self): - """Return the name of the entity.""" - return self._name - - @property - def state_attributes(self): - """Return the state attributes.""" - attrs = { - ATTR_HOURS_TO_SHOW: self._hours, - ATTR_REFRESH: self._refresh, - ATTR_ENTITY_ID: self._entities, - } - return attrs diff --git a/homeassistant/components/history_graph/manifest.json b/homeassistant/components/history_graph/manifest.json deleted file mode 100644 index e34907d05ce..00000000000 --- a/homeassistant/components/history_graph/manifest.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "domain": "history_graph", - "name": "History Graph", - "documentation": "https://www.home-assistant.io/integrations/history_graph", - "requirements": [], - "dependencies": ["history"], - "codeowners": ["@andrey-git"], - "quality_scale": "internal" -} diff --git a/tests/components/history_graph/__init__.py b/tests/components/history_graph/__init__.py deleted file mode 100644 index 2cb34499938..00000000000 --- a/tests/components/history_graph/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Tests for the history_graph component.""" diff --git a/tests/components/history_graph/test_init.py b/tests/components/history_graph/test_init.py deleted file mode 100644 index ef41f70aaa7..00000000000 --- a/tests/components/history_graph/test_init.py +++ /dev/null @@ -1,37 +0,0 @@ -"""The tests the Graph component.""" - -import unittest - -from homeassistant.setup import setup_component - -from tests.common import get_test_home_assistant, init_recorder_component - - -class TestGraph(unittest.TestCase): - """Test the Google component.""" - - def setUp(self): # pylint: disable=invalid-name - """Set up things to be run when tests are started.""" - self.hass = get_test_home_assistant() - - def tearDown(self): # pylint: disable=invalid-name - """Stop everything that was started.""" - self.hass.stop() - - def test_setup_component(self): - """Test setup component.""" - self.init_recorder() - config = {"history": {}, "history_graph": {"name_1": {"entities": "test.test"}}} - - assert setup_component(self.hass, "history_graph", config) - assert dict(self.hass.states.get("history_graph.name_1").attributes) == { - "entity_id": ["test.test"], - "friendly_name": "name_1", - "hours_to_show": 24, - "refresh": 0, - } - - def init_recorder(self): - """Initialize the recorder.""" - init_recorder_component(self.hass) - self.hass.start()