Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg for sound detection doesn't terminate on Home Assistant restart #572

Closed
tchris227 opened this issue May 22, 2024 · 1 comment
Closed
Labels
Fixed Bug has been fixed.

Comments

@tchris227
Copy link

tchris227 commented May 22, 2024

Description

When sound detection is enabled and home assistant is restarted, a new instance of ffmpeg is started but the old one isn't terminated.

The system accumulates instances off ffmpeg on each home assistant restart until the container/OS is restarted.

Reproduction Steps

  1. run top from within home assistant container (docker exec -it homeassistant bash). After a fresh start of the container with only one tapo camera, there is only one instance of ffmpeg
  2. Restart home assistant (Settings --> Menu --> Restart Home Assistant)
  3. Monitor top. ffmpeg continues running through restart. After startup, another instance of ffmpeg appears

Expected behavior

Terminate ffmpeg when home assistant shuts down to restart. ffmpeg_noise, when configured on its own through the home assistant configuration.yaml file, terminates the old ffmpeg before starting a new one on startup.

If applicable, add error logs.

top output:

  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
  605    65 root     S    5790m  17%   9   0% python3 -m homeassistant --config /config
  209     1 root     S     210m   1%  21   0% ffmpeg -i rtsp://pathtomycamera -vn -nostats -filter:a silencedetect=n=-25dB:d=1 -f null -
  576     1 root     S     210m   1%  17   0% ffmpeg -i rtsp://pathtomycamera -vn -nostats -filter:a silencedetect=n=-25dB:d=1 -f null -
  756   605 root     S     210m   1%  12   0% ffmpeg -i rtsp://pathtomycamera -vn -nostats -filter:a silencedetect=n=-25dB:d=1 -f null -
  396     1 root     S     207m   1%  11   0% ffmpeg -i rtsp://pathtomycamera -vn -nostats -filter:a silencedetect=n=-25dB:d=1 -f null -
  787   781 root     R     1624   0%   6   0% top
  781     0 root     S     2612   0%   6   0% bash
    1     0 root     S      436   0%  28   0% /package/admin/s6/command/s6-svscan -d4 -- /run/service
   65     1 root     S      216   0%  15   0% s6-supervise home-assistant
   25     1 root     S      216   0%   9   0% s6-supervise s6rc-oneshot-runner
   16     1 root     S      216   0%  20   0% s6-supervise s6-linux-init-shutdownd
   26     1 root     S      216   0%  29   0% s6-supervise s6rc-fdholder
   34    25 root     S      208   0%  11   0% /package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/admin/s6/command/s6-sudod -t 30000
   19    16 root     S      204   0%  19   0% /package/admin/s6-linux-init/command/s6-linux-init-shutdownd -d3 -c /run/s6/basedir -g 3000 -C -B

Device Firmware

1.1.12 Build 240117 Rel.56102n

Integration Version

5.4.18

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

2024.5.4 Docker on Ubuntu 22.04.4

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner

@JurajNyiri JurajNyiri added the Fixed Bug has been fixed. label Jul 4, 2024
marcosngomezi pushed a commit to marcosngomezi/HomeAssistant-Tapo-Control that referenced this issue Jul 20, 2024
JurajNyiri added a commit that referenced this issue Jul 20, 2024
* changes

* tapo-siren-fix

* getMost-list-breaking-change

* siren-and-select

* comments

* fixes-and-comments

* numbers

* siren

* unneded-mapings

* cleanup

* testing-fixes

* cleanup

* Fix: PR does not work with C200 1.0 1.3.6

* fix-siren

* Update README.md to add instructions in case the cloud password does not work.

* Update README.md

* Update README.md

* Update README.md

* Implement color mode

Reference:
https://developers.home-assistant.io/docs/core/entity/light#color-modes

> New integrations must implement both color_mode and supported_color_modes.
> If an integration is upgraded to support color mode, both color_mode and
> supported_color_modes should be implemented.

This also fixes this warning at startup:

```
WARNING (MainThread) [homeassistant.components.light] None (<class 'custom_components.tapo_control.light.TapoWhitelight'>) does not set supported color modes, this will stop working in Home Assistant Core 2025.3, please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues
```

* Create ru.json

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Fix #568: IP address is not a supported Tapo device

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

* Update issues.yml

Temporarily disable cloud password close bot

* Update issues.yml

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* changes

* tapo-siren-fix

* getMost-list-breaking-change

* siren-and-select

* comments

* fixes-and-comments

* numbers

* siren

* unneded-mapings

* cleanup

* testing-fixes

* cleanup

* fix-siren

* Handle cleanup of config entry

* Fix: PR does not work with C200 1.0 1.3.6

* alarm-status-false-default

* Fix #616: Warning for async_forward_entry_setup

* Fix #612, #615, #530, #525

* Fix: Blocking call when copying file from cold to hot storage

* Add: Binary sensor with details about media sync setup

* Fix #572: ffmpeg for sound detection doesn't terminate on Home Assistant restart

* Fix #561: Unexpected error fetching Tapo resource status data

* Fix #571: Incorrect device_class for D230 doorbell battery sensor

* Fix: Descalate "Recording is currently in progress." warning to info on media sync

* Add: HDR switch

* Add: Experimental optimization for battery cameras

* Fix: Update interval is now based on whether the device has a battery or not

* Update: Automatically determine whether the device is currently running on battery or not and adjust update interval

* Fix: Camera entities ignoring update threshold

* Update README.md

* Update README.md

* Create add_camera_with_new_firmware.md

* Update README.md

* Update add_camera_with_new_firmware.md

* Update add_camera_with_new_firmware.md

* Fix #629, #621: Setup for switch entities fails for some cameras

* Add #457: Battery optimization for solar cameras

* Update: Migrate update interval to config entry storage

* Add: Configurable update interval

* Update: Bump version

* Update: Guides for new firmwares workaround

* Update: Readme instructions about stopping use of tapo app not required

* Update: Readme formatting

* Update README.md

* Update add_camera_with_new_firmware.md

* Update README.md

* Fix: Removal of disabled device results in error and warning, time sync debug log

* Fix #450: Config entry name resets on reconfiguration

* Update: Bump version

* Fix: stopManualAlarm instead of start on siren off

* Fix: Mute error on siren on/off

* Update: Revert result_has_error changes

* Update: Ensure compatibility with #632

---------

Co-authored-by: marcosngomezi <[email protected]>
Co-authored-by: Antoine Buchser <[email protected]>
Co-authored-by: L. López <[email protected]>
Co-authored-by: Virenbar <[email protected]>
Co-authored-by: Nathan Spencer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Bug has been fixed.
Projects
None yet
Development

No branches or pull requests

2 participants