I use some python scripts to do object detection and send notifications via Pushover or email. The scripts access the ZoneMinder API via the requests python module. When setting up the monitors, I get the monitor ID as follows:
Code: Select all
# Send request for api_path/monitors.json prior to this and return the response as 'r'
rj = r.json()
for item in rj['monitors']:
monitor = {}
try:
monitor['id'] = int(item['Monitor_Status']['MonitorId'])
monitor['name'] = item['Monitor']['Name']
except TypeError:
# Print a debugging message (not shown here)
continue