Openhab

From ZoneMinder Wiki
Jump to navigationJump to search

Openhab

Looking to working up some documention for integrating zoneminder and openhab.

Tasks

  • Getting the openhab binding for zoneminder working
  • Setting up things/items in openhab that will link image and video streams into openhab
  • Rules that can be triggered from events in openhab to cause zoneminder functions
    • Example: door open sensor turns light on and causes a zoneminder monitor to start recording for a specified period of time

Notes

I'm just starting down this path myself and wanted to document my efforts so it might be a bit easier for others in the future

Executing local scripts

Openhab script:

executeCommandLine(Duration.ofSeconds(10), "/etc/openhab/bin/set_zm_camera_day.sh")


That script connects to the zoneminder server over ssh using an RSA key for authentication and runs /root/bin/set_camera_day.sh:

#!/usr/bin/bash

# Turn off nightime zone
/root/bin/get_zones.pl -s inactive -z zone-camera-night-preset

# move camera to day preset
/usr/bin/zmcontrol.pl --id 100 --command="presetGoto" --preset 3

# Make sure the camera move has time to complete
sleep 5

# Turn on nighttime zone
/root/bin/get_zones.pl -s active -z zone-front-day-preset
  • This seems to be working pretty well. Need to setup ssh keys so the openhab user can login to icezone server. If zm and openhab were on the same server that would be easier.
  • A second script on either side of that does the opposite, turns the day zone to inactive, moves the camera to it's night setting and then activates the night zone