Skip to content

Commit

Permalink
Move imports to top for ffmpeg_motion and ffmpeg_noise (#29026)
Browse files Browse the repository at this point in the history
* Move imports to top for ffmpeg_motion and ffmpeg_noise

* Fixed tests
  • Loading branch information
springstan authored and pvizeli committed Nov 25, 2019
1 parent 71bafba commit ccb0576
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions homeassistant/components/ffmpeg_motion/binary_sensor.py
@@ -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
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions homeassistant/components/ffmpeg_noise/binary_sensor.py
@@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit ccb0576

Please sign in to comment.