Code examples
Small programs for common integration tasks. Download one file, run its demo and inspect the result.
On this page
Start here#
The ten Python examples use only the standard library and work with Python 3.11 or later. Use python or python3, depending on your installation. No API key, broker or equipment is needed for the demos.
python examples/python/video_storage.py --demo
python examples/python/trace_events.py --demo
python examples/python/modbus_read.py --demo
Download all examples or browse the source folder. Each article includes its complete source, input format and limits. Go, C, TypeScript and C# examples need their respective compiler or SDK.
For a simple local menu, run:
python examples/run.py
The menu only runs the ten offline Python demos. Use python examples/run.py --test to run all ten and validate their JSON output.
Choose a task#
| Example | Language | What it does |
|---|---|---|
| HTTPS JSON read | Python | Read one HTTPS health endpoint with certificate validation and a bounded JSON response. |
| ONVIF device information | Python | Send a read only GetDeviceInformation request to one ONVIF device service over HTTPS. |
| MQTT event validation | Python | Check an MQTT topic and JSON event against a small, explicit application contract. |
| Modbus register read | Python | Read holding or input registers from one authorised Modbus TCP endpoint. |
| RTSP and SDP inspection | Python | Inspect the media descriptions in a saved RTSP DESCRIBE response. |
| Event trace normalisation | Python | Validate saved JSONL events and convert their occurrence timestamps to UTC. |
| Mutual TLS health client | Go | Read a health endpoint using a validated server certificate and your own client certificate. |
| WebSocket event reader | TypeScript | Read a short stream of door state events over WSS using Node and its native WebSocket API. |
| Modbus RTU frame and CRC | C | Check the size, fields and CRC of a captured Modbus RTU register response. |
| Timestamp normalisation in C# | C# | Keep event occurrence and receipt times separate while converting both to UTC. |
| Video storage calculator | Python | Estimate continuous recording capacity from measured bitrate, retention and free space requirements. |
| TLS certificate expiry check | Python | Check the certificate presented by one TLS endpoint without bypassing chain or hostname validation. |
| SQLite event deduplication | Python | Store an event once and detect an identity reused with different content. |
| Webhook signature verification | Python | Verify an HMAC signature over an unchanged request body and its timestamp. |
Before connecting to equipment#
Run the demo first. Network requests need an explicit endpoint and authorisation. There is no subnet scanning, automatic discovery or physical actuation in these programs. Modbus reads use ordinary TCP and need an appropriately isolated network.
Local tests exercise the parsers and the HTTPS, SOAP, mutual TLS, WSS and Modbus clients against fixture services. The C# project includes a test mode, but runtime validation remains outstanding. Run its test command with .NET 10 before relying on it. No example is represented as tested against all products or firmware.
The JSON event and health formats are application contracts defined by the examples. Check your endpoint's actual schema before adapting a client.