Home Assistant Community

USB webcam on Hassio

#1

Hi all, I have a cheap USB webcam that I wish to plug into my rpi3 hassio and display on the front end. I was surprised there is no USB camera component, although it shouldn’t be difficult to make one. There is a blog post but this requires installing motion, so presumably is not a viable approach on hassio. I would be happy to capture stills via the command line and display on the front end as a local file, but I’m not sure how to go about this on Hassio.
Any advice gratefully received!
Cheers

1 Like

Setting up USB camera with motion
Using USB camera with RPi 3B 64
#2

I’m just setting mine up now!

use this repo

to add the motion addon, then add this to your config

camera:
  - platform: local_file
    name: cam_name #e.g kitchen cam
    file_path: /share/motion/lastsnap.jpg

I’m trying this myself now but i had it running on my last instance of hassio and it worked fine

2 Likes

#3

OK it’s working nicely! Have you changed the default settings? Also do you know how to view the live feed?
Cheers

0 Likes

#4

I changed the snapshot_interval to 1 which updates it more often but I’m afraid I don’t really know

have a look at this though: https://github.com/HerrHofrat/hassio-addons/tree/master/motion it has the settings for the config

0 Likes

#5

I’ve set scan interval to 0, as capturing so many images that my SD card will will in no time!
I have my camera trained on my birdfeeder and its working well, although also triggered by rain…

@billyb I’ve noticed that the default activity is to save the last periodic snapshot to lastsnap.jpg, but is there a way to set this image to the last image triggered by motion instead?

EDIT: Setting the following will save the best image in the last motion sequence as motion-snap.jpg, but unfortunately this image will be overwritten after each new motion event, so you will not had a record.

  "picture_output": "best",
  "picture_name": "motion-snap",
2 Likes

USB Camera With Home Assistant
#6

I’m afraid I have no idea I am a complete beginner all I know how to do with this addon is set it up

0 Likes

#7

OK the following settings are working well for me, I get the stream on the front end updated every second (without saving the stream) and capture the best image from motion detection events, with the best image saved with a timestamp.
Cheers

{
  "config": "",
  "videodevice": "/dev/video0",
  "input": 0,
  "width": 640,
  "height": 480,
  "framerate": 2,
  "text_right": "%Y-%m-%d %T-%q",
  "target_dir": "/share/motion",
  "snapshot_interval": 1,
  "snapshot_name": "latest",
  "picture_output": "best",
  "picture_name": "%v-%Y%m%d%H%M%S-motion-capture",
  "webcontrol_local": "on",
  "webcontrol_html": "on"
}

Doing a good job with false positive capture rate < 30%

There is yet hope of doing recognition of the bird via Google vision:

3 Likes

#8

Hi,

Do you know if one you expose this camera feed to Zoneminder or Shinobi?

0 Likes

#9

No idea. Why would you need to - what functionality is missing from HA?

0 Likes

#10

HA is not a CCTV solution for recording playback etc. Especially when you have close on 20 camera’s.

I like having a dedicated platform for this that integrates with HA.

I have a use case where I have an Intel NUC simply running yawcam for exposing the feed from the usb webcam to zm.

I now want to transfer my master ha build to this device, however retain my other infrastructure setup.

I will have a play around and see when I have finished the migration and update here…

1 Like

#11

hi i get this error trying to install in hassos
ERROR (SyncWorker_9) [hassio.docker.addon] Can't build 657d34ca/aarch64-addon-motion:2.1: no matching manifest for linux/arm64 in the manifest list entries

0 Likes

#12

See https://github.com/HerrHofrat/hassio-addons/issues/6

0 Likes

#13

Thank You, are they going to get a solution?

0 Likes

#14

I’ve just got my hands on a Logitech C270 and wanted to do install it on my Home-Assistant. I already migrated my HassIO to run on HassOS and I’m not sure if that was a good idea.
It seems the plug and play doesn’t work anymore. Perhaps because it’s a docker container. But if I plug it in and do

lsusb
Bus 001 Device 005: ID 046d:0825

The name of the device doesn’t show up which seems odd already. But the ID is correct.
Also there is no /dev/video device afterwards.
Any ideas?

0 Likes

#15

How did you get your stream updated without saving the stream ?

“snapshot_interval”: 1+, saves the images to sdcard ? which is bad for sdcard !

0 Likes

#16

Guys, is it possible to disable motion detector and just do a snapshot e.g. 1 per minute?

0 Likes

#17

I can’t get my camera to work. The cameras lights are indicating that it is in use, but nothing shows up on the frontpage. I use the config-examples above, and my configuration.yaml looks like billyb’s, but nothing on frontpage. Am I doing anything wrong?

0 Likes

#19

This addon is fantastic works really well for my USB camera: simple and effective.

Is it possible to use it also for IP cameras? If not, any good, simple, alternative?

0 Likes

#20

Hi, I cant add that addon to my Hassio. Is it still working or not?
Or how can I add it?

0 Likes

#21

hi its got the architecture code missing. i folked his repo and added missing code. you can use mine until the issue is resolved. https://github.com/lovejoy777/hassio-addons

1 Like