ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
412 stars 128 forks source link

trailing spaces are not trimmed when reading from zmeventnotification.ini #311

Closed akamel001 closed 4 years ago

akamel001 commented 4 years ago

Before you create an issue, please make sure you have read the README. If you are asking about the object detection part, I don't provide support for it unless you've tried hard enough.

Event Server version 5.15.6-Docker

The version of ZoneMinder you are using: v1.34.21

What is the nature of your issue Trailing spaces in configs are not trimmed.

Details I was attempting to use MQTT and added the following block in the zmeventnotification.ini

# MQTT server (default: 127.0.0.1)
server = 10.1.2.3 #<- there is an extra space character here

Debug Logs (if applicable)


ONSOLE INF:2020-10-14,18:45:10 PARENT: |------- Starting ES version: 5.15.6-Docker ---------|
10/14/20 18:45:10.120676 zmeventnotification[4237].INF [main:888] [PARENT: |------- Starting ES version: 5.15.6-Docker ---------|]
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: Started with: perl:/usr/bin/perl and command:/usr/bin/zmeventnotification.pl
Can't ignore signal CHLD, forcing to default.
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: ES invoked manually. Will handle restarts ourselves
CONSOLE DBG-2:2020-10-14,18:45:10 PARENT: Parent<--Child pipe ready
CONSOLE INF:2020-10-14,18:45:10 PARENT: Event Notification daemon v 5.15.6-Docker starting

10/14/20 18:45:10.188253 zmeventnotification[4237].INF [main:888] [PARENT: Event Notification daemon v 5.15.6-Docker starting]
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: Initializing FCM tokens...
CONSOLE INF:2020-10-14,18:45:10 PARENT: Initializing MQTT connection...
10/14/20 18:45:10.190201 zmeventnotification[4237].INF [main:888] [PARENT: Initializing MQTT connection...]
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: Intialized MQTT with auth
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: Total event client connections: 1

CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: -->checkNewEvents: Connection 1: ID-> IP->(none) Token->:... Plat: Push:
CONSOLE INF:2020-10-14,18:45:10 PARENT: Re-loading monitors
10/14/20 18:45:10.191628 zmeventnotification[4237].INF [main:888] [PARENT: Re-loading monitors]
CONSOLE DBG-1:2020-10-14,18:45:10 PARENT: ESCONTROL_INTERFACE is disabled. Not saving control data
CONSOLE DBG-2:2020-10-14,18:45:10 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-14,18:45:10 PARENT: About to start listening to socket
CONSOLE INF:2020-10-14,18:45:10 PARENT: Secure WS(WSS) is enabled...
10/14/20 18:45:10.194536 zmeventnotification[4237].INF [main:888] [PARENT: Secure WS(WSS) is enabled...]
CONSOLE INF:2020-10-14,18:45:10 PARENT: Web Socket Event Server listening on port 9000
10/14/20 18:45:10.195724 zmeventnotification[4237].INF [main:888] [PARENT: Web Socket Event Server listening on port 9000]
CONSOLE DBG-2:2020-10-14,18:45:15 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-10-14,18:45:15 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-10-14,18:45:15 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-10-14,18:45:15 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-14,18:45:15 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-10-14,18:45:15 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-10-14,18:45:20 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-10-14,18:45:20 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-10-14,18:45:20 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-10-14,18:45:20 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-14,18:45:20 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-10-14,18:45:20 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-10-14,18:45:25 PARENT: ---------->Tick START<--------------
CONSOLE DBG-3:2020-10-14,18:45:25 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 1, FCM+WEB: 0, FCM: 0, WEB: 0, MQTT:1, invalid WEB: 0, PENDING: 0
CONSOLE DBG-2:2020-10-14,18:45:25 PARENT: There are 0 active child forks...
CONSOLE DBG-2:2020-10-14,18:45:25 PARENT: checkEvents() new events found=0
CONSOLE DBG-2:2020-10-14,18:45:25 PARENT: There are 0 new Events to process
CONSOLE DBG-2:2020-10-14,18:45:25 PARENT: ---------->Tick END<--------------
CONSOLE DBG-2:2020-10-14,18:45:30 PARENT: ---------->Tick START<--------------
CONSOLE DBG-2:2020-10-14,18:45:30 PARENT: MQTT tick interval (15 sec) elapsed.

10.1.2.3 :1883 **THIS IS A DEBUG LINE I ADDED in /usr/local/share/perl/5.26.1/Net/MQTT/Simple.pm

Expected 'PeerService' at /usr/local/share/perl/5.26.1/Net/MQTT/Simple.pm line 159.

Thanks!

pliablepixels commented 4 years ago

good catch. could you check master and validate if it resolves the issue?

akamel001 commented 4 years ago

Yup that fixed it! Thanks!