home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.21k stars 30.57k forks source link

Amcrest view live stream broken #47369

Closed slackr31337 closed 3 years ago

slackr31337 commented 3 years ago

The problem

When clicking the camera live view in lovelase picture glance card the video player modal shows but does not display any video. An error is logged by homeassistant in regards to components.stream.worker.

System Health

version core-2021.3.0
installation_type Home Assistant Core
dev false
hassio false
docker false
virtualenv true
python_version 3.8.6
os_name Linux
os_version 5.4.65-1-pve
arch x86_64
timezone America/New_York
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | March 26, 2021, 8:00 PM relayer_connected | true remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Lovelace dashboards | 5 -- | -- resources | 2 views | 19 mode | storage

What is version of Home Assistant Core has the issue?

core-2021.3.0

What was the last working version of Home Assistant Core?

core-2021.2.3

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Amcrest

Link to integration documentation on our website

https://www.home-assistant.io/integrations/amcrest

Example YAML snippet

Anything in the logs that might be useful for us?

Mar 04 08:32:42 home-assistant hass[2357602]: 2021-03-04 08:32:42 ERROR (stream_worker) [root] Uncaught thread exception
Mar 04 08:32:42 home-assistant hass[2357602]: Traceback (most recent call last):
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Mar 04 08:32:42 home-assistant hass[2357602]:     self.run()
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/usr/local/lib/python3.8/threading.py", line 870, in run
Mar 04 08:32:42 home-assistant hass[2357602]:     self._target(*self._args, **self._kwargs)
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/__init__.py", line 189, in _run_worker
Mar 04 08:32:42 home-assistant hass[2357602]:     from .worker import SegmentBuffer, stream_worker
Mar 04 08:32:42 home-assistant hass[2357602]: ImportError: cannot import name 'SegmentBuffer' from 'homeassistant.components.stream.worker' (/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/worker.py)
Mar 04 08:32:42 home-assistant hass[2357602]: 2021-03-04 08:32:42 ERROR (stream_worker) [root] Uncaught thread exception
Mar 04 08:32:42 home-assistant hass[2357602]: Traceback (most recent call last):
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Mar 04 08:32:42 home-assistant hass[2357602]:     self.run()
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/usr/local/lib/python3.8/threading.py", line 870, in run
Mar 04 08:32:42 home-assistant hass[2357602]:     self._target(*self._args, **self._kwargs)
Mar 04 08:32:42 home-assistant hass[2357602]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/__init__.py", line 189, in _run_worker
Mar 04 08:32:42 home-assistant hass[2357602]:     from .worker import SegmentBuffer, stream_worker
Mar 04 08:32:42 home-assistant hass[2357602]: ImportError: cannot import name 'SegmentBuffer' from 'homeassistant.components.stream.worker' (/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/worker.py)
uvjustin commented 3 years ago

Seems like there may be some conflict with the stream files in your installation. Is this a clean install?

slackr31337 commented 3 years ago

I believe this is a clean install. I ran "pip3 install --upgrade --force-reinstall homeassistant" to see if that would fix the problem and it did not. I can remove the virtualenv and create a new Python 3.8 one and reload homeassistant.

I also have a MJPEG camera that is working fine. I'm able to stream that camera in lovelace just fine.

I still see this exception when trying to stream from the Amcrest cameras.

Mar 05 08:53:17 home-assistant hass[2548605]: 2021-03-05 08:53:17 ERROR (stream_worker) [root] Uncaught thread exception Mar 05 08:53:17 home-assistant hass[2548605]: Traceback (most recent call last): Mar 05 08:53:17 home-assistant hass[2548605]: File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner Mar 05 08:53:17 home-assistant hass[2548605]: self.run() Mar 05 08:53:17 home-assistant hass[2548605]: File "/usr/local/lib/python3.8/threading.py", line 870, in run Mar 05 08:53:17 home-assistant hass[2548605]: self._target(*self._args, **self._kwargs) Mar 05 08:53:17 home-assistant hass[2548605]: File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/__init__.py", line 189, in _run_worker Mar 05 08:53:17 home-assistant hass[2548605]: from .worker import SegmentBuffer, stream_worker Mar 05 08:53:17 home-assistant hass[2548605]: ImportError: cannot import name 'SegmentBuffer' from 'homeassistant.components.stream.worker' (/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/stream/worker.py)

slackr31337 commented 3 years ago

I just replace worker.py in my instance with the github version and my live stream is working now.

https://github.com/home-assistant/core/blob/2021.3.1/homeassistant/components/stream/worker.py

Very strange that file was missing the SegmentBuffer class. I will do a clean install now.

Thanks, closing issue.