Skip to content

amadeusweber/onvif-time-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onvif-time-sync

Set cameras time via ONVIF

Configuration

Use the cams.conf-file to configure access to all cameras. For every camera, provide a block as follows:

[CameraName]
host: <ip adress of camera>
port: <onvif port e.g 2020>
user: <http basic auth user>
pass: <http basic auth password>

Running the API

The API can be launched in two ways: either directly via python or via docker.

Python

Install the requirements from src/requirements.txt.

One option is to create a virtual environment:

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r src/requirements.txt

Then you can simply run the src/app.py

python3 src/app.py

Docker

To launch the app in a docker container, there is the compose.yaml.

Start the docker container by executing the following command in the working directory:

docker-compose up -d

This will build the docker image and launch a container on port 5000. Modify the compose.yaml as needed.

This will launch the API on port 5000.

Usage

To invoke the time setting function for a camera, call the API with the camera name, specified in the cams.conf:

http://127.0.0.1:5000/Cam1

Possible results are:

  • 200: Time set successfully
  • 404: Camera name not in config
  • 500: Camera not reachable

References