Address Hyperion camera post-merge code review (#51457)
This commit is contained in:
parent
07d6186fea
commit
cf954881f6
1 changed files with 6 additions and 5 deletions
|
@ -9,7 +9,7 @@ from collections.abc import AsyncGenerator
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Callable
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from hyperion import client
|
from hyperion import client
|
||||||
|
@ -33,6 +33,7 @@ from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
@ -56,8 +57,10 @@ IMAGE_STREAM_JPG_SENTINEL = "data:image/jpg;base64,"
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable
|
hass: HomeAssistantType,
|
||||||
) -> bool:
|
config_entry: ConfigEntry,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
) -> None:
|
||||||
"""Set up a Hyperion platform from config entry."""
|
"""Set up a Hyperion platform from config entry."""
|
||||||
entry_data = hass.data[DOMAIN][config_entry.entry_id]
|
entry_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
server_id = config_entry.unique_id
|
server_id = config_entry.unique_id
|
||||||
|
@ -94,7 +97,6 @@ async def async_setup_entry(
|
||||||
)
|
)
|
||||||
|
|
||||||
listen_for_instance_updates(hass, config_entry, instance_add, instance_remove)
|
listen_for_instance_updates(hass, config_entry, instance_add, instance_remove)
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
# A note on Hyperion streaming semantics:
|
# A note on Hyperion streaming semantics:
|
||||||
|
@ -232,7 +234,6 @@ class HyperionCamera(Camera):
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Register callbacks when entity added to hass."""
|
"""Register callbacks when entity added to hass."""
|
||||||
assert self.hass
|
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
|
|
Loading…
Add table
Reference in a new issue