MotionEyeOS Intergration? (Security Camera intergration)

I have a small set of Raspberry Pi’s running cameras with motion detection software…

Is it possible to embed the webpage inside of HA? Ideally what I would like is a single DNS point in my router to HA which would allow me to navigate to a sub page, being the camera web page output by Motion Eye OS.

Thanks,
Calvin

I don’t think it’s possible to embed the page, but why don’t you just display the latest image from motioneye in the HASS GUI? I’m doing that and it works perfectly.

Well I’d be happy to give that a try if I could peek at your code sample!

I’ve got 2 cameras and I already enjoy the ability to log in & see “history” of picture taken as I am often away from home for days.

Calvin

I’m just grabbing the latest image using the still image URL provided in MotionPie. It should be off one of the menus

In configuration.yaml

camera: !include devices/cameras.yaml

In cameras.yaml

- platform: generic still_image_url: http://192.168.1.111/picture/1/current/?_username=admin&_signature=a0af5abe1f90ebedd7bdf3fc26331efc52e5c1dc name: Internal House scan_interval: 60

Obviously replace the URL with the one you get from Motionpie. I haven’t checked if you can grab older pictures, but have a look around, there might be a way.

2 Likes

Many thanks to RSACHOC, I was able to get this to work! Multiple cameras even.

It wasn’t readily obvious to me where the “still_image_url” is derived in MotionEyeOS but it may be found within the MotionEyeOS tools, Video Streaming, Snapshot_URL. Simply copy the text from there & paste in the sample cameras.yaml.

This will permit you to pull your latest picture from MotionEyeOS camera and display it in HA. (Single IP address to multiple address within the house via HA).

It still would be nice to see HA pass the MotionEyeOS and support the other features such as Action buttons, and the ability to see stored pictures/ movies.

Calvin

Thanks for the clue. I compared both Generic and MJPEG and in my side, the MJPEG seems to be more responsive.

have you tried to get motion events from MotionEye?

What does that signature mean? I tried to use the password for my MotionEyeOS, but I receive an error “unauthorized”

It’s my unique link for my MotionEye setup, you’ll need to get yours per the instructions above

Any ideas?
P.S i used the user login i created for each camera not the admin login.

heres an example of windows with python opencv face and eye recognition:

paste this file version 3.4.1 to C:\Python27\Lib\site-packages

run this python script:

import numpy as np
import cv2

# multiple cascades: https://github.com/Itseez/opencv/tree/master/data/haarcascades

#https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_frontalface_default.xml
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
#https://github.com/Itseez/opencv/blob/master/data/haarcascades/haarcascade_eye.xml
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
  ##replace videocapture with () for default windows cam.
cap = cv2.VideoCapture('http://remoteipaddress:port/?action=stream')


while 1:
    ret, img = cap.read()
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)

    for (x,y,w,h) in faces:
        cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
        roi_gray = gray[y:y+h, x:x+w]
        roi_color = img[y:y+h, x:x+w]
        
        eyes = eye_cascade.detectMultiScale(roi_gray)
        for (ex,ey,ew,eh) in eyes:
            cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)

    cv2.imshow('img',img)
    k = cv2.waitKey(30) & 0xff
    if k == 27:
        break

cap.release()
cv2.destroyAllWindows()

I tried them both and indeed I find MJPEG to be better.
However, I do constantly get an error:

Log Details (WARNING)
Wed Mar 14 2018 21:53:48 GMT-0700 (PDT)

Failed to parse headers (url=http://192.168.1.XX:8081/): [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ‘’
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 399, in _make_request
assert_header_parsing(httplib_response.msg)
File “/usr/lib/python3.6/site-packages/urllib3/util/response.py”, line 66, in assert_header_parsing
raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
urllib3.exceptions.HeaderParsingError: [StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()], unparsed data: ‘’

Does this happen to you as well?

i use to get that error with my cameras, but my cameras work fine now with athe newest version 0.66.0, anyways this is what i used to mask those errors even though it was working fine.

logger:
  default: warning
  logs:
    requests.packages.urllib3.connectionpool: critical

mine was for the connection pool in urllib3 obviously.

I think that you can have webpages embedded in HA using the iframe component.

panel_iframe:
  weewx:
    title: 'Weather'
    icon: 'mdi:weather-lightning-rainy'
    url: 'http://myserver/weewx/'