Page 1 of 1

Having problems with push over

Posted: Thu Jul 07, 2022 4:00 pm
by timf
Hi guys,

hoping one of you can be kind enough to sort me out.

I've finally got round to looking at Pushover working with ZM and have my Pushover key and token etc.

I can send notifications from the Pushover app on my PC to my IOS phone ok and I think I have ZM set up correctly by following the guides and tips in this forum.

But it doesn't seem to work for me - I tried re-installing Ninja as I thought it might be a token problem on my phone but was surprised it still picked up on all my credentials and still didn't work.

I've tried with my credentials in the secrets.ini file and also directly in the pushoverapi.py just in case they weren't being picked up.

In the zmevent notification.ini file I have

Code: Select all



use_api_push = yes
api_push_script=/var/lib/zmeventnotification/bin/pushapi_pushover.py

[fcm]
# Use FCM for messaging (default: yes).
enable = no

# Use the new FCM V1 protocol (recommended)
use_fcmv1 = no

# if yes, will replace notifications with the latest one
# default: no
replace_push_messages = no

# Custom FCM API key. Uncomment if you are using
# your own API key (most people will not need to uncomment)
# api_key =

# Auth token store location (default: /var/lib/zmeventnotification/push/tokens.txt).
token_file = {{base_data_path}}/push/tokens.txt

I've tried various combinations of FCM and fcm_v1 enabled but figured they should both be left disabled.

Where should I look for the logs which may give a clue or have I overlooked something ?

Regards Tim

Re: Having problems with push over

Posted: Thu Jul 07, 2022 5:27 pm
by Magic919
Check your ZMES logs.

Re: Having problems with push over

Posted: Thu Jul 07, 2022 8:32 pm
by timf
Hi,

I've gone thru' most if not all of the logs and while there's quite a few errors (none of which seem to impact the operation of ZM + ML + ES) I can find no trace of anything related to pushapi_pushover.py.

So I ran it locally with the following result:

'

Code: Select all

tim@192.168.1.75:/var/lib/zmeventnotification/bin$ ./pushapi_pushover.py
Traceback (most recent call last):
  File "./pushapi_pushover.py", line 78, in <module>
    zmlog.init(name='zmeventnotification_pushapi')
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ZMLog.py", line 199, in init
    with open(f) as s:
PermissionError: [Errno 13] Permission denied: '/etc/zm/zm.conf
I also tried from the user version with the same result

Code: Select all

tim@192.168.1.75:~/zmeventnotification/pushapi_plugins$ ./pushapi_pushover.py
Traceback (most recent call last):
  File "./pushapi_pushover.py", line 79, in <module>
    zmlog.init(name='zmeventnotification_pushapi')
  File "/usr/local/lib/python3.8/dist-packages/pyzm/ZMLog.py", line 199, in init
    with open(f) as s:
PermissionError: [Errno 13] Permission denied: '/etc/zm/zm.conf'
tim@192.168.1.75:~/zmeventnotification/pushapi_plugins$ 
Looks like it could be a permissions problem - but have no idea where or how to fix it.

Edit - looking at how ZM reads the .conf files in order I don't think the above permissions error is a problem.

Generally ZM + Ml + ES are working fine, just not getting push alerts.

Any guidance greatly appreciated.

Regards Tim

Re: Having problems with push over

Posted: Sat Jul 09, 2022 11:57 am
by Magic919
Run it manually. Make sure you run it as your web user (maybe www-data) and pass it all the required info.

Re: Having problems with push over

Posted: Sat Jul 09, 2022 6:26 pm
by timf
Hi Magic

I notice the zmeventnotification_pushapi.log file is empty so I figure it's not getting called, but when I run

Code: Select all

sudo ./pushapi_pushover.py test
I get returned to the terminal prompt with no errors reported.

Looking at the script is should log an error due to lack of arguments ?

I had left FCM turned on and I get this

----> FORK:Front door (1), eid:69283 FCM push message Error:500 Can't connect to fcm.googleapis.com:443 (Temporary failure in name resolution)

but nothing about push-api errors ?

Any ideas on how to debug ?

Regards Tim

Re: Having problems with push over

Posted: Sat Jul 09, 2022 7:16 pm
by Magic919
You need to invoke the sudo and user correctly -

Code: Select all

sudo -u www-data /var/lib/zmeventnotification/bin/pushapi_pushover.py <eid> <mid>  <camera> <cause> event_start
That should pop straight through to Pushover if it's configured suitably.

Re: Having problems with push over

Posted: Sat Jul 09, 2022 7:26 pm
by timf
Thanks we just cross post as I've edited my previous post with my latest findings - I'll try what you suggest.

Many thanks Tim

Re: Having problems with push over

Posted: Sat Jul 09, 2022 7:34 pm
by timf
Ok, so I ran that command and got a bunch of errors, interestingly another failure in name resolution just like I had with FCM as mentioned above

Code: Select all

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.pushover.net', port=443): Max retries exceeded with url: /1/messages.json (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff602fdfd60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
I'll dig into my dns setting to see if there's anything amiss, maybe port 443 is being blocked somewhere ?

Regards Tim

Re: Having problems with push over

Posted: Sat Jul 09, 2022 7:45 pm
by timf
Nothing wrong with my dns and port 443 is open and being forwarded to ZM as HTTPS works fine.

The first error I get when running the script locally is this , again referring to failure in name resolution

Code: Select all


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
Then I get

Code: Select all

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 996, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 314, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7ff602fdfd60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
and so on till I get this at the end

Code: Select all

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.pushover.net', port=443): Max retries exceeded with url: /1/messages.json (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff602fdfd60>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

I'm out of my depth here, but going to keep digging.

Regards Tim

Re: Having problems with push over - Progress !

Posted: Sat Jul 09, 2022 8:16 pm
by timf
Ok- we have a break thru :-)

The problem was on the ZM linux box running Ubuntu and I had to edit resolv.conf and include 8.8.8.8 as a nameserver to make the manual call work.

When I trigger ZM / ES for real I now get a notification of movement but no image attached

Progress of sorts but not out of the woods yet !

Regards Tin

Re: Having problems with push over

Posted: Sat Jul 09, 2022 8:33 pm
by Magic919
I don’t get an image when I run that command, just an alert. Works with an image when ZM does it.

Re: Having problems with push over

Posted: Sat Jul 09, 2022 8:48 pm
by timf
Interesting you get an image when ZM triggers whereas I don't - more digging to do but at least pushover is working of sorts.

I'll have another go tomorrow and report back.

Still a little puzzled as to why the ZM linux box needed a dns address adding explicitly as the rest of the network is quite happy with the router as a gateway at 192.168.1.1 for dns stuff.

Basic problem is that my ZM box has been running for so long without any hassle I've forgotten how I set it up and how it all works etc.

Regards Tim

Re: Having problems with push over

Posted: Sun Jul 10, 2022 5:50 am
by Magic919
You can manually point it to the image path, by adding it to the end of the command I gave before.

https://github.com/ZoneMinder/zmeventno ... ushover.py

You can see in the code it looks for a few different JPEGs and sends one of those when it has an image path.

Re: Having problems with push over

Posted: Sun Jul 10, 2022 2:18 pm
by timf
Many thanks for all your help and guidance - all is working nicely now and I have signed up for two pushover accounts, one for myself and another for my partner.

The root cause of my problem was having the linux box set to a fixed IP which meant the network DHCP server didn't provide it with an IP address OR DNS addresses.

Regards Tim

Re: Having problems with push over

Posted: Sun Jul 10, 2022 2:51 pm
by Magic919
Your welcome. Sounds like you are all sorted now.