Page 1 of 1

Integration with home automation

Posted: Tue Feb 04, 2020 7:16 am
by torkilt
Hi

I have both indoor and outdoor cameras hooked up to zoneminder with zmninja. I use OpenHAB for home automation. I would like to be able to create alarm modes I can control in OpenHAB, so I can do stuff like "Turn off indoor alarm".

I presume it can be done either in zoneminder or in zmeventserver by REST API? Which would be the better/easier way?

Thanks,

Torkil

Re: Integration with home automation

Posted: Tue Feb 04, 2020 2:16 pm
by asker
There are multiple options.
1. You use ZM APIs
2. You use zmtrigger.pl
3. You use pyzm

Re: Integration with home automation

Posted: Wed Feb 05, 2020 7:22 am
by torkilt
asker wrote:
Tue Feb 04, 2020 2:16 pm
There are multiple options.
1. You use ZM APIs
2. You use zmtrigger.pl
3. You use pyzm
Thanks.

I guess I can't do what I wanted that way, which is keeping morecord on but not get alarms in zmninja. That way I would still get faces cropped and saved for recognition.

But I can use either to change the mode from morecord til just record, which will do.

Mvh.

Torkil

Re: Integration with home automation

Posted: Wed Feb 05, 2020 2:24 pm
by asker
torkilt wrote:
Wed Feb 05, 2020 7:22 am

I guess I can't do what I wanted that way, which is keeping morecord on but not get alarms in zmninja. That way I would still get faces cropped and saved for recognition.
I might not be understanding the situation clearly, but you can always turn off notifications in zmNinja. That has no effect on the ES processing unknown faces or doing detection on events.

Re: Integration with home automation

Posted: Wed Feb 05, 2020 4:02 pm
by torkilt
asker wrote:
Wed Feb 05, 2020 2:24 pm
torkilt wrote:
Wed Feb 05, 2020 7:22 am

I guess I can't do what I wanted that way, which is keeping morecord on but not get alarms in zmninja. That way I would still get faces cropped and saved for recognition.
I might not be understanding the situation clearly, but you can always turn off notifications in zmNinja. That has no effect on the ES processing unknown faces or doing detection on events.
Then I would have to do it in the app? I didn't find a way to turn of notifications for one or more zmnimja apps through any of the APIs. I want to do it through voice control and/or presence detection, like "Alexa, turn off alarm" or detecting my devices via mac or Bluetooth.

Mvh.

Torkil

Re: Integration with home automation

Posted: Wed Feb 05, 2020 4:50 pm
by asker
Notifications and APIs are completely unrelated.

You can turn off zmNinja notifications by:
a) Turning off event server support in the zmNinja app in which case it won't receive ANY push notifications
b) Turning off notification for a specific monitor. You do this by going to the app->Settings->EventServer->and turn off a specific monitor

All this does is ensure zmNinja does not get notifications. The ES continues to process events

Re: Integration with home automation

Posted: Wed Feb 05, 2020 5:05 pm
by torkilt
asker wrote:
Wed Feb 05, 2020 4:50 pm
Notifications and APIs are completely unrelated.

You can turn off zmNinja notifications by:
a) Turning off event server support in the zmNinja app in which case it won't receive ANY push notifications
b) Turning off notification for a specific monitor. You do this by going to the app->Settings->EventServer->and turn off a specific monitor

All this does is ensure zmNinja does not get notifications. The ES continues to process events
Aye, so as I suspected. Doing it in the app is not an option, so flipping between record and mocord will have to do.

Thanks.

Torkil

Re: Integration with home automation

Posted: Wed Feb 05, 2020 7:02 pm
by asker
If you can better describe your use-case there may be a simple solution.
You could manually edit tokens.txt and remove the tokens you don't want, or disable them but the next time zmNinja starts it will re-activate them.

But I can very easily add server side controls for it, assuming it is useful - and for that I need to understand the motivation b better.

Re: Integration with home automation

Posted: Wed Feb 05, 2020 10:07 pm
by torkilt
asker wrote:
Wed Feb 05, 2020 7:02 pm
If you can better describe your use-case there may be a simple solution.
You could manually edit tokens.txt and remove the tokens you don't want, or disable them but the next time zmNinja starts it will re-activate them.

But I can very easily add server side controls for it, assuming it is useful - and for that I need to understand the motivation b better.
I have a couple indoors cameras for which I would like to receive notifications in zmninja when it detects persons, but only if no-one is home. My wife would like to receive notifications as well. There's also an almost adult child who comes and goes on her own.

It would soon become tedious if both of us had to juggle our own notifications in the app every time we get an benign alarm.

One solution is presence detection based on our telephones so it would all run automatically whenever we connect or disconnect from wifi. Another way would be a voice command or smart switch just inside the front door. It can be done by switching the cameras from mocord to record through the API but then I lose the ability to collect mugshots to improve known face detection.

I hope that better describes it. An way to disable zmninja notifications for given or all clients for a given monitor through a REST call would be perfect.

Re: Integration with home automation

Posted: Wed Feb 05, 2020 10:13 pm
by asker
Good use case. I can use it myself. Can you create a GH issue in zmeventnotification? I’ll think about a clean approach. It would likely be via the existing web sockets channel. Would that be ok?

Re: Integration with home automation

Posted: Thu Feb 06, 2020 6:43 am
by torkilt
asker wrote:
Wed Feb 05, 2020 10:13 pm
Good use case. I can use it myself. Can you create a GH issue in zmeventnotification? I’ll think about a clean approach. It would likely be via the existing web sockets channel. Would that be ok?
Great, I'll create an issue =)

It looks like OpenHAB doesn't have a websocket client but it does have a binding for running a shell script, so I guess that would do just fine.