Automatically add newly added devices for UniFi Protect (#73879)

This commit is contained in:
Christopher Bailey 2022-06-27 17:03:25 -04:00 committed by GitHub
parent 33f5b225fb
commit b9c636ba4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 696 additions and 76 deletions

View file

@ -25,7 +25,26 @@ from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from .utils import MockUFPFixture, assert_entity_counts, init_entry
from .utils import (
MockUFPFixture,
adopt_devices,
assert_entity_counts,
init_entry,
remove_entities,
)
async def test_media_player_camera_remove(
hass: HomeAssistant, ufp: MockUFPFixture, doorbell: Camera
):
"""Test removing and re-adding a light device."""
await init_entry(hass, ufp, [doorbell])
assert_entity_counts(hass, Platform.MEDIA_PLAYER, 1, 1)
await remove_entities(hass, [doorbell])
assert_entity_counts(hass, Platform.MEDIA_PLAYER, 0, 0)
await adopt_devices(hass, ufp, [doorbell])
assert_entity_counts(hass, Platform.MEDIA_PLAYER, 1, 1)
async def test_media_player_setup(