Move imports to top for ffmpeg_motion and ffmpeg_noise (#29026)

* Move imports to top for ffmpeg_motion and ffmpeg_noise

* Fixed tests
This commit is contained in:
springstan 2019-11-25 14:11:23 +01:00 committed by Pascal Vizeli
parent 71bafba9ec
commit ccb05764b6
2 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,7 @@
"""Provides a binary sensor which is a collection of ffmpeg tools."""
import logging
import haffmpeg.sensor as ffmpeg_sensor
import voluptuous as vol
from homeassistant.core import callback
@ -87,10 +88,11 @@ class FFmpegMotion(FFmpegBinarySensor):
def __init__(self, hass, manager, config):
"""Initialize FFmpeg motion binary sensor."""
from haffmpeg.sensor import SensorMotion
super().__init__(config)
self.ffmpeg = SensorMotion(manager.binary, hass.loop, self._async_callback)
self.ffmpeg = ffmpeg_sensor.SensorMotion(
manager.binary, hass.loop, self._async_callback
)
async def _async_start_ffmpeg(self, entity_ids):
"""Start a FFmpeg instance.

View file

@ -1,6 +1,7 @@
"""Provides a binary sensor which is a collection of ffmpeg tools."""
import logging
import haffmpeg.sensor as ffmpeg_sensor
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
@ -54,10 +55,11 @@ class FFmpegNoise(FFmpegBinarySensor):
def __init__(self, hass, manager, config):
"""Initialize FFmpeg noise binary sensor."""
from haffmpeg.sensor import SensorNoise
super().__init__(config)
self.ffmpeg = SensorNoise(manager.binary, hass.loop, self._async_callback)
self.ffmpeg = ffmpeg_sensor.SensorNoise(
manager.binary, hass.loop, self._async_callback
)
async def _async_start_ffmpeg(self, entity_ids):
"""Start a FFmpeg instance.