1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Use the ESPHome object_id to suggest the entity id (#95852)

This commit is contained in:
J. Nick Koston
2023-07-10 01:02:34 -10:00
committed by GitHub
parent 87f284c7e9
commit 7dc03ef301
16 changed files with 232 additions and 196 deletions

View File

@@ -40,14 +40,14 @@ async def test_lock_entity_no_open(
user_service=user_service,
states=states,
)
state = hass.states.get("lock.test_my_lock")
state = hass.states.get("lock.test_mylock")
assert state is not None
assert state.state == STATE_UNLOCKING
await hass.services.async_call(
LOCK_DOMAIN,
SERVICE_LOCK,
{ATTR_ENTITY_ID: "lock.test_my_lock"},
{ATTR_ENTITY_ID: "lock.test_mylock"},
blocking=True,
)
mock_client.lock_command.assert_has_calls([call(1, LockCommand.LOCK)])
@@ -74,7 +74,7 @@ async def test_lock_entity_start_locked(
user_service=user_service,
states=states,
)
state = hass.states.get("lock.test_my_lock")
state = hass.states.get("lock.test_mylock")
assert state is not None
assert state.state == STATE_LOCKED
@@ -101,14 +101,14 @@ async def test_lock_entity_supports_open(
user_service=user_service,
states=states,
)
state = hass.states.get("lock.test_my_lock")
state = hass.states.get("lock.test_mylock")
assert state is not None
assert state.state == STATE_LOCKING
await hass.services.async_call(
LOCK_DOMAIN,
SERVICE_LOCK,
{ATTR_ENTITY_ID: "lock.test_my_lock"},
{ATTR_ENTITY_ID: "lock.test_mylock"},
blocking=True,
)
mock_client.lock_command.assert_has_calls([call(1, LockCommand.LOCK)])
@@ -117,7 +117,7 @@ async def test_lock_entity_supports_open(
await hass.services.async_call(
LOCK_DOMAIN,
SERVICE_UNLOCK,
{ATTR_ENTITY_ID: "lock.test_my_lock"},
{ATTR_ENTITY_ID: "lock.test_mylock"},
blocking=True,
)
mock_client.lock_command.assert_has_calls([call(1, LockCommand.UNLOCK, None)])
@@ -126,7 +126,7 @@ async def test_lock_entity_supports_open(
await hass.services.async_call(
LOCK_DOMAIN,
SERVICE_OPEN,
{ATTR_ENTITY_ID: "lock.test_my_lock"},
{ATTR_ENTITY_ID: "lock.test_mylock"},
blocking=True,
)
mock_client.lock_command.assert_has_calls([call(1, LockCommand.OPEN)])