psyciknz / CameraEvents

Dahua NVR/Camera Alerting to MQTT. Fairly specific to my needs, but also an attempt at starting to use travis.
Eclipse Public License 2.0
58 stars 19 forks source link

"alerts" config parameter ignored #18

Open mcblok opened 3 years ago

mcblok commented 3 years ago

The script reads the alerts parameter in line 100: self.alerts = device_cfg.get("alerts")

but then overwrites this in line 563: self.alerts = True

I set alerts to False because I don't want this process to pull a snapshot image and publish large images as MQTT messages. There is also a known issue with the Dahua snapshot functionality that at times returns an internal server error after a long wait causing the event messages to be delayed. Thanks for sharing your work, it makes my cameras excellent motion detectors!

psyciknz commented 3 years ago

Ok I can look at that. I just verified it's still present in the alarm-local branch.

psyciknz commented 3 years ago

Are you docker, or install based? Want to pull and try the alarm-local branch......if you confirm its ok I'll do a pull request @mcblok

mcblok commented 3 years ago

Docker

psyciknz commented 3 years ago

docker pull psyciknz/cameraevents:alarm-local-latest

For the dev build. Then I can move the travis build to master once this branch is completed.

mcblok commented 3 years ago

Thanks for working on this. I pulled the latest and see the following error:

File "CameraEvents.py", line 909, in mqtt_on_connect if self.alerts: AttributeError: 'DahuaEventThread' object has no attribute 'alerts'

psyciknz commented 3 years ago

Ahh found that, I had to turning everything off from a different place, so it's now all part of that initial config (or via topic CameraEvents/<camera>/alerts Payload:b'OFF'

mcblok commented 3 years ago

The error is no longer there but it still publishes images with config entries "alerts=False" and "PostImagesToMQTT=False"

psyciknz commented 3 years ago

Ahh I was reading in that config value as a string.... I think I have it now. Just running with alerts=False.

The PublishImagesToMQTT looks like something I started adding but didn't complete....Iv'e mucked around with that a bit and now it will post a url to the json topic imageurl rather than the binary image. I was looking at something for homebridge.

I've let it build....but I'm still in the process of running it to make sure it all works. The alerts should do what you want now, just checking that the publishImages is right that took a bit ot tweaking to get it right.

psyciknz commented 3 years ago

I think I have this sorted now. Let me know if it works out for you.

mcblok commented 3 years ago

Great, it works now, thank you!