1.34.12 and zmNinja Android 1.4.005 API problem

Discussion topics related to mobile applications for ZoneMinder
Post Reply
denvid
Posts: 12
Joined: Thu Jan 10, 2019 10:27 am

1.34.12 and zmNinja Android 1.4.005 API problem

Post by denvid » Tue May 12, 2020 4:01 pm

after starting Zmninja it is showing the message "API Access Error". If I run zmNinja, first a small message on top comes up "Zoneminder authentication success". Then a lot of times messages in the midde of the windows are popping up:
- authenticating
- authenticating via web scrape

Then after some repeats of this popup windows:
API Access error
API access failed. Please make sure your APIs are configurred correctly and are accessible.

Sometimes I can see for a short time the message:
Login validated but API failed.
Please check settings


Following the information I found here https://zmninja.readthedocs.io/en/lates ... g-api.html I tried everything as described:

I checked http://myserverip/zm/api/host/getVersion.json from the phone and also http://myserverserverip/zm/api/monitors.json getting some reasonable results.

I also checked:
AUTH_RELAY is set to hashed
A valid AUTH_HASH_SECRET is provided (not empty)
AUTH_HASH_IPS is disabled
OPT_USE_APIS is enabled


ZmNinja 1.4.005 on an Android 10 phone.
I did a fresh server install of Zoneminder 1.34.12 on Ubuntu 18.04 LTS.
I tried with both, checked and uncheck in webend: Option => System => OPT_USE_AUTH to get the monitor running on the webend.

Any ideas?
Thanx for each help!

User avatar
asker
Posts: 1305
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by asker » Tue May 12, 2020 5:18 pm

First, https://zmninja.readthedocs.io/en/lates ... ort-errors (general comment, and emphasis on debug logs)
after starting Zmninja it is showing the message "API Access Error". If I run zmNinja, first a small message on top comes up "Zoneminder authentication success". Then a lot of times messages in the midde of the windows are popping up:
- authenticating
- authenticating via web scrape
If you are running ZM 1.34 and you get to "web scrape" you haven't checked your ZM install correctly. Try going to zmNinja->Clear API cache, exit app and do it again. If you still see the same issue read on:
Following the information I found here https://zmninja.readthedocs.io/en/lates ... g-api.html I tried everything as described:

I checked http://myserverip/zm/api/host/getVersion.json from the phone and also http://myserverserverip/zm/api/monitors.json getting some reasonable results.
What does "some reasonable results" mean? Did you see the API results? Did you inspect source and see if there were any cake-php errors like the instructions describe? You might have, but for me to help you, it will help a lot if you are as specific as possible and as detailed as possible.

Some other notes:
1. Always try to use the desktop version first, it is easier to debug
2. Keep desktop window debug window on to see what is going on
(all of this is in the FAQ)
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

denvid
Posts: 12
Joined: Thu Jan 10, 2019 10:27 am

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by denvid » Wed May 13, 2020 6:22 pm

Hi, thank you very much for your help. I went again to all your informations, zmNinja on Windows Dekstop is working fine without any problems.
Just zmNinja on my Android phone is not working. After checking again I noticed, that
http://server/zm/api/events.json
is showing an error:

Code: Select all

{"success":false,"data":{"name":"Not Authenticated","message":"Not Authenticated","url":"\/zm\/api\/events.json","exception":{"class":"UnauthorizedException","code":401,"message":"Not Authenticated"}}} 
Same URL on my Windows desktop in the same network is not showing a problem.

So next I tested from another Android device and ..... wondering .... zmNinja works like a charme out of the box.

What´s working well on my mobile:
http://192.168.50.2/zm/api/host/getVersion.json

Code: Select all

{"version":"1.34.12","apiversion":"2.0"}
http://192.168.50.2/zm/api/monitors.json

Code: Select all

{"monitors":[{"Monitor":{"Id":"1","Name":"01-Carport-HD","Notes":"Carport in HD","ServerId":"0","StorageId":"3","Type":"Ffmpeg","Function":"Modect","Enabled":"1","LinkedMonitors":null,"Triggers":"","Device":"","Channel":"0","Format":"0","V4LMultiBuffer":null,"V4LCapturesPerFrame":"1","Protocol":null,"Method":"rtpRtsp","Host":null,"Port":"","SubPath":"","Path":"rtsp:\/\/admin:Hans2345@192.168.50.101:554\/Streaming\/Channels\/101","Options":null,"User":null,"Pass":null,"Width":"2688","Height":"1520","Colours":"3","Palette":"0","Orientation":"ROTATE_0","Deinterlacing":"0","DecoderHWAccelName":null,"DecoderHWAccelDevice":null,"SaveJPEGs":"3","VideoWriter":"2","OutputCodec":null,"OutputContainer":null,"EncoderParameters":"# Lines beginning with # are a comment \r\n# For changing quality, use the crf option\r\n# 1 is best, 51 is worst quality\r\n#crf=23","RecordAudio":"0","RTSPDescribe":false,"Brightness":"-1","Contrast":"-1","Hue":"-1","Colour":"-1","EventPrefix":"Event-","LabelFormat":"%N - %d\/%m\/%y %H:%M:%S","LabelX":"0","LabelY":"0","LabelSize":"1","ImageBufferCount":"20","WarmupCount":"0","PreEventCount":"5","PostEventCount":"10","StreamReplayBuffer":"0","AlarmFrameCount":"1","SectionLength":"600","MinSectionLength":"10","FrameSkip":"0","MotionFrameSkip":"0","AnalysisFPSLimit":null,"AnalysisUpdateDelay":"0","MaxFPS":null,"AlarmMaxFPS":null,"FPSReportInterval":"100","RefBlendPerc":"12","AlarmRefBlendPerc":"6","Controllable":"0","ControlId":null,"ControlDevice":null,"ControlAddress":null,"AutoStopTimeout":null,"TrackMotion":"0","TrackDelay":null,"ReturnLocation":"-1","ReturnDelay":null,"DefaultRate":"100","DefaultScale":"100","DefaultCodec":"auto","SignalCheckPoints":"0","SignalCheckColour":"#0000be","WebColour":"#d0f655","Exif":false,"Sequence":"1","TotalEvents":"2622","TotalEventDiskSpace":"22656677389","HourEvents":"48","HourEventDiskSpace":"1184645513","DayEvents":"420","DayEventDiskSpace":"5659730552","WeekEvents":"2622","WeekEventDiskSpace":"22656677389","MonthEvents":"2622","MonthEventDiskSpace":"22656677389","ArchivedEvents":null,"ArchivedEventDiskSpace":null,"ZoneCount":"1","Refresh":null},"Monitor_Status":{"MonitorId":"1","Status":"Connected","CaptureFPS":"9.09","AnalysisFPS":"6.67","CaptureBandwidth":"209743"}},

......... etc.......
So it looks like, that API on Zoneminder is working well isn´t it?
Looks like that there is a problem with my mobile. It´s not rooted, just a standard stock P30 where I don´t have any problems with other apps.

The phone, where zmNinja is not working is a Huawei P30 modell ELE-L29
Build-Number: 10.0.0.190(C431E22R2P5patch01)
EMUI-Version 10.0.0.190Android Version 10

Any idea why my phone is not working well with zmNinja?

Again, thank you very much!

User avatar
asker
Posts: 1305
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by asker » Wed May 13, 2020 10:11 pm

So zmNinja is not working just on one device? If so, then:

1. Clear API cache in that device, exit app try again
2. Make sure settings are correct on that device (I've had many situations where a person made a data entry error)
3. If all else fails, go to settings of zmNinja, disable cloud backup. Exit the app. Delete the app. Re-install again and test.
4. If problem persists, please send debug logs.
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

denvid
Posts: 12
Joined: Thu Jan 10, 2019 10:27 am

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by denvid » Wed May 20, 2020 10:03 am

Hi, even I tried a few times exactly what you said, clearing the cache, reinstall, cloud backup is disabled etc. Now, before posting again I tried another time with the same result which means an api error pops up. It´s very curiouse because as I said before zmNinja 1.4.007 works on another Android mobile within the same network and has api access to my zoneminder 1.34.12 server. So maybe, it depends on th Huawei P30 and I doublechecked my phone but I couldn´t find and hints which are blocking the communication on the mobile phone.
More curiouse, I have another older zoneminder 1.32 install and access from this zmNinja 1.4.007 app on the same Huawei P30 works without any problems to the older zoneminder software.

Please find the debug log here:
https://paste.debian.net/1147830/

Looking forward to your feedback

User avatar
asker
Posts: 1305
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by asker » Wed May 20, 2020 11:31 am

Try this:
- Go to ZM->Options->System, disable "Enable CSRF magic" - looks like it is on

Does it work?
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

denvid
Posts: 12
Joined: Thu Jan 10, 2019 10:27 am

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by denvid » Wed May 20, 2020 6:56 pm

Hurray!!! At the end of the day it works! Thank you very much!
You are right, "Enable CSRF magic" was enabled. If you refered this in the FAQ and I didn´t noticed, sorry about.
To get it running, I first disabled "Enable CSRF magic". Then, to get zmNinja working I had to delete cache and data on the mobile phone and after a new app setup the monitors are comming up. Great :D

User avatar
asker
Posts: 1305
Joined: Sun Mar 01, 2015 12:12 pm

Re: 1.34.12 and zmNinja Android 1.4.005 API problem

Post by asker » Thu May 21, 2020 4:14 pm

No, it was not in the FAQ as far as the connection issues is concerned, but I just added it after this thread
https://zmninja.readthedocs.io/en/lates ... ion-issues
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest