Difference between revisions of "Openhab"
From ZoneMinder Wiki
Jump to navigationJump to search
Biloxigeek (talk | contribs) |
Biloxigeek (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Openhab == | == Openhab == | ||
Looking to | 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 | ||
** The monitors populate pretty easily. I haven't gotten the image or video URLs working yet. | |||
* 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 | ||
** Example: door open sensor turns light on and causes a zoneminder monitor to start recording for a specified period of time | ** Example: door open sensor turns light on and causes a zoneminder monitor to start recording for a specified period of time | ||
Line 13: | Line 15: | ||
== Executing local scripts == | == Executing local scripts == | ||
Some scripting ideas: | |||
=== Switch PTZ camera between night/day modes === | |||
executeCommandLine(Duration.ofSeconds(10), "/etc/openhab/bin/set_zm_camera_day.sh") | executeCommandLine(Duration.ofSeconds(10), "/etc/openhab/bin/set_zm_camera_day.sh") | ||
Line 34: | Line 38: | ||
/root/bin/get_zones.pl -s active -z zone-front-day-preset | /root/bin/get_zones.pl -s active -z zone-front-day-preset | ||
* This seems to be working pretty well. | * This seems to be working pretty well. Requires ssh keys so the openhab user can login to zoneminder server. If zm and openhab were on the same server that would be easier. | ||
* A second script on both systems that does the opposite, turns the day zone to inactive, moves the camera to it's night setting and then activates the night zone |
Latest revision as of 10:10, 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
- The monitors populate pretty easily. I haven't gotten the image or video URLs working yet.
- 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
Some scripting ideas:
Switch PTZ camera between night/day modes
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. Requires ssh keys so the openhab user can login to zoneminder server. If zm and openhab were on the same server that would be easier.
- A second script on both systems that does the opposite, turns the day zone to inactive, moves the camera to it's night setting and then activates the night zone