element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog Pi Control Hub: Integrating Camera's in Home Assistant
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 23 Aug 2016 7:05 PM Date Created
  • Views 4199 views
  • Likes 4 likes
  • Comments 6 comments
  • home automation
  • raspberry pi zero
  • piiot
  • raspberry pi3
  • raspberry pi
  • security_camera
  • picamera
  • piiot challenge
Related
Recommended

Pi Control Hub: Integrating Camera's in Home Assistant

carmelito
carmelito
23 Aug 2016

Here is a quick post on integrating camera's with Home Assistant, this includes

  • Pi Camera connected to Raspberry Pi 3 as part of the Hub
  • Security camera that we create using a Raspberry Pi Zero, PI NOIR camera and installing Motion with Single File PHP Gallery in a previous blog post - Pi Control Hub: Spoke 1 :Security Camera

 

Basically, as part of Home Assistant dashboard we are going to add two sections  showing the preview of Pi Cameras as shown in the pictures below

{gallery} Integrating Camera's in Home Assistant

image

Home Assistant dashboard with Pi Cameras preview.

image

Security Camera setup with Pi Zero + NOIR camera, in a 3D printed case.

image

Pi camera connected  to the Raspberry Pi 3

image

Security camera feed in a  separate tab

image

Picture gallery of the intruders detected image , using Single File PHP Gallery

image

Having a close look into the picture from the Picture gallery

 

 

Here are the steps to follow to integrate the Pi cameras with Home-Assistant

#1  Connect the Pi camera to Raspberry Pi 3 and run the following commands to create a directory called picamera

         pi@hub:~ $ cd /home/hass

         pi@hub:~ $sudo mkdir picamera

         pi@hub:/home/hass $ ls

         picamera

         pi@hub:/home/hass $ sudo chown hass picamera

      and then create a image file

        pi@hub:/home/hass/picamera $   touch image.jpg

 

#2 Update the configuration.yaml file

camera:
  platform: rpi_camera
  name: Raspberry Pi Camera
  image_width: 640
  image_height: 480
  image_quality: 7
  image_rotation: 0
  timelapse: 1000
  horizontal_flip: 0
  vertical_flip: 0
  file_path: /home/hass/picamera/image.jpg

   and then stop and start Home-Assistant and test

      sudo systemctl stop home-assistant@hass

      sudo systemctl start home-assistant@hass

image

 

#3 Adding the Security camera  to the dashboard

    modify the configuration.yaml to include the following under the camera section

- platform: mjpeg
  mjpeg_url: http://192.168.0.21:8081
  name: Security Camera

    change the ip address above with the security camera Pi's ip address

 

#4 To add Security camera Preview tab and the Intruder detection tab which show the picture gallery

       Add the following under the panel_iframe section of the configuration.yaml file

  intruder:
    title: 'Intruder detection'
    icon: 'mdi:nature-people'
    url: 'http://192.168.0.21/'
  securitycam:
    title: 'Security Cam'
    icon: 'mdi:camera'
    url: 'http://192.168.0.21:8081/'

      change the ip address above with the security camera Pi's ip address

  • Sign in to reply

Top Comments

  • volly
    volly over 9 years ago +1
    carmelito . nice touch!
  • cortado
    cortado over 5 years ago +1
    Wwhat operating system are you using? I am on Hassio and cannot enable PI camera. Familiar with that?
  • carmelito
    carmelito over 5 years ago in reply to volly

    I am using Raspbian, for more info check out earlier blog post in the series at - Pi Control Hub: Spoke 1 :Security Camera - setting up Motion to stream video

    Good Luck - Carmelito

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • cortado
    cortado over 5 years ago

    Wwhat operating system are you using? I am on Hassio and cannot enable PI camera. Familiar with that?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • carmelito
    carmelito over 8 years ago in reply to trabzon61

    Hi - Do you see an image being created at /home/homeassistant/picamera/ and can you also execute chmod 777 on the folder, I know this is  bad idea , but it will help you rule out any permission issues.. Thanks - Carmelito

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • trabzon61
    trabzon61 over 8 years ago

    I am getting an error in section 4. Could you help?

    Security Camera(Error Loading Image)

     

    camera:

      - platform: rpi_camera

        name: Raspberry Pi Anlık Resim 

        image_width: 640 

        image_height: 480 

        image_quality: 7 

        image_rotation: 0 

        timelapse: 1000 

        horizontal_flip: 0 

        vertical_flip: 0 

        file_path: /home/homeassistant/picamera/image.jpg

      - platform: mjpeg 

        mjpeg_url: http://192.168.1.3:8081

        name: Security Camera

       

    panel_iframe:

      - intruder: 

        title: 'Intruder detection' 

        icon: 'mdi:nature-people' 

        url: 'http://192.168.1.3/' 

      - securitycam: 

        title: 'Security Cam' 

        icon: 'mdi:camera' 

        url: 'http://192.168.1.3:8081/'

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago

    Excellent project, carmelito! I got it working quickly.

     

    Question - does this only work with the pi camera attached to the pi running home assistant (on the same Pi) ?

     

    i want to have several cameras with photos on the hass dashboard, from different raspberry pi's, and run home assistant off on a separate, central server PI by itself.

     

    What at would I need to change to do this?

     

    Thanks for sharing your great tutorial!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube