Bug? API Call to disable Motion Email returns 200 but doesn't update

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
BurntTech
Posts: 6
Joined: Fri Jan 04, 2019 3:13 pm

Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by BurntTech »

I have a sample script and the output showing that the API doesn't work even though it has reported that it was a successful 200 response code. I've tried a bunch of different ways of setting the value like 1 vs 0 or true vs false and others but nothing seemed to work. I don't want to disable the motion detection or the cameras ability to send emails globally, I only want to disable the use SMTP(email) alerts for motion alerts

Here is the output

Code: Select all

192.168.0.11 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.11 is Setting Email to false
<Response [200]>
OK

192.168.0.11 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.12 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.12 is Setting Email to false
<Response [200]>
OK

192.168.0.12 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.13 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.13 is Setting Email to false
<Response [200]>
OK

192.168.0.13 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=true

192.168.0.14 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=false

192.168.0.14 is Setting Email to false
<Response [200]>
OK

192.168.0.14 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=false

192.168.0.15 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=false

192.168.0.15 is Setting Email to false
<Response [200]>
OK

192.168.0.15 is Getting Email value 
<Response [200]>
table.MotionDetect[0].EventHandler.MailEnable=false
Related test code

Code: Select all

def setmotionemail(ip,boolEmail):

    urlconfig = 'http://' + ip + '/cgi-bin/configManager.cgi'

    urlsetmotion = '?action=setConfig&MotionDetect[0].EventHandler.MailEnable=' + boolEmail

    print(ip + ' is Setting Email to ' + boolEmail)
    r = requests.get(urlconfig + urlsetmotion, auth=authcreds)
    print(r)
    print(r.text)
    
def getmotionemail(ip):
    urlconfig = 'http://' + ip + '/cgi-bin/configManager.cgi'

    urlgetmotion = '?action=getConfig&name=MotionDetect[0].EventHandler.MailEnable'

    print(ip + ' is Getting Email value ')
    r = requests.get(urlconfig + urlgetmotion, auth=authcreds)
    print(r)
    print(r.text)
    
 if __name__ == '__main__':
    authcreds = HTTPDigestAuth('admin', 'admin')
    ipcams = ['192.168.0.11', '192.168.0.12', '192.168.0.13', '192.168.0.14', '192.168.0.15']
    for ip in ipcams:
        getmotionemail(ip)
        setmotionemail(ip,'false')
        getmotionemail(ip)
    
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

Maybe need little more info about the device you are trying to work with.

If there is something there that might work and if Gary happens to see your post I am sure he will be more then willing to help..

I do know that it is easy on my 7108 to turn off Emails being sent however that is a DVR and might not be same type of device your working with.
Be Safe.
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

So I did just run this command to one of my Recorders and I then ran the check and said it was enabled so I ran the first command again this time with false and ran the check command again and now says disabled so here is what I ran maybe it will work for you. I did run on my NVR so might be different on a camera. I will make some changes to my set up as most of my Cameras are not behind a POE nvr today.. Once I get one and setup email again on it I will try and see if it works on any of my cameras as well..
need the http and other before it however this is what I ran and it does enable with false in the place of true it turns it off... Change the IP address to your range and try that see if it works for you

10.0.0.225/cgi-bin/configManager.cgi?action=setConfig&Email.Enable=true

this is what I ran to check the stat of

10.0.0.225/cgi-bin/configManager.cgi?action=getConfig&name=Email
Be Safe.
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

Also thought I should mention that running these commands out side of your own network or if there is any things listening to your network the data that is returned when you do a Get will be in plain text and does provide your email and password to the email server... Just in case your on a Remote connection
Be Safe.
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

Ok so I do have a 841V3 that isn't connected to a NVR and it was setup for Email. I found that the command for checking the Email info works good news is for that camera anyway it returns **** for password unlike my NVR's

Also the command to enable and disable works as well and was able to turn it off with command as stated above..

That camera does have the newest 2021 FW
Be Safe.
BurntTech
Posts: 6
Joined: Fri Jan 04, 2019 3:13 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by BurntTech »

I have IP8M-T2669EW-AI and IP8M-2696EW-AI . There isn't any NVR in this setup. The script runs in the internal network
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

Again Sorry you having some issues. I can tell you that as I did in my last message that the CGI commands that I provided in this thread work on my 841V3 and I just moved my 8mp v2 camera from one of my NVRs to my Local Network same way I accessed my 841v3 and I can turn on and off my Email with that command on that camera as well. It is a Amcrest IP8M2496EW-V2 with 2021 FW installed..

VIew the Email Info as stated above post with make sure to use your cameras IP and not mine..

10.0.0.225/cgi-bin/configManager.cgi?action=getConfig&name=Email

table.Email.Address=smtp
table.Email.Anonymous=false
table.Email.AttachEnable=true
table.Email.Authentication=true
table.Email.Enable=true
table.Email.HealthReport.Enable=false
table.Email.HealthReport.Interval=3600
table.Email.OnlyAttachment=false
table.Email.Password=******
table.Email.Port=587
table.Email.Receivers[0]=revo2maxx
table.Email.SendAddress=xadmin
table.Email.SendInterv=0
table.Email.SslEnable=false
table.Email.Title=8mp Event
table.Email.TlsEnable=false
table.Email.UserName=xadmin

Change the Email on and Off with changing from true to turn on and false to turn off

10.0.0.225/cgi-bin/configManager.cgi?action=setConfig&Email.Enable=true
Be Safe.
BurntTech
Posts: 6
Joined: Fri Jan 04, 2019 3:13 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by BurntTech »

Changing the Email.Enable vs MotionDetect[0].EventHandler.MailEnable disables all email. I would like to keep alarm emails enabled.

dome
V2.800.00AC000.0.R, Build Date: 2020-09-21

bullet
V2.800.00AC001.0.R, Build Date: 2021-08-10

Ref=Amcrest http api 9.2020.pdf
https://drive.google.com/file/d/1VM2Tb- ... UuTR-/view
4.8.1 Motion Detection Settings
User avatar
Revo2Maxx
Site Admin
Posts: 6726
Joined: Sat Jun 15, 2019 3:05 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by Revo2Maxx »

Ok Thanks.

Sorry your right it isn't working for the Command to a 2021 FW camera. It does however work for a 2018 FW camera.. I will look at some other CGI versions to find the one that is needed for the new FW camera if there are any.. As times go by things change a little and make it harder to send commands to new FW cameras..
Be Safe.
BurntTech
Posts: 6
Joined: Fri Jan 04, 2019 3:13 pm

Re: Bug? API Call to disable Motion Email returns 200 but doesn't update

Post by BurntTech »

should i submit a bug or can this be fixed?
Post Reply