Fix Alexa doorbell raises error in state report becase the return status is NO_CONTENT (#182209)

This commit is contained in:
Jan Bouwhuis
2026-09-18 10:26:11 +00:00
committed by Franck Nijhof
parent 437b142d2c
commit 9e82a44719
2 changed files with 9 additions and 4 deletions
@@ -592,7 +592,7 @@ async def async_send_doorbell_event_message(
)
_LOGGER.debug("Received (%s): %s", response.status, response_text)
if response.status == HTTPStatus.ACCEPTED:
if response.status in (HTTPStatus.ACCEPTED, HTTPStatus.NO_CONTENT):
return
response_json = json_loads_object(response_text)
+8 -3
View File
@@ -529,11 +529,14 @@ async def test_send_delete_message(
)
@pytest.mark.parametrize("http_status", [202, 204])
async def test_doorbell_event_binary_sensor(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
http_status: int,
) -> None:
"""Test doorbell press via binary sensor reports."""
aioclient_mock.post(TEST_URL, text="", status=202)
aioclient_mock.post(TEST_URL, text="", status=http_status)
hass.states.async_set(
"binary_sensor.test_doorbell",
@@ -606,15 +609,17 @@ async def test_doorbell_event_binary_sensor(
assert len(aioclient_mock.mock_calls) == 2
@pytest.mark.parametrize("http_status", [202, 204])
async def test_doorbell_event_for_event_entity(
hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker,
freezer: FrozenDateTimeFactory,
caplog: pytest.LogCaptureFixture,
http_status: int,
) -> None:
"""Test doorbell event reports."""
freezer.move_to("2026-05-11T19:50:47.647427+0000")
aioclient_mock.post(TEST_URL, text="", status=202)
aioclient_mock.post(TEST_URL, text="", status=http_status)
hass.states.async_set(
"event.test_doorbell",