ACTi Camera Agent
The ACTi Camera Agent is an OCS Agent which grabs screenshots from ACTi cameras and saves files to a directory.
usage: python3 agent.py [-h]
[--camera-addresses CAMERA_ADDRESSES [CAMERA_ADDRESSES ...]]
[--locations LOCATIONS [LOCATIONS ...]]
[--resolutions RESOLUTIONS [RESOLUTIONS ...]]
[--user USER] [--password PASSWORD]
[--mode {acq,test}]
Agent Options
- --camera-addresses
List of camera IP addresses.
- --locations
List of camera locations.
- --resolutions
List of resolution and quality. Ex: N640x480,100 where 100 is quality %.
- --user
Username of camera.
- --password
Password of camera.
- --mode
Possible choices: acq, test
Configuration File Examples
Below are configuration examples for the ocs config file and for running the Agent in a docker container.
OCS Site Config
To configure the ACTi Camera Agent we need to add a ACTiCameraAgent block to our ocs configuration file. Here is an example configuration block using all of the available arguments:
{'agent-class': 'ACTiCameraAgent',
'instance-id': 'cameras',
'arguments': [['--mode', 'acq'],
['--camera-addresses', ['10.10.10.41', '10.10.10.42', '10.10.10.43']],
['--locations', ['location1', 'location2', 'location3']],
['--resolutions', ['N640x480,100', 'N640x480,100', 'N640x480,100']],
['--user', 'admin'],
['--password', 'password']]},
Note
The --camera-addresses
argument should be a list of the IP addresses
of the cameras on the network.
The --locations
argument should be a list of names for camera locations.
This should be in the same order as the list of IP addresses.
The --resolutions
argument should be a list of resolutions for each camera.
For example, N640x480,100
gives a 640x480 image with 100% quality.
Docker Compose
The iBootbar Agent should be configured to run in a Docker container. An example docker-compose service configuration is shown here:
ocs-cameras:
image: simonsobs/socs:latest
hostname: ocs-docker
environment:
- INSTANCE_ID=cameras
- SITE_HUB=ws://127.0.0.1:8001/ws
- SITE_HTTP=http://127.0.0.1:8001/call
- LOGLEVEL=info
volumes:
- ${OCS_CONFIG_DIR}:/config:ro
- /mnt/nfs/data/cameras:/screenshots
user: 9000:9000
The LOGLEVEL
environment variable can be used to set the log level for
debugging. The default level is “info”.
The volume must mount to /screenshots
. The user must have permissions to write
to the mounted local directory.
Description
The ACTi cameras will be used to monitor conditions at the SO site.
The ACTi Camera Agent periodically (1 minute) grabs screenshots from each
camera on the network. The images are saved to a location on disk. A webserver
should then be configured to serve this directory to some URL. Then we can use
HTML to access the webserver and display latest.jpg
for an up-to-date
view of the camera. For example, this can be done directly in Grafana
using the Text panel in HTML mode.
Agent API
- class socs.agents.acti_camera.agent.ACTiCameraAgent(agent, camera_addresses, locations, user, password, resolutions=None)[source]
Grab screenshots from ACTi cameras.
- Parameters:
agent (OCSAgent) – OCSAgent object which forms this Agent
camera_addresses (list) – List of IP addresses (as strings) of cameras.
user (str) – Username of cameras.
password (str) – Password of cameras.
- agent
OCSAgent object which forms this Agent
- Type:
OCSAgent
- is_streaming
Tracks whether or not the agent is actively issuing requests to grab screenshots from cameras. Setting to false stops sending commands.
- Type:
bool
- log
txaio logger object, created by the OCSAgent
- Type:
txaio.tx.Logger
- acq(test_mode=False)[source]
Process - Grab screenshots from ACTi cameras.
- Parameters:
test_mode (bool, optional) – Run the Process loop only once. Meant only for testing. Default is False.
Notes
The most recent data collected is stored in session.data in the structure:
>>> response.session['data'] # for each camera {'location1': {'location': 'location1', 'last_attempt': 1701983575.032506, 'connected': True, 'address': '10.10.10.41'}, 'location2': ... }