Python script to perform operations on Axis devices. Requires Python 3.8+. Some examples:
- Get supported events from a device, specifying credentials and IP address:
python3 device_tool.py -u root -p pass -c 192.168.1.3 -f GetEventInfo- As previous, but rely on the connection parameters of last eap-install.sh invocation (stored in .eap-install.cfg), which adds some convenience during ACAP development
python3 device_tool.py -f GetEventInfo- As 2, but print summary of GetEventInfo instead:
python3 device_tool.py -f GetEventInfo -d- Get serverreport of several cameras, using credentials from .eap-install.cfg on all devices
python3 device_tool.py -c 192.168.1.3 -c 192.168.1.4 -c 192.168.1.5 -f GetServerReport- See more options, and actual credentials in use:
python3 device_tool.py -h- Install ACAP (again), start it, wait two minutes, remove it
python3 device_tool.py -f "UploadAcap(filename=youracap_0_8_5_armv7hf.eap)" -f ListAcaps -f "StartAcap(package=youracap)" -f "Wait(seconds=120)" -f "RemoveAcap(package=youracap)" -f ListAcapsFurthermore the -r option is usefull to see nicely formatted flow of data, especially for requests to /vapix/services.
| Name | Function |
|---|---|
| EnableSSH | Enables SSH on the device (needs Axis OS 5.60 or higher) |
| FactoryDefault | Performs factory default while keeping the IP address |
| GetEventInfo | Shows the list of supported events, for use in metadata subscription requests |
| GetServerReport | Create and download a serverreport |
| GetSomeInfo | Example parameter request, getting several items at once but not the full list |
| GetSystemLog | Retrieves the system log |
| HardfactoryDefault | Performs hard factory default |
| ListAcaps | Lists the installed ACAPs |
| ListFeatureFlags | Lists the supported feature flags |
| PerformTrace | Make the device perform a network trace |
| Reboot | Restarts the device |
| RemoveAcap | |
| RestartAcap | |
| StartAcap | |
| StopAcap | |
| UploadAcap | |
| IOOn | Set an output pin |
| IOOff | Reset an output pin |
| VirtualIOOn | Set a virtual input |
| VirtualIOOff | Reset a virtual input |
| ManualTriggerOn | Set the manual trigger |
| ManualTriggerOff | Reset the manual trigger |
| IOPulse | Set, wait, reset an output pin |
| MQTTActivate | Enable the MQTT client |
| MQTTDectivate | Disable the MQTT client !}!BC!}!@C!~!> |
| MQTTConfig | Configure the MQTT client |
| MQTTGetConfig | Retrieve the MQTT client configuration |
| MQTTGetEventPublications | Retrieve the MQTT event publications |
| MQTTRemoveEventPublications | Remove all MQTT event publications |
| MQTTAddEventPublications | Configure a new list of MQTT event publications |
| MQTTAddEventPublication | Add a single MQTT event publications |
| GetDot1XConfiguration | Returns the IEEE 802.1X configuration |
| SetDot1XConfiguration | Sets the IEEE 802.1X configuration |
| AddDot1XCACertName | Adds a certificate for RADIUS server cert verification |
| RemoveDot1XCACertName | Removes a certificate for RADIUS server cert verification |
| GetCACertificates | Returns the list of installed CA certificates |
| DeleteCertificate | Removes a certificate from the device |
| LoadCACertificate | Loads a CA certificate to the device |
| Wait | Inserts a delay, usefull when executing a series of functions |
The output from GetEventInfo shows each events' "nice name" followed by a specification for use directly in event metadata subscriptions. For example, given this output:
CameraApplicationPlatform
Blocked View Detection - Blocked View Detection eventtopic=axis:CameraApplicationPlatform/BlockedViewDetection/BlockedViewDetection
Loitering Guard - Loitering Guard: Any Profile eventtopic=axis:CameraApplicationPlatform/LoiteringGuard/Camera1ProfileANY
Loitering Guard - Loitering Guard: Profile 1 eventtopic=axis:CameraApplicationPlatform/LoiteringGuard/Camera1Profile1
Video Motion Detection - VMD 4: Any Profile eventtopic=axis:CameraApplicationPlatform/VMD/Camera1ProfileANY
Video Motion Detection - VMD 4: Profile 1 eventtopic=axis:CameraApplicationPlatform/VMD/Camera1Profile1
You can start listening to VMD 4 detections for all profiles on the RTSP metadata stream as follows:
rtsp://a.b.c.d/axis-media/media.amp?video=0&audio=0&event=on&eventtopic=axis:CameraApplicationPlatform/VMD/Camera1ProfileANY
The Axis Metadata Monitor is very usefull for this. A commandline alternative is my script axis_websocket_events which listens to the same events, but over websocket instead. It's README show it use for the same event. It is similar, you just need to leave out the RTSP-url specific "eventtopic=" prefix.
This software is distributed under the MIT license.