Prevent connecting to a Shelly device that is already connected (#122105)

This commit is contained in:
Shay Levy
2024-07-18 23:27:03 +03:00
committed by GitHub
parent cf0aef079b
commit d2cc25cee6
8 changed files with 31 additions and 0 deletions

View File

@@ -279,6 +279,7 @@ async def test_sleeping_rpc_device_online(
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test sleeping RPC device online."""
monkeypatch.setattr(mock_rpc_device, "connected", False)
monkeypatch.setitem(mock_rpc_device.status["sys"], "wakeup_period", device_sleep)
entry = await init_integration(hass, 2, sleep_period=entry_sleep)
assert "will resume when device is online" in caplog.text
@@ -297,6 +298,7 @@ async def test_sleeping_rpc_device_online_new_firmware(
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test sleeping device Gen2 with firmware 1.0.0 or later."""
monkeypatch.setattr(mock_rpc_device, "connected", False)
entry = await init_integration(hass, 2, sleep_period=None)
assert "will resume when device is online" in caplog.text