Skip to content

Commit

Permalink
Fix #572: ffmpeg for sound detection doesn't terminate on Home Assist…
Browse files Browse the repository at this point in the history
…ant restart
  • Loading branch information
JurajNyiri committed Jul 4, 2024
1 parent 75981ca commit ded054c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/tapo_control/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
BinarySensorDeviceClass,
)

from homeassistant.components.ffmpeg import (
FFmpegManager,
get_ffmpeg_manager,
)

from homeassistant.const import STATE_ON, STATE_OFF
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity import DeviceInfo
Expand Down Expand Up @@ -117,8 +122,10 @@ def __init__(self, entry: dict, hass: HomeAssistant, config_entry):
self._sound_detection_reset = config_entry.data.get(SOUND_DETECTION_RESET)
self.latestCamData = entry["camData"]

manager = get_ffmpeg_manager(hass)

self._noiseSensor = ffmpeg_sensor.SensorNoise(
self._ffmpeg.binary, self._noiseCallback
manager.binary, self._noiseCallback
)
self._noiseSensor.set_options(
time_duration=int(self._sound_detection_duration),
Expand Down

0 comments on commit ded054c

Please sign in to comment.