mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports to top for ring (#29474)
This commit is contained in:
parent
c02d551cd5
commit
c6066d8b98
@ -1,14 +1,15 @@
|
||||
"""Support for Ring Doorbell/Chimes."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from datetime import timedelta
|
||||
from requests.exceptions import ConnectTimeout, HTTPError
|
||||
from ring_doorbell import Ring
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, CONF_SCAN_INTERVAL
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -50,8 +51,6 @@ def setup(hass, config):
|
||||
scan_interval = conf[CONF_SCAN_INTERVAL]
|
||||
|
||||
try:
|
||||
from ring_doorbell import Ring
|
||||
|
||||
cache = hass.config.path(DEFAULT_CACHEDB)
|
||||
ring = Ring(username=username, password=password, cache_file=cache)
|
||||
if not ring.is_connected:
|
||||
|
@ -3,16 +3,18 @@ import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from haffmpeg.camera import CameraMjpeg
|
||||
from haffmpeg.tools import IMAGE_JPEG, ImageFrame
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
||||
from homeassistant.components.ffmpeg import DATA_FFMPEG
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import (
|
||||
ATTRIBUTION,
|
||||
@ -122,7 +124,6 @@ class RingCam(Camera):
|
||||
|
||||
async def async_camera_image(self):
|
||||
"""Return a still image response from the camera."""
|
||||
from haffmpeg.tools import ImageFrame, IMAGE_JPEG
|
||||
|
||||
ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop)
|
||||
|
||||
@ -140,7 +141,6 @@ class RingCam(Camera):
|
||||
|
||||
async def handle_async_mjpeg_stream(self, request):
|
||||
"""Generate an HTTP MJPEG stream from the camera."""
|
||||
from haffmpeg.camera import CameraMjpeg
|
||||
|
||||
if self._video_url is None:
|
||||
return
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""This component provides HA switch support for Ring Door Bell/Chimes."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components.light import Light
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import DATA_RING_STICKUP_CAMS, SIGNAL_UPDATE_RING
|
||||
|
@ -9,11 +9,11 @@ from homeassistant.const import (
|
||||
CONF_ENTITY_NAMESPACE,
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import (
|
||||
ATTRIBUTION,
|
||||
|
@ -1,9 +1,10 @@
|
||||
"""This component provides HA switch support for Ring Door Bell/Chimes."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import DATA_RING_STICKUP_CAMS, SIGNAL_UPDATE_RING
|
||||
|
Loading…
x
Reference in New Issue
Block a user