This document provides a step by step guide to enabling visualization of some of the MV Cameras sensor data and snapshots, augmented with Image Analysis from AWS Regoknition, using NodeRED as a User Interface.
The high level flow is as follows:
The solution has been tested against the following:
Ubuntu 18.04.2 LTS
Python 3.6.8
boto3==1.9.181
paho-mqtt==1.4.0
configparser==5.0.0
paho-mqtt==1.4.0
NodeRed v1.0.4
Meraki Camera Firmware v4.3
$virtualenv venv
$source venv/bin/activate
$git clone https://github.com/andersm9/Meraki-Computer-Vision
$cd Meraki-Computer-Vision
$pip3 install -r requirements.txt
Create and configure the 'credentials.ini' file as per the instructions below:
#Meraki dashboard credentials
[meraki]
#Primary API key for admin account, with access to one or more orgs
key = **your_dash_API_key**
#e.g. key = 187cd12d3957a98c598cd560d7290c56cd786cd89c
#Personal org's network ID that contains cameras
network = **your_NW_ID**
#e.g. network = L_543212345678917680
#For MV Sense MQTT
[sense]
serial = **camera_serial**
#e.g. serial = Q4EV-HXLN-QGGY
#Server address and port
[server]
ip = **server_URL**
#e.g. ip = ec2-54-171-108-161.eu-east-1.compute.amazonaws.com
The 'credentials.ini' file should reside in the same directory as the 'meraki_cv.py' script
The solution is currently designed for a single camera.
The administrator that created your API key needs full access (read-only will not supply a snapshot URL via the API)
You can check the operation of the snapshot API with the following command:
curl -L -H 'X-Cisco-Meraki-API-Key: <api_key>' -X POST 'https://api.meraki.com/api/v0/networks/<Net_ID>/cameras//snapshot'
e.g.
curl -L -H 'X-Cisco-Meraki-API-Key: 1xbxbb3b5xb2b2b0ab7350d72b0cb7cdd8d9033e' -X POST 'https://api.meraki.com/api/v0/networks/L_176760844512417683/cameras/Q2EV-HYLV-THHY/snapshot'
Cameras - Camera – Settings - Sense - Enable
Cameras - Camera – Settings - Zones
Cameras - Camera – Settings - Sense - Add or edit MQTT Brokers
Your server IP, port 1883, security "None"
Note your camera’s published topics e.g. /merakimv/Q2SV-HTLN-QFGY/light
Install node.js and Node-RED on your server:
$sudo apt-get install -y nodejs
$sudo apt-get install npm
$sudo npm install -g --unsafe-perm node-red
Start Node-RED (manually) e.g. on ubuntu
$node-red
optionally – Use PM2 to start node-red on boot (Ubuntu):
$sudo npm install -g pm2
optionally Configure PM2 on Ubuntu:
$pm2 start /usr/local/bin/node-red -- -v
Ref: https://nodered.org/docs/getting-started/running
c) Open Firewall ports:
Open the following incoming TCP ports on the security group for your server:
1880 (Node-RED GUI)
1883 (MQTT)
d) Navigate to the Node-RED configuration page at:
http://yourserver:1880
e) Install Mosca MQTT Broker
Start- Manage Palette - Install - ; node-red-contrib-mqtt-broker
f) Install NodeRed Dashboard
Start - Manage Palette - Install - node-red-dashboard
g) Import the following flow: (start - import - clipboard - select a file to import)
https://github.com/andersm9/Meraki_NodeRED/blob/master/Flow
**Update this when ready**
h) Press Import;
i) Press Deploy;
UI should be available at http://yourserver:1880/ui, (though not yet receiving any MQTT feeds)
j) Subscribe to your cameras MQTT topic in NodeRed:
/merakimv/your-camera-serial/light
e.g.:
/merakimv/ Q2SV-HTLN-QFGY/light
merakimv/your-camera-serial/your-zone-ID
e.g.:
/merakimv/ Q2SV-HTLN-QFGY/676665844012417062
Repeat for the other zone topic in the other mqqt in node
i) Press Deploy
Install the following script on your server in the same directory as the “credentials.ini” file created earlier”
https://github.com/andersm9/NodeRed_AWS_Rekognition/blob/master/AWS_Rek6.py
Start the python script:
$python3 meraki_cv.py
You should now see (in the NodeRed GUI) a graphical readout of luminosity, people counting by Zone, AWS Rekognition emotion/gender/age, object detection, text detection and a snapshot.
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community