project: cameras around the house
There are a variety of camera types to help monitor the drive, a pet, a baby, a device, a bird feeder – whatever. You might want to know what’s eating the rabbit’s food or whether a tank is filling, but whatever the scope, a camera can deliver answers to the curious. Quite often our best intentions are stymied by needing a camera where it’s unreasonable to run a wire. Cameras can be expensive but you might consider a DIY camera for a non-critical task at under £7 – see this project for that.
What camera features are important?
- Detects and records when something happens.
- Battery powered or powered from a mains socket
- Recordings are conveniently retrievable. If the camera also takes a snapshot when something happens, you’ll not use time watching nothing happen on video.
- Recordings are stored in the cloud or locally on an SD card or hard drive.
- Indoor or outdoor
- Good image quality is for indoor use, best image quality is for outdoor use
- Night time IR lighting can be turned off for cameras behind windows.
- Wired (poe) or wireless but most likely connected to your network
- Allows you to see the camera stream
Don’t you want access to the camera stream?
A lot of the consumer camera systems use proprietary protocols which deliver more or less of the checklist above. Some of them limit use of your camera stream and recorded images. If you are allowed to use the live camera stream you can record it (with eg iSpy or MotionEye or Home Assistant). And failing that test can be a deal breaker. It’s a help to able to integrate different cameras into one convenient screen with your own software. In a future article I’ll compare the cameras available for this purpose.
How to put a camera view into Home Assistant
Your camera should already be connected and working on your network. In the past that’s been really hard but there are commercial systems to make this easier. With proprietary systems, you’ll often need to know an access password. With generic IP cameras you’ll need to know the IP address, port, password, streaming protocol or access URL. That can be hellish but there are tables of access URLs which bring success closer.
In Home Assistant go to the Configurator to edit your configuration.yaml file. Open another window with the Home Assistant help on Integrations for cameras and look for your model. Copy the syntax shown, fill in your details and you’ll have an entry maybe like any of these. Save the file, then check your configuration is valid before restarting Home Assistant.
Incidentally, Home Assistant has a separate file in which you can type your passwords and keep them from view. Below you see various placeholders which will be looked up when Home Assistant needs it.
# INCLUDE THIS HEADING ONCE. NO NEED TO DUPLICATE IT camera: # GENERIC CAMERA EXAMPLE - platform: generic still_image_url: http://22.214.171.124/jpg/image.jpg name: chicken feed station username: !secret username password: !secret my_password # MJPEG CAMERA EXAMPLE - platform: mjpeg mjpeg_url: http://192.168.1.159:8159/img/video.mjpeg name: front cam username: !secret other_username password: !secret my_other_password # ANOTHER CAMERA EXAMPLE - platform: mjpeg name: 3D printer cam still_image_url: http://126.96.36.199/webcam/?action=snapshot mjpeg_url: http://188.8.131.52/webcam/?action=stream # A PROPRIETARY CAMERA EXAMPLE logi_circle: client_id: !secret log_id client_secret: !secret log_secret api_key: !secret log_api_key redirect_uri: !secret log_uri
Add your camera to the Home Assistant frontend
In the Home Assistant overview is a button to Configure the UI. This lets you add camera cards, using code like the following with a result probably less like the following:
cards: entity: camera.3D_printer_cam type: picture-entity entity: camera.chicken_feed_station type: picture-entity entity: camera.front_cam type: picture-entity type: vertical-stack