Look at registry before pulling zwave config values (#14408)

* Look at registry before deciding on ID for zwave values

* Reuse the new function
This commit is contained in:
Andrey 2018-05-13 00:45:36 +03:00 committed by Paulus Schoutsen
parent 7aec098a05
commit d1228d5cf4
5 changed files with 87 additions and 18 deletions

View file

@ -180,3 +180,13 @@ test.disabled_hass:
assert entry_disabled_hass.disabled_by == entity_registry.DISABLED_HASS
assert entry_disabled_user.disabled
assert entry_disabled_user.disabled_by == entity_registry.DISABLED_USER
@asyncio.coroutine
def test_async_get_entity_id(registry):
"""Test that entity_id is returned."""
entry = registry.async_get_or_create('light', 'hue', '1234')
assert entry.entity_id == 'light.hue_1234'
assert registry.async_get_entity_id(
'light', 'hue', '1234') == 'light.hue_1234'
assert registry.async_get_entity_id('light', 'hue', '123') is None