Android IP Webcam and Google Assistant gives me "Smart Home Camera" but no stream

Hi!

My goal is to use Google Assistant to stream the camera of an Android device on my TV or my Google Hub.

I’ve managed to set up an Android Tablet (Samsung Galaxy Tab S2) running IP Webcam (Play Store, integration) to show up as a camera entity in my Google Home using the manual Google Assistant integration.

However, when I ask Google Assistant to show me Camera 1 on my TV it looks like it is about to stream the camera but then I just get a black background and white centered text on top saying Smart Home Camera. Same thing happens on both my Chromecast and my Google Hub.

In Home Assistant front-end, all cameras show up and work just fine. So I wonder now has anyone else got this or a similar setup with an Android camera working? I’m aware that I can get the camera to stream to my TV using a script that gets invoked through either Google Assistant or IFTTT but it would be nice to make use of what’s given for free by Google Assistant and its camera entity :slight_smile:

configuration.yaml

stream: 

android_ip_webcam:
  - host: 192.168.1.163
    sensors:
      - battery_level
      - motion
    switches:
      - torch

camera:
  - platform: generic
    still_image_url: http://192.168.1.163:8080/shot.jpg
    name: Camera 1
    stream_source: rtsp://192.168.1.163:8080/h264_ulaw.sdp

  - platform: generic
    still_image_url: http://192.168.1.163:8080/shot.jpg
    name: Camera 2
    stream_source: rtsp://192.168.1.163:8080/h264_pcm.sdp

  - platform: mjpeg
    name: Camera 3
    mjpeg_url: http://192.168.1.163:8080/video

  - platform: onvif
    host: 192.168.1.163
    name: Camera 4
    port: 8080

google_assistant:
  project_id: !secret ga_project_id
  api_key: !secret ga_homegraph_api_key
  expose_by_default: false
  entity_config:
    camera.camera_1:
      name: Camera 1
      expose: true

    camera.camera_2:
      name: Camera 2
      expose: true

    camera.camera_3:
      name: Camera 3
      expose: true

    camera.camera_4:
      name: Camera 4
      expose: true

    camera.ip_webcam:
      name: Camera 5
      expose: true


From my research above I’ve found that even though all five cameras should be exposed as camera entities, only camera 1, 2 and 4 appear in Google Home. But they all just show “Smart Home Camera” and there’s nothing relevant in the logs either.

Running Home Assistant 0.97.0 in a Docker container on a Synology DS718+

1 Like

Try using

http:
  base_url: https://xxxx.duckdns.org

I had exact same problem. This worked for me.

The Google display needs to connect to h.a. steam component and often it tries the wrong URL.

1 Like

Lovely! I added https before my base url and now it works :smiley:

The buffering and the lag though :sweat_smile: Do you have a good experience using this setup?

Thanks for helping me solve this setup but in the end I’ll think I use a script like below as the performance of the stream gets way better, almost flawless.

scripts.yml

cast_device_camera:
  alias: Cast Android Device
  sequence:
    - service: media_extractor.play_media
      entity_id: media_player.chromecast_ultra
      data:
        media_content_id: "http://192.168.1.163:8080/video"
        media_content_type: image/jpg
1 Like

That’s interesting, I might have to try it that way. Yes it’s a bit slow and the is lag. I can see that way being better as it’s a direct connection.

I didn’t even know Android IP Webcam has a rtsp Option. Thank you!!!

Hi,

I have the same issues. Does the script option work with voice and how do you go about casting to a different device?

Thanks

entity_id: media_player.chromecast_ultra in the script code above chooses the target display to stream to.

if you want to use google assistant integration then:
add stream: to your configuraiton yaml (see stream component help page)
then make sure you have exposed the camera to google assistant (see google assistant component help page)

then if you have a hub you can say “hey google show me the xxx camera” and it will stream on to the hub.

To get my script working with voice I exposed a switch to Google Home which runs my script above when turned on and stops the casting when turned off. This way I can say “Hey Google, activate/turn on the security camera” to get my camera on my TV. However if I want to choose another screen then I would have to create another switch, for example named “security camera on kitchen display”.

configuration.yaml

# Switches
switch:
  - platform: template
    switches:
      # Hallway Camera switch to stream to tv
      security_camera:
        value_template: "{{ is_state_attr('media_player.chromecast_ultra', 'media_content_id', 'http://192.168.1.163:8080/video') }}"
        turn_on:
          service: script.cast_device_camera
          data:
            media_player: media_player.chromecast_ultra
        turn_off:
          service: media_player.turn_off
          data:
            entity_id: media_player.chromecast_ultra

# Google Assistant
google_assistant:
  project_id: !secret ga_project_id
  api_key: !secret ga_homegraph_api_key
  expose_by_default: false
  entity_config:      
    switch.security_camera:
      name: Security camera
      room: Hallway
      aliases:
        - Hallway camera
      expose: true

I also updated the script a little bit so I don’t need one script per screen I want to cast to.

scripts.yaml

cast_device_camera:
  alias: Cast Device
  sequence:
    - service: media_extractor.play_media
      data_template:
        entity_id: "{{ media_player }}"
      data:
        media_content_id: "http://192.168.1.163:8080/video"
        media_content_type: image/jpg

Did you figure out how to solve the lag?

Same issue here when I ask to my Google Assistant to show my camera I got also the following message: Smart Home Camera but no camera stream.

My config looks like:

http:
  base_url: https://xxx.duckdns.org

stream:

camera:
  - platform: generic
    name: Achtertuin
    still_image_url: !secret Camera_URL_Achtertuin
    stream_source: !secret Camera_Source_Achtertuin

google_assistant:
  project_id: xxxxxxx
  api_key: xxxxxxx
  expose_by_default: false
  entity_config:
    light.livingwhites_plug:
      expose: false
    light.buitenlamp_achterdeur:
      expose: false
    light.buitenlamp_voordeur:
      expose: false
    group.igrill:
      expose: false    
    camera.achtertuin:
      expose: true      
      name: Camera Backyard

what cameras do you have? i also had the black screen issue, while in lovelace it was working
i have cheap foscams thats maybe why
i tried component types: foscam/generic/ffmpeg/rtsp/onvif … it was always working in Lovelace, but never in google hub, or with a HUUUUge lag sometimes i saw like 1 frame

i also have a virtual synology with surveillance system on it, so used that rtsp stream from there, and it worked, although with a delay like 10 seconds, but it works

I have 2 Reolink camera’s.

Tried with the Reolink custom component (https://github.com/fwestenberg/reolink) and as generic camera. Both without any luck.

try motioneye addon? i also produces a videostream
maybe try that stream in your generic config?

Non same issue :frowning:

I have a similar problem – some cameras setup in BlueIris, streaming fine in Lovelace, google assistant integrated, and google home ios app showing the cameras. I can ask the google home hub “show baby camera”, and it says “ok, showing”, but the feed never comes up. I do have

http: 
  base_url: https://<mydomain>.duckdns.org 

in my configuration.yaml, but it does not appear to help.

It would be great if somebody could point out how to troubleshoot this – how does this whole setup even work? (Does home hub pull the stream directly from BlueIris? Or does it use HomeAssistant as a proxy? Are the streams staying in my network, or do they go through google’s cloud?) Are there some logs I could look at? Run tcpdump somewhere? The whole thing seems rather opaque. :frowning:

i disabled the stream: component, i just exposed switches with native feed to google assistant
so i say ; hey google, turn camera x on/off , works better with cast function

example :
as for my secret, you can define what you want, an stream url offcourse

   google_camera_boven:
     friendly_name: Camera Boven
     value_template: "false"   
     turn_on:
       - service: media_player.play_media
         data_template:
           entity_id: media_player.google_hub
           media_content_id: !secret google_camera_boven
           media_content_type: "image/jpg"       
     turn_off:
       - service: media_player.turn_off
         entity_id: media_player.google_hub

Fabio, I am sorry, but I am a novice at homeassistant, and don’t understand your config without more context. Also, I am trying to see the video feed, not a series of jpegs…

On a somewhat different note, after enabling the debug logging I see following records when I ask google to show me a camera:

2020-04-07 11:26:10 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: 
entity_id=media_player.office_display, 
old_state=<state media_player.office_display=idle; volume_level=0.36000001430511475, is_volume_muted=False, media_content_id=, media_position=0, media_position_updated_at=2020-04-07T11:26:09.933653-04:00, app_id=C09746F3, app_name=Smart Home Camera, entity_picture_local=None, friendly_name=Office Display, supported_features=21391 @ 2020-04-07T11:26:09.897916-04:00>, 
new_state=<state media_player.office_display=playing; volume_level=0.36000001430511475, is_volume_muted=False, media_content_id=, media_position=0, media_position_updated_at=2020-04-07T11:26:10.914953-04:00, app_id=C09746F3, app_name=Smart Home Camera, entity_picture_local=None, friendly_name=Office Display, supported_features=21391 @ 2020-04-07T11:26:10.915258-04:00>>

So it looks like the media_player.office_display goes from idle to playing, which makes sense. What seems wrong though is that media_content_id is empty… Does anybody know if it’s supposed to be populated? And if so, how do I go about doing that?

hmm , no idea
whats your config
in my case i dont see jpegs, i see a feed

This is what I think are relevant parts of the config:

http:
  ssl_certificate: <cert>
  ssl_key: <key>
  base_url: <baseurl>

# Streaming configuration
stream:

camera:
  - platform: generic
    name: cam1
    still_image_url: "http://<user>:<password>@<blueirishost>:8881/image/cam1"
    stream_source: "http://<user>:<password>@<blueirishost>:8881/h264/cam1/temp.m3u8"

google_assistant:
  project_id: <projectid>
  service_account: !include service_account.json
  report_state: true
  exposed_domains:
    - camera

you are stil exposing a camera with stream
my config is a “template switch”, and i removed the stream: component