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

@@ -19,7 +19,7 @@ from homeassistant.components.reolink import (
FIRMWARE_UPDATE_INTERVAL,
NUM_CRED_ERRORS,
)
from homeassistant.components.reolink.const import DOMAIN
from homeassistant.components.reolink.const import CONF_BC_PORT, DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import (
CONF_PORT,
@@ -38,6 +38,7 @@ from homeassistant.helpers import (
from homeassistant.setup import async_setup_component
from .conftest import (
TEST_BC_PORT,
TEST_CAM_MODEL,
TEST_HOST_MODEL,
TEST_MAC,
@@ -762,6 +763,21 @@ async def test_port_changed(
assert config_entry.data[CONF_PORT] == 4567
async def test_baichuan_port_changed(
hass: HomeAssistant,
reolink_connect: MagicMock,
config_entry: MockConfigEntry,
) -> None:
"""Test config_entry baichuan port update when it has changed during initial login."""
assert config_entry.data[CONF_BC_PORT] == TEST_BC_PORT
reolink_connect.baichuan.port = 8901
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert config_entry.data[CONF_BC_PORT] == 8901
async def test_privacy_mode_on(
hass: HomeAssistant,
freezer: FrozenDateTimeFactory,