Real time event notification with zmNinja (0.81+)

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Real time event notification with zmNinja (0.81+)

Post by asker »

Updated Oct 24 2015:

As of release 0.83 push notifications are fully supported for both iOS and Android.
You need the latest event server from here

Enabling push notifications is easy. Just follow these steps. The push notification server is running at my home, so please be kind with the amount of pushes you do. I strongly encourage you to use reporting interval filters (new feature starting zmNinja 0.83)


HERE is a demo on an android phone lying around.
HERE is a demo on an iPhone

For this to work, you need to :
  • install the new Zoneminder event server HERE and have it configured and running. Make sure you enable push proxy and read its instructions.
  • Configure zmNinja to use the event server - the URL MUST be of the format wss://<hostname or ip>:<port>. Unless you change something the hostname is the same as ZM's hostname and port is 9000
  • Make sure the event server is reachable from the phone (if that means opening up a firewall port, then please do so)
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
aaronl
Posts: 33
Joined: Wed Aug 19, 2015 9:11 pm

Re: Real time event notification with zmNinja (0.81+)

Post by aaronl »

Notes on getting this to run on ubuntu 14.04

1) The CPAN install of Crypt::MySQL failed wanting a SHA1 Digest package. So installed via apt instead:

Code: Select all

sudo apt-get install libcrypt-mysql-perl
2) The CPAN install of WebSockets failed with "make not ok".

Code: Select all

sudo apt-get install libyaml-perl
sudo apt-get install make
Now webSockets installed :D

There was an issue with the -T flag in the script. syslog states that the '-T' must be also be on the command line. I commented out for now, but that's not the best choice.

syslog now says this every few minutes:

Code: Select all

zmdc[18313]: INF ['zmeventnotification.pl' started at 15/10/13 16:49:09]
zmdc[18092]: ERR ['zmeventnotification.pl' exited abnormally, exit status 9]
The command zmeventnotification.pl is also missing from the process list (ps aux)...

I'm still working on validating that I have everything else correct...
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Real time event notification with zmNinja (0.81+)

Post by asker »

Awesome - thanks for trying.

1) Please don't run it via zmdc for now.

Can you please run it manually "sudo ./zmeventnotification.pl" and then see? (logs will still go to syslog)
(Before you do this make sure you kill it and also remove it from zmdc restart otherwise it will keep getting restarted, or just change the port in the code before you run it from command line)

I've had mine running for 2 weeks now - ubuntu 14


2) What is the exact syslog issue with -T ? I don't see any on mine
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
aaronl
Posts: 33
Joined: Wed Aug 19, 2015 9:11 pm

Re: Real time event notification with zmNinja (0.81+)

Post by aaronl »

running it on command line gives:

Code: Select all

Can't locate JSON.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at ./zmeventnotification.pl line 48
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Real time event notification with zmNinja (0.81+)

Post by asker »

Huh. It was there in mine

Code: Select all

apt-get install libjson-perl
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
aaronl
Posts: 33
Joined: Wed Aug 19, 2015 9:11 pm

Re: Real time event notification with zmNinja (0.81+)

Post by aaronl »

Just found it, mine has JSON::XS, which is some accelerated version of it.
http://packages.ubuntu.com/trusty/amd64 ... l/filelist
For now I modified the script to

Code: Select all

use JSON::XS;
and it launches by hand, no errors.
I also put the -T option back in, that was my bad, I was running it on the command line as "perl ./zmeventnotification.pl". Once I let the shell launch the perl interpreter that complaint went away.


Aaron
aaronl
Posts: 33
Joined: Wed Aug 19, 2015 9:11 pm

Re: Real time event notification with zmNinja (0.81+)

Post by aaronl »

pop, pop go the events! :P
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Real time event notification with zmNinja (0.81+)

Post by asker »

Okay, please keep it running in this mode (command line) and try it with zmNinja to make sure its able to parse the JSON objects etc before you move it to zmdc

Thanks!
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Real time event notification with zmNinja (0.81+)

Post by asker »

Yay! That ding is king!
aaronl wrote:pop, pop go the events! :P
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Real time event notification with zmNinja (0.81+)

Post by asker »

And now, iOS push notifications


However, till I host my own server, it still won't work for you. If you are an iOS developer and have access to iOS member center,
you can generate your own push certificates and use the experimental branch of zmeventserver
https://github.com/pliablepixels/zmeven ... perimental
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Post Reply