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

Enable/disable motion detection #129

Open
zetix opened this issue Oct 25, 2019 · 23 comments
Open

Enable/disable motion detection #129

zetix opened this issue Oct 25, 2019 · 23 comments

Comments

@zetix
Copy link

zetix commented Oct 25, 2019

The documentation states there is MotionDetection but does this allow the ability to enable/disable motion detection?

@pnbruckner
Copy link
Collaborator

Yes. See the motion_detection setter in motion_detection.py.

@zetix
Copy link
Author

zetix commented Mar 5, 2020

I can't seem to get the motion_detection to work.

Python version: 2.7.16
Raspberry Pi 3b running Raspbian
Installed python-amcrest with: sudo pip install amcrest
Installed argcomplete with: sudo pip install argcomplete
Enabled amcrest-cli autocomplete with:

sudo su
echo 'eval "$(register-python-argcomplete amcrest-cli)"' >  /etc/profile.d/amcrest-cli-autocomplete.sh

Tried running via python:

>>> from amcrest import AmcrestCamera
>>> camera = AmcrestCamera('192.168.1.225', 80, 'USER', 'PASS').camera
>>> camera.motion_detection(False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'unicode' object is not callable
>>> camera.motion_detection(True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'unicode' object is not callable

In Terminal:

pi@rpi3:~ $ amcrest-cli -H 192.168.1.225 -u USER -p PASSWORD --motion-detection False
No handlers could be found for logger "amcrest.http"
Traceback (most recent call last):
  File "/usr/local/bin/amcrest-cli", line 912, in <module>
    main()
  File "/usr/local/bin/amcrest-cli", line 887, in main
    camera.motion_detection = args.motion_detection
  File "/usr/local/lib/python2.7/dist-packages/amcrest/motion_detection.py", line 44, in motion_detection
    'setConfig&MotionDetect[0].Enable={0}'.format(opt.lower())
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 163, in command
    return self._command(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 203, in _command
    raise CommError(error)
amcrest.exceptions.CommError: 400 Client Error: Bad Request for url: http:https://192.168.1.225:80/cgi-bin/configManager.cgi?action=setConfig&MotionDetect%5B0%5D.Enable=false

Added the camera to ~/.config/amcrest.conf so the full path is /home/pi/.config/amcrest.conf and running it in Terminal:

pi@rpi3:~ $ amcrest-cli --camera room --motion-detection False
No handlers could be found for logger "amcrest.http"
Traceback (most recent call last):
  File "/usr/local/bin/amcrest-cli", line 912, in <module>
    main()
  File "/usr/local/bin/amcrest-cli", line 887, in main
    camera.motion_detection = args.motion_detection
  File "/usr/local/lib/python2.7/dist-packages/amcrest/motion_detection.py", line 44, in motion_detection
    'setConfig&MotionDetect[0].Enable={0}'.format(opt.lower())
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 163, in command
    return self._command(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 203, in _command
    raise CommError(error)
amcrest.exceptions.CommError: 400 Client Error: Bad Request for url: http:https://192.168.1.225:80/cgi-bin/configManager.cgi?action=setConfig&MotionDetect%5B0%5D.Enable=false

@pnbruckner
Copy link
Collaborator

camera.motion_detection(False)
Traceback (most recent call last):
File "", line 1, in
TypeError: 'unicode' object is not callable

The motion_detection setter takes a string, not a bool. So try this instead:

camera.motion_detection("false")

I don't know why it didn't work when you used the cli w/ Python 2. I'm only concerned with how this works with Home Assistant (which, BTW, uses only Python 3.) Maybe @tchellomello could look into those problems.

@pnbruckner pnbruckner reopened this Mar 5, 2020
@zetix
Copy link
Author

zetix commented Mar 5, 2020

I tried it with a string but I get the same error as without.

>>> camera.motion_detection("false")
Traceback (most recent call last)
File "<stdin>", line 1, in <module>
TypeError: 'Unicode' object is not callable

HTTP-API Version is 2.29
Firmware build is 2019-07-29

@pnbruckner
Copy link
Collaborator

Oh, wait, that's not how a setter is used. I should have said try this:

camera.motion_detection = "false"

@zetix
Copy link
Author

zetix commented Mar 5, 2020

It's showing the same error as when I type the amcrest-cli command from terminal.

>>> camera.motion_detection = "false"
No handlers could be found for logger "amcrest.http"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/amcrest/motion_detection.py", line 44, in motion_detection
    'setConfig&MotionDetect[0].Enable={0}'.format(opt.lower())
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 163, in command
    return self._command(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/amcrest/http.py", line 203, in _command
    raise CommError(error)
amcrest.exceptions.CommError: 400 Client Error: Bad Request for url: http:https://192.168.1.225:80/cgi-bin/configManager.cgi?action=setConfig&MotionDetect%5B0%5D.Enable=false

Also copying and pasting the url directly into my browser gives a bad request error. There's post on the Amcrest forum saying that the previous and current firmware released doesn't support setConfig for the API.

@pnbruckner
Copy link
Collaborator

Well, not much that can be done about that at this time. I've tried several times, through several different channels, to get Amcrest to admit that the HTTP API has changed and to provide a new spec that documents the new API. But they've consistently denied that the API has changed and have stated that there is no newer revision of the spec available. I've personally not updated the firmware in my cameras and have refrained from buying any new ones from Amcrest until they cease their denial and provide a new spec.

@zetix
Copy link
Author

zetix commented Mar 5, 2020

It's pretty sad cause the hardware and specs are great, but the software and support is really lackluster.

@Mark612
Copy link

Mark612 commented Mar 6, 2020

I also opened a support ticket on this issue. They concluded by closing the ticket as:
"_Good afternoon,

The R&D team is currently looking into this issue and update the firmware accordingly. Unfortunately at the moment we do not have an ETA on any release dates for further updates. I apologize for the inconvenience._"

@nfour14
Copy link

nfour14 commented Nov 25, 2020

Has this been resolved? I am looking to do the same (enable/disable motion detection).

@nfour14
Copy link

nfour14 commented Nov 25, 2020

On an IPM-721B when I try to set motion detection, I actually get a return of "OK"

http:https://X.X.X.X:8080/cgi-bin/configManager.cgi?action=setConfig&MotionDetect[0].Enable=true

But when I view it either via API or UI, it says its not enabled:

http:https://X.X.X.X:8080/cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect

I guess its still not working on Amcrest's end, but its certainly not giving me an error. Its just not working.

@nfour14
Copy link

nfour14 commented Nov 26, 2020

FYI - Looks like this is still broken according to Amcrest. Set commands do not work for motion detection. Unfortunately that will be the end of the road for me and Amcrest cameras.

@luisbattle
Copy link

I am having the same problem........... Always received OK but the Motion Detection not enable/disable.....
I can enable/disable from Android app only.
I leave one thing that listen events and take photography from api and then send the photography to telegram, may be you want improve and add new features for telegram ;)
https://github.com/luisbattle/amcrest-read-events-and-send-photo

@nfour14
Copy link

nfour14 commented Dec 28, 2020

Same, it works fine from their applications, but not from the API. Its on the Amcrest end. They are still not going to address it.
Its a bummer since I was going to script up some on/off times and movement.

I am having the same problem........... Always received OK but the Motion Detection not enable/disable.....
I can enable/disable from Android app only.
I leave one thing that listen events and take photography from api and then send the photography to telegram, may be you want improve and add new features for telegram ;)
https://github.com/luisbattle/amcrest-read-events-and-send-photo

@luisbattle
Copy link

My idea was to program the motion detection on and off by sending commands from telegram but we will have to wait for them to solve it, I hope it will be soon...

@nfour14
Copy link

nfour14 commented Jan 16, 2021

FYI - I have a new 841B v3 camera and the motion detection on/off seems to work now.

@luisbattle
Copy link

Hi @rtmgllc, I hope you are well.
Could you share the software camera version ?
I have this version:
Software VersionV2.420.AC00.18.R, Build Date: 2020-02-17

@nfour14
Copy link

nfour14 commented Jan 16, 2021

V2.800.0000000.6.R, Build Date: 2020-03-1

@luisbattle
Copy link

I am tryng access to amcrest website to check if new releases exists but the web doesnt work...........
image

@nfour14
Copy link

nfour14 commented Jan 16, 2021

The website is up, thats Cloudflare blocking you. Not sure why, sorry.

@luisbattle
Copy link

:(

@nfour14
Copy link

nfour14 commented Jan 17, 2021

Sadly, while motion detection on/off works on the 841, ptz control does not. On the 741 ptz control works, but motion on/off does not. :(

@nfour14
Copy link

nfour14 commented Jan 17, 2021

Luckily, you can use the ptz preset list to move the camera.

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

5 participants