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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 232 additions and 196 deletions

View file

@ -54,7 +54,7 @@ async def test_camera_single_image(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
@ -64,9 +64,9 @@ async def test_camera_single_image(
mock_client.request_single_image = _mock_camera_image
client = await hass_client()
resp = await client.get("/api/camera_proxy/camera.test_my_camera")
resp = await client.get("/api/camera_proxy/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
@ -102,15 +102,15 @@ async def test_camera_single_image_unavailable_before_requested(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
await mock_device.mock_disconnect(False)
client = await hass_client()
resp = await client.get("/api/camera_proxy/camera.test_my_camera")
resp = await client.get("/api/camera_proxy/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_UNAVAILABLE
@ -143,7 +143,7 @@ async def test_camera_single_image_unavailable_during_request(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
@ -153,9 +153,9 @@ async def test_camera_single_image_unavailable_during_request(
mock_client.request_single_image = _mock_camera_image
client = await hass_client()
resp = await client.get("/api/camera_proxy/camera.test_my_camera")
resp = await client.get("/api/camera_proxy/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_UNAVAILABLE
@ -188,7 +188,7 @@ async def test_camera_stream(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
remaining_responses = 3
@ -204,9 +204,9 @@ async def test_camera_stream(
mock_client.request_single_image = _mock_camera_image
client = await hass_client()
resp = await client.get("/api/camera_proxy_stream/camera.test_my_camera")
resp = await client.get("/api/camera_proxy_stream/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
@ -248,16 +248,16 @@ async def test_camera_stream_unavailable(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
await mock_device.mock_disconnect(False)
client = await hass_client()
await client.get("/api/camera_proxy_stream/camera.test_my_camera")
await client.get("/api/camera_proxy_stream/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_UNAVAILABLE
@ -288,7 +288,7 @@ async def test_camera_stream_with_disconnection(
user_service=user_service,
states=states,
)
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_IDLE
remaining_responses = 3
@ -306,8 +306,8 @@ async def test_camera_stream_with_disconnection(
mock_client.request_single_image = _mock_camera_image
client = await hass_client()
await client.get("/api/camera_proxy_stream/camera.test_my_camera")
await client.get("/api/camera_proxy_stream/camera.test_mycamera")
await hass.async_block_till_done()
state = hass.states.get("camera.test_my_camera")
state = hass.states.get("camera.test_mycamera")
assert state is not None
assert state.state == STATE_UNAVAILABLE