I use MotionEye installed in docker and currently integrating it with HA, what I got so far:
Video stream:
In MotionEye enable âvideo streamingâ and you get MJPEG stream in port 8081 which you can set as camera component in HA or better set as âpicture-glanceâ in Lovelace-UI and youâll get live stream on frontend and because itâs not component it will not give connection errors like cameras usually do
Motion sensor:
In HA create binary sensor then in MotionEye enable âmotion detectionâ and in âmotion notificationsâ put two commands:
Run A Command:
curl -X POST -H âx-ha-access: PASSWORDâ -H âContent-Type: application/jsonâ -d â{âstateâ: âonâ, âattributesâ: {âfriendly_nameâ: âMotionâ,âdevice_classâ: âmotionâ}}â http://IP:8123/api/states/binary_sensor.motion
Run An End Command
curl -X POST -H âx-ha-access: PASSWORDâ -H âContent-Type: application/jsonâ -d â{âstateâ: âoffâ, âattributesâ: {âfriendly_nameâ: âMotionâ,âdevice_classâ: âmotionâ}}â http://IP:8123/api/states/binary_sensor.motion
Switches (work in progress)
To send commands from HA to MotionEye need to enable API (default port 7999), find âmotioneye.confâ and âmotion.confâ files and edit these lines:
motioneye.conf:
motion_control_localhost false
motion.conf:
webcontrol_parms 1
webcontrol_localhost off
in HA:
command_shell:
start_motion_detect: âcurl http://IP:7999/1/detection/startâ
pause_motion_detect: âcurl http://IP:7999/1/detection/pauseâ
Until here everything works.
Problem Iâm having is to get status state from this address:
http://IP:7999/1/detection/status
it returns HTML type:
<!DOCTYPE html>
<html>
<head><title>Motion 4.1</title></head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<body>
<a href=/1/detection><– back</a><br><br><b>Camera 1</b> Detection status PAUSE
</body>
</html>
and I donât know how to extract only one word from it, what need is only last word âPAUSEâ