Add option to specify Reolink Basic Service Port (#137603)

* Allow changing the baichuan port

* styling

* Add description

* Add tests

* Review feedback

* capital letters

Co-authored-by: Robert Resch <robert@resch.dev>

---------

Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
starkillerOG
2025-03-16 19:51:06 +01:00
committed by GitHub
parent 8a552aef9d
commit b5fa3e74c0
9 changed files with 67 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ from reolink_aio.exceptions import ReolinkError
from homeassistant.components.reolink.config_flow import DEFAULT_PROTOCOL
from homeassistant.components.reolink.const import (
CONF_BC_PORT,
CONF_SUPPORTS_PRIVACY_MODE,
CONF_USE_HTTPS,
DOMAIN,
@@ -48,6 +49,7 @@ TEST_ITEM_NUMBER = "P000"
TEST_CAM_MODEL = "RLC-123"
TEST_DUO_MODEL = "Reolink Duo PoE"
TEST_PRIVACY = True
TEST_BC_PORT = 5678
@pytest.fixture
@@ -136,6 +138,7 @@ def reolink_connect_class() -> Generator[MagicMock]:
# Baichuan
host_mock.baichuan = create_autospec(Baichuan)
# Disable tcp push by default for tests
host_mock.baichuan.port = TEST_BC_PORT
host_mock.baichuan.events_active = False
host_mock.baichuan.privacy_mode.return_value = False
host_mock.baichuan.subscribe_events.side_effect = ReolinkError("Test error")
@@ -175,6 +178,7 @@ def config_entry(hass: HomeAssistant) -> MockConfigEntry:
CONF_PORT: TEST_PORT,
CONF_USE_HTTPS: TEST_USE_HTTPS,
CONF_SUPPORTS_PRIVACY_MODE: TEST_PRIVACY,
CONF_BC_PORT: TEST_BC_PORT,
},
options={
CONF_PROTOCOL: DEFAULT_PROTOCOL,