HIKIVISION API Python clients - frallain/wiki GitHub Wiki

https://pypi.python.org/pypi/hikvisionapi/0.1.7

https://pypi.python.org/pypi/hikvision/1.2

# This will use http by default (not https)
import hikvision.api
cam = hikvision.api.CreateDevice('192.168.2.5', username='admin', password='12345')
cam.get_version()
cam.get_about()
cam.enable_motion_detection()
cam.disable_motion_detection()
cam.is_motion_detection_enabled()
cam.put_motion_detection_xml()

fork of https://github.com/fbradyirl/hikvision

import hikvision.api
cam = hikvision.api.CreateDevice('192.168.2.5', username='admin', password='12345')

cam.get("System/time.timeMode")
'manual'
cam.get("System/deviceInfo.deviceName")
'D03'
cam.set("System/deviceInfo.deviceName","notD03")
1
cam.get("System/deviceInfo.deviceName")
'notD03'

cam.reboot()
cam.getImageFlip(channel=1)
cam.setImageFlip(value=False,channel=1)
"""set imageFlip to False (disabled), "LEFTRIGHT", "UPDOWN", or "CENTER" """

cam.setPTZAbs(elevation, azimuth, zoom, channel=1)
+        #in tenths of a degree, so 90.0* == 900 input
+        #elevation only accepts values between 0 and 900
+        #azimuth will only accept values between 0 and 3600
+        #zoom, i don't know. haven't tested at all
+        #values past those limits get converted to the limit they are closest to, e.g. negatives to 0, elevation > 900 to 900
+

cam.setDHCP()
if cam.rebootneeded:
    cam.reboot()

setNTP(self,ntp_server="0.north-america.pool.ntp.org",tz="EST-5:00:00")

setNTPServer(id=1, ntp_server="10.250.249.1")

getNTPServer(self,id=1)

""" not tested"""
setSSH(enable)
getSSH()

setName(self,name):
    return self.set("System/deviceInfo.deviceName",name)
getPresets(self):
    #/PTZCtrl/channels/ <ID> /presets
    pass
addPreset(self):
    pass
setPreset(self,presetid):
    #/PTZCtrl/channels/ <ChannelID> /presets/ <PresetID>
    #if already exists (use getPresets)
        #then make new preset by posting to /presets

delPreset(self,presetid):
    pass
runPreset(self,presetid=1,channelid=1):
    # /PTZCtrl/channels/ <ChannelID> /presets/ <PresetID> /goto
    #PUT to that URL, no data to make it go to that preset

delHomePosition(self):
    #DELETE to /PTZCtrl/channels/ <ChannelID> /homeposition

setHomePosition(self):
    #PUT to /PTZCtrl/channels/ <ChannelID> /homeposition, no data

runHomePosition(self):
    #PUT to /PTZCtrl/channels/ <ChannelID> /homeposition/goto, no data

ptzRelative(self,posX,posY,relZ, channel=1):
    """Move the position (expressed in pixels, posX and posY) to the center of the image by pan and tilt, and set the relative zoom (-100:100)"""
    """untested"""
⚠️ **GitHub.com Fallback** ⚠️