ZoneMi...:Dahua(3pm)
π NAME π
ZoneMinder::Control::Dahua β it's the Perl module for Dahua cameras, bestie. That's the manual page Dahua(3pm), section 3pm, the Perl-module section, iykyk. Camera control, but make it Perl. π
β¨ SYNOPSIS β¨
use ZoneMinder::Control::Dahua;
and you place it in /usr/share/perl5/ZoneMinder/Control. That's it, that's the whole entrance exam. π
πΈ DESCRIPTION πΈ
This module is an implementation of the Dahua IP camera HTTP control API. Like, it talks to your camera over HTTP so you don't have to. Periodt. π¦
π COPYRIGHT AND LICENSE π
Copyright (C) 2018 ZoneMinder LLC
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Slay, freedom. π
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. (ngl that's the standard legal disclaimer, not me being dramatic β well, mostly.) π
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
π«Ά Private Methods π«Ά
Methods intended for use internally but documented here for future developers. So like, they're private but the door's unlocked for the next dev. π«Ά
_sendAbsolutePositionCommand( $arg1, $arg2, $arg3, $arg4 )
Where:
$arg1= Horizontal angle 0Β° to 360Β°$arg2= Vertical angle 0Β° to -90Β°$arg3= Zoom multiplier$arg4= Speed 1 to 8
This is a private method used to send an absolute position command to the camera. π
π Public Methods π
Methods made available to control.pl via ZoneMinder::Control. These are the ones out here living their main character era. β¨
Notes:
Which methods get invoked depends on which types of movement are selected in the camera control type. For example: if the 'Can Move Continuous' option is checked, then methods including 'Con' in their names are invoked. Likewise if the 'Can Move Relative"' option is checked, then methods including 'Rel' in their names are invoked.
At present, these types of movement are prioritized and exclusive. This applies to all types of movement, not just PTZ, but focus, iris, etc. as well. The options are tested in the following order:
- Continuous
- Relative
- Absolute
These types are exclusive, meaning the first one that matches is the one ZoneMinder will use to control with. It would be nice to allow the user to select the type used given that some cameras support all three types of movement. (lowkey a feature request hiding in the docs, love that for them π)
new
This method instantiates a new control object based upon this control module and sets the 'id' attribute to the value passed in. Fresh object, new era. π¦
open
This method opens an HTTP connection to the camera. It handles authentication, etc. Upon success it sets the 'state' attribute to 'open.' π
close
This method effectively closes the HTTP connection to the camera. It sets the 'state' attribute to 'close.' πͺ
printMsg
This method appears to be used for debugging. (appears to be. even the docs are like "idk, it prints things." π)
moveCon<direction>
This set of methods invokes continuous movement in the direction indicated by the <direction> portion of their name. They accept no arguments and move the camera at a speed of 1 for 0ms. The speed index of 1 is the lowest of the accepted range of 1-8.
NOTE: This is not true continuous movement as currently implemented. π
focusCon<range>
This set of methods invokes continuous focus in the range direction indicated by the <range> portion of their name. They accept no arguments.
NOTE: This is not true continuous movement as currently implemented. π
moveRel<direction>
This set of methods invokes relative movement in the direction indicated by the <direction> portion of their name. They accept no arguments and move the camera at a speed of 4 for 500ms. The speed index of 4 is half-way between the accepted range of 1-8.
focusRel<range>
This set of methods invokes relative focus in the range direction indicated by the <range> portion of their name. They accept no arguments.
NOTE: This only just does work. The Dahua API specifies "multiples" as the input. We pass in a1for that as it does not seem to matter what number (0-8) is provided, the camera focus behaves the same. π
irisRel<Large/Small>
This set of methods invokes relative iris size in the direction indicated by the <Large/Small> portion of their name. They accept no arguments.
NOTE: This only just does work. The Dahua API specifies "multiples" as the input. We pass in a1for that as it does not seem to matter what number (0-8) is provided, the camera iris behaves the same. π
moveStop
This method attempts to stop the camera. The problem is that if continuous motion is occurring in multiple directions, this will only stop the motion in the 'Up' direction. Dahua does not support an "all-stop" command. So like, it's giving "stop" but only in one specific direction, bestie. π
presetHome
This method "homes" the camera to a preset position. It accepts no arguments. When either continuous or relative movement is enabled, pressing the center button on the movement controls invokes this method.
NOTE: The Dahua protocol does not appear to support a preset Home feature. We could allow the user to assign a preset slot as the "home" slot. Dahua does appear to support naming presets which may lend itself to this sort of thing. At this point, we'll just send the camera back to center and zoom wide. (0Β°,0Β°,0) π
reset
This method will reset the PTZ controls to their "default." It is not clear what that is. (iconic, honestly. nobody knows. not even the module. π
)
reboot
This method performs a reboot of the camera. This will take the camera offline for the time it takes to reboot. Heads up β camera's gonna ghost you for a minute there. π
and that's the whole page, bestie π
Written by perl v5.40.1, dated 2026-02-01, and yes the original header line was all ZoneMi...:Dahua(3pm) at both ends β we folded the title in at the top and the version/date into this little sign-off instead of copy-pasting the header/footer. π β¨ π«Ά
π¦ where this page comes from
- ubuntu resolute: zoneminder 1.36.37+dfsg1-1 Β· GPL-2.0-or-later
- ubuntu stonking: zoneminder 1.36.37+dfsg1-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms