Difference between revisions of "Openhab"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 1: Line 1:
== Openhab ==
== Openhab ==


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


=== Tasks ===
=== Tasks ===
* Getting the openhab binding for zoneminder working
* Getting the openhab binding for zoneminder working
** Got the bridge working, had to get a '''Let's Encrypt''' certificate working on the zoneminder apache setup since I wanted to keep it working https only
* Setting up things/items in openhab that will link image and video streams into openhab
* 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
* Rules that can be triggered from events in openhab to cause zoneminder functions

Revision as of 10:01, 2 September 2023

Openhab

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

Tasks

  • Getting the openhab binding for zoneminder working
    • Got the bridge working, had to get a Let's Encrypt certificate working on the zoneminder apache setup since I wanted to keep it working https only
  • 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