mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add Hyperion camera feed (#46516)
* Initial Hyperion camera. * Improve test coverage. * Minor state fixes. * Fix type annotation. * May rebase and updates (mostly typing). * Updates to use new camera typing improvements. * Use new support for returning None from async_get_mjpeg_stream . * Codereview feedback. * Lint: Use AsyncGenerator from collections.abc . * Update homeassistant/components/hyperion/camera.py Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
@@ -125,7 +125,7 @@ def add_test_config_entry(
|
||||
options: dict[str, Any] | None = None,
|
||||
) -> ConfigEntry:
|
||||
"""Add a test config entry."""
|
||||
config_entry: MockConfigEntry = MockConfigEntry( # type: ignore[no-untyped-call]
|
||||
config_entry: MockConfigEntry = MockConfigEntry(
|
||||
entry_id=TEST_CONFIG_ENTRY_ID,
|
||||
domain=DOMAIN,
|
||||
data=data
|
||||
@@ -137,7 +137,7 @@ def add_test_config_entry(
|
||||
unique_id=TEST_SYSINFO_ID,
|
||||
options=options or TEST_CONFIG_ENTRY_OPTIONS,
|
||||
)
|
||||
config_entry.add_to_hass(hass) # type: ignore[no-untyped-call]
|
||||
config_entry.add_to_hass(hass)
|
||||
return config_entry
|
||||
|
||||
|
||||
@@ -187,3 +187,12 @@ def register_test_entity(
|
||||
suggested_object_id=entity_id,
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
|
||||
async def async_call_registered_callback(
|
||||
client: AsyncMock, key: str, *args: Any, **kwargs: Any
|
||||
) -> None:
|
||||
"""Call Hyperion entity callbacks that were registered with the client."""
|
||||
for call in client.add_callbacks.call_args_list:
|
||||
if key in call[0][0]:
|
||||
await call[0][0][key](*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user