Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement motion url detection #211

Open
fufurax opened this issue Mar 15, 2018 · 6 comments
Open

Implement motion url detection #211

fufurax opened this issue Mar 15, 2018 · 6 comments

Comments

@fufurax
Copy link

fufurax commented Mar 15, 2018

Hi,

I want to implement the GET motion url in SH scipts. Is it possible ?

I've try :
curl -i -su login:pass -H "Accept: application/json" -X GET http://192.168.1.110/motion

but the return is not good

HTTP/1.1 200 Ok
Server:
Date: Thu, 15 Mar 2018 12:05:11 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 1
Last-Modified: Tue, 01 Jan 1980 00:00:00 GMT
Connection: close

Sorry, i'm really not specialist.

Thanks

@Clem-
Copy link

Clem- commented Mar 28, 2018

Hi @fufurax,
Are you sure http://192.168.1.110/motion is returning something when calling it from your browser?
Maybe there's simply nothing more to return because no new motion had been detected.

@fufurax
Copy link
Author

fufurax commented Mar 28, 2018

Hi @Clem-

Nothing is return when call it from the browser. But it's strange because there is new mp4 files generated in record files

@Clem-
Copy link

Clem- commented Mar 28, 2018

The script only detects newer motion detection (for the last minute) : -mmin -1

You may want to update your code with this pull request that intends to improve this motion detection script.

@fufurax
Copy link
Author

fufurax commented Mar 28, 2018

@Clem-

In fact I want to use the motion detection of the camera to trigger events to Domoticz.

I can probably write a script in Domoticz to scan every 30 secondes to detect if motion has detected something but I think it's not the good solution.

Have you implement something like that arroud Yi cam ?

@Clem-
Copy link

Clem- commented Mar 28, 2018

Great idea! I'm also using Domoticz but never take the chance to develop that kind of feature.

You could simply follow my previous link to the pull request and make a GET request to Domoticz instead of POST for a notification.
See also Domoticz API in order to know which request to make depending on the event you want to trigger.

If you need further help with that feel free to ask.

@gitrc
Copy link

gitrc commented Apr 27, 2019

Hello. The kernel in this firmware supports inotify. I was able to compile inotifywait and use it to watch for new recordings and trigger an http endpoint using curl. Maybe you will find this helpful.

#!/bin/sh

poor mans motion sensor

/tmp/hd1/inotifywait -mrq -e CREATE --format %w%f /tmp/hd1/record_sub | while read FILE
do
case "$FILE" in
.tmp)
# Do stuff
/home/curl -s "http://my/endpoint?subject=room&message=motion" > /dev/null
;;
esac
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants