rxseger / homebridge-camera-motion

Motion detector camera plugin for Homebridge
MIT License
48 stars 9 forks source link

MotionDetection Always off #4

Closed Minims closed 7 years ago

Minims commented 7 years ago

Hi, first thanks for your job on home bridge :-)

I've setup the plugins as describe :

    "platforms": [
        {
                "platform": "CameraMotion",
                "name": "Camera",
        "name_motion": "Motion Sensor",
        "motion_pipe": "/tmp/motion-pipe",
        "motion_timeout": 2000,
        "snapshot_path": "/tmp/lastsnap.jpg",
        "ffmpeg_path": "/root/arm/bin/"
        }
    ]

set a minimal conf for motion :

videodevice /dev/video0
stream_port 8081
stream_localhost off
despeckle EedDl
smart_mask_speed 0
webcontrol_localhost off
webcontrol_port 8082
rotate 180
height 1080
width 1920
output_pictures off
on_picture_save printf '%f\t%n\t%v\t%i\t%J\t%K\t%L\t%N\t%D\n' > /tmp/motion-pipe
target_dir /tmp

node -v v7.4.0

But in Homkit, it says moving sensor is ready, but it's always stay on off status . Any idea why ?

[2017-1-8 23:16:01] [homebridge-camera-motion.CameraMotion] CameraMotion Platform Plugin starting null
uuid= 4da9c9af-9631-4e29-8961-d5a16fdc681c
[2017-1-8 23:16:01] [Camera] published camera
[2017-1-8 23:16:01] Homebridge is running on port 51826.
[2017-1-8 23:16:01] Camera is running on port 39981.

Thx for you help. Alex

srob commented 7 years ago

I have the same issue. The movement sensor is never activated.

Otherwise this plugin is very promising.

Minims commented 7 years ago

Maybe this is working with a special motion config / version ? i've try The mkfifo on /tmp/motion-pipe before running homebridge and motion, but nothing change.

MrsDelish commented 7 years ago

Be sure the user running motion has write access to your fifo, and the user running homebridge has read access. fifo pipe gets reset on each reboot, so it needs to be fixed after boot.

to check who owns and who has permission:

cd /tmp
ls -la

you can use motion webadmin, usually on port 8082 to make a snapshot and check if motion is triggered.

I use crontab to run a script at boot to fix mine first go to home cd then crontab -e

add to the end of your file @reboot /home/pi/homebridge-fixfifo.sh

content of my homebridge-fixfifo.sh (set to the user running homebridge, I run with user pi)

#!/bin/bash
mkfifo /tmp/motion-pipe
chmod 777 /tmp/motion-pipe
chown pi:motion /tmp/motion-pipe

(to make this python script nano homebridge-fixfifo.sh paste, cmd + x , y , enter )

test the commands so they work without sudo, you probably want to be in the same groups, as the users you choose to chown to.

remember to set executable chmod +x homebridge-fixfifo.sh

Minims commented 7 years ago

@MrsDelish It works, thx a lot. Don't know why i haven't check this before opening this issue :/

The problem is on rpi reboot as you mentioned. With your script everything is fine now. I've put it on rc.local instead of crontab because i have some problems with @reboot on raspbian.