Entity registry (#11979)
* Entity#unique_id defaults to None * Initial commit entity registry * Clean up unique_id property * Lint * Add tests to entity component * Lint * Restore some unique ids * Spelling * Remove use of IP address for unique ID * Add tests * Add tests * Fix tests * Add some docs * Add one more test * Fix new test…
This commit is contained in:
parent
8e441ba03b
commit
e51427b284
47 changed files with 471 additions and 230 deletions
|
@ -22,6 +22,7 @@ from homeassistant.const import (
|
|||
STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME, EVENT_TIME_CHANGED,
|
||||
EVENT_STATE_CHANGED, EVENT_PLATFORM_DISCOVERED, ATTR_SERVICE,
|
||||
ATTR_DISCOVERED, SERVER_PORT, EVENT_HOMEASSISTANT_CLOSE)
|
||||
from homeassistant.helpers import entity_component, entity_registry
|
||||
from homeassistant.components import mqtt, recorder
|
||||
from homeassistant.components.http.auth import auth_middleware
|
||||
from homeassistant.components.http.const import (
|
||||
|
@ -315,6 +316,14 @@ def mock_component(hass, component):
|
|||
hass.config.components.add(component)
|
||||
|
||||
|
||||
def mock_registry(hass):
|
||||
"""Mock the Entity Registry."""
|
||||
registry = entity_registry.EntityRegistry(hass)
|
||||
registry.entities = {}
|
||||
hass.data[entity_component.DATA_REGISTRY] = registry
|
||||
return registry
|
||||
|
||||
|
||||
class MockModule(object):
|
||||
"""Representation of a fake module."""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue