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.54k stars 30.72k forks source link

HomeAssistant can't setup the Stream integration after installing through Python #64675

Closed astutejoe closed 2 years ago

astutejoe commented 2 years ago

The problem

I decided moving from docker to native Python, I installed hass using pipenv and Python 3.10.2, everything works perfectly, except my stream integrations stopped loading, the log is attached here.

I'm probably missing a dependency? I couldn't find anything on the logs on the actual exception.

What version of Home Assistant Core has the issue?

core-2021.12.10

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Generic Camera

Link to integration documentation on our website

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

Example YAML snippet

camera:
  - platform: generic
    still_image_url: "https://i5.walmartimages.com/asr/03b1f48b-ab78-4db4-815a-51f4d8383f10.3867e056ca98da928457ddc66bfa4e1d.jpeg?odnHeight=612&odnWidth=612&odnBg=FFFFFF"
    stream_source: "rtsp://username:password@192.168.1.10/live0"
    username: "username"
    password: "password"
    name: "Bedroom Camera"
    verify_ssl: false
  - platform: generic
    still_image_url: "https://m.media-amazon.com/images/I/51RAiKC4hgL._AC_SL1500_.jpg"
    stream_source: "rtsp://username:password@192.168.1.11/live0"
    username: "username"
    password: "password"
    name: "Living Room Camera"
    verify_ssl: false

Anything in the logs that might be useful for us?

2022-01-22 01:12:19 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-22 01:12:19 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration ble_monitor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-01-22 01:12:26 WARNING (MainThread) [homeassistant.components.vesync.fan] Pureboi - Unknown device type - Core300S
2022-01-22 01:12:27 WARNING (MainThread) [homeassistant.config_entries] Config entry '70" Hisense Roku TV' for roku integration not ready yet: Invalid response from API: Error occurred while communicating with device; Retrying in background
2022-01-22 01:12:28 WARNING (MainThread) [charset_normalizer] Trying to detect encoding from a tiny portion of (9) byte(s).
2022-01-22 01:12:41 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Christmas Tree' for tplink integration not ready yet: Unable to connect to the device: 192.168.1.191; Retrying in background
2022-01-22 01:12:41 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 315, in preload_stream
    stream = await camera.create_stream()
  File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 458, in create_stream
    self.stream = create_stream(self.hass, source, options=self.stream_options)
  File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/stream/__init__.py", line 80, in create_stream
    raise HomeAssistantError("Stream integration is not set up.")
homeassistant.exceptions.HomeAssistantError: Stream integration is not set up.

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

generic documentation generic source (message by IssueLinks)

elupus commented 2 years ago

There are non python requirements for the stream component. In think you can check this https://pyav.org/docs/develop/overview/installation.html

astutejoe commented 2 years ago

@elupus I installed all the possible dependencies and the av package itself, I'm still getting:

Jan 23 00:38:46 ubuntu pipenv[161582]: Traceback (most recent call last):
Jan 23 00:38:46 ubuntu pipenv[161582]:   File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 315, in prelo>
Jan 23 00:38:46 ubuntu pipenv[161582]:     stream = await camera.create_stream()
Jan 23 00:38:46 ubuntu pipenv[161582]:   File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/camera/__init__.py", line 458, in creat>
Jan 23 00:38:46 ubuntu pipenv[161582]:     self.stream = create_stream(self.hass, source, options=self.stream_options)
Jan 23 00:38:46 ubuntu pipenv[161582]:   File "/home/homeassistant/.local/share/virtualenvs/homeassistant-blabs_3G/lib/python3.10/site-packages/homeassistant/components/stream/__init__.py", line 80, in create>
Jan 23 00:38:46 ubuntu pipenv[161582]:     raise HomeAssistantError("Stream integration is not set up.")
Jan 23 00:38:46 ubuntu pipenv[161582]: homeassistant.exceptions.HomeAssistantError: Stream integration is not set up.
astutejoe commented 2 years ago
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
                 libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
                 libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
sudo apt-get install -y \
                     libavformat-dev libavcodec-dev libavdevice-dev \
                     libavutil-dev libswscale-dev libswresample-dev libavfilter-dev
astutejoe commented 2 years ago

All that plus:

pipenv install av

Everything installed successfully, except the stream integration still "doesn't setup"

elupus commented 2 years ago

Have you enabled the stream component in config? https://www.home-assistant.io/integrations/stream/

astutejoe commented 2 years ago
The stream integration is automatically loaded by default_config and enabled by the camera platforms that support it. If default_config is used, no separate configuration.yaml entry is necessary.

My configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
...

So I guess, yes?

astutejoe commented 2 years ago

Are there any logs I can see the ACTUAL exception?

elupus commented 2 years ago

You are seeing the actual exception: from here https://github.com/home-assistant/core/blob/a9cefec1db3519790de6a65372ecf977f283f07b/homeassistant/components/stream/__init__.py#L85

So the stream component has not been loaded. Please add it manually in your config and see if that helps.

elupus commented 2 years ago

You can also turn on debug logs for stream component.

homeassistant.conponents.stream: debug

astutejoe commented 2 years ago

Manually putting stream: on configuration.yaml did the trick, then I removed it and it's still fine, odd, thanks for all the help @elupus