axis-camera-preconfig 0.1.0
Axis Camera Pre-Configuration Utility
Requires Python: >=3.8

# Axis Camera Pre-Configuration Utility

A professional desktop application that streamlines the initial setup of factory-new Axis IP cameras through an all-in-one solution with built-in DHCP server, camera discovery, and batch configuration capabilities.

## Purpose

The Axis Camera Pre-Configuration Utility is an internal tool designed to streamline the pre-configuration process for multiple new Axis cameras. It creates an "all-in-one" solution that applies identical baseline settings to many cameras connected to a dedicated switch before they are shipped to the company that will ultimately manage them.

While you may process thousands of cameras in total, each batch is limited to the number of PoE ports on a single switch at a time. This utility significantly reduces the time and effort required by:

1. Running a custom DHCP server directly within the application to assign temporary IP addresses
2. Automatically discovering Axis cameras that receive these temporary DHCP addresses
3. Configuring all cameras simultaneously with identical credentials and optimized settings
4. Creating detailed reports for handoff to final configuration with Axis Device Manager
5. Providing real-time feedback and error handling throughout the process

The application features a modern, responsive interface that adapts to window resizing and saves your preferences between sessions.

## Features

- **Integrated DHCP Server**: 
  - Eliminates the need for external DHCP services
  - Configurable IP ranges and lease times
  - Proper resource management with automatic cleanup

- **Advanced Camera Discovery**: 
  - Intelligent identification of Axis cameras from DHCP leases
  - Differentiation between camera models
  - Progress reporting during the discovery process

- **Batch Configuration Engine**:
  - Parallel processing for faster configuration of multiple cameras
  - Creates administrator accounts on all cameras simultaneously
  - Sets up ONVIF users for third-party management system compatibility
  - Optimizes camera settings (disables WDR and Replay Attack Protection)
  - Automatic retry mechanisms for transient network issues

- **User-Friendly Interface**:
  - Adapts to window resizing with responsive two-column layout
  - System light/dark theme adaptation
  - Real-time logging and progress visualization
  - Persistent user preferences between sessions

- **Robust Error Handling**: 
  - Comprehensive error detection and recovery
  - Detailed, actionable error messages
  - Troubleshooting guidance for common issues
  - Graceful recovery from partial failures

- **Comprehensive Reporting**: 
  - CSV report generation with all camera details
  - Configuration status for each camera
  - Timestamp tracking for audit purposes

## Compatibility

This utility was designed and tested specifically for:
- **Primary Camera Model**: Axis P-3267-LV
- **Firmware Version**: AXIS OS 10.12
- **Compatible With**: Other AXIS network cameras with similar firmware versions

### Important Note on Newer Firmware
This tool has **not been tested** with AXIS OS 12 and higher, which:
- Assigns default IP addresses in the 169.254.x.x subnet
- Uses link local addressing rather than traditional factory defaults
- May require different discovery and configuration approaches

For cameras running OS 12+, we recommend testing with a single camera before attempting batch configuration.

## System Requirements

### Hardware
- Computer with at least one available wired network adapter
- Sufficient network switch with PoE capabilities for Axis cameras
- Physical connection between the computer, switch and cameras

### Software
- **Operating System**: Windows 10/11, macOS 10.14+, or Linux (Ubuntu 20.04+ recommended)
- **Python**: Version 3.8 or higher
- **Permissions**: Administrator privileges required (especially for DHCP functionality)
- **Network**: Ability to configure static IP on the host computer's network adapter

## Installation

### Step 1: Set up your environment
1. Clone this repository or download and extract the zip file
2. Open a command prompt or terminal in the extracted directory
3. Create a virtual environment:
   ```
   python -m venv venv
   ```

### Step 2: Activate the virtual environment
- **Windows**:
   ```
   venv\Scripts\activate
   ```
- **macOS/Linux**:
   ```
   source venv/bin/activate
   ```

### Step 3: Install dependencies
```
pip install -r requirements.txt
```

### Step 4: Run the application
- **Windows**:
   ```
   python run.py
   ```
   Or use the included batch file:
   ```
   run_app.bat
   ```
- **macOS/Linux**:
   ```
   python run.py
   ```
   Or use the included shell script:
   ```
   ./run_app.sh
   ```

## Detailed Usage Guide

### 1. Network Setup
1. **Configure your host PC network adapter**:
   - Set a static IP on your computer's Ethernet port (e.g., 192.168.0.1)
   - Use a subnet mask of 255.255.255.0
   - Ensure this static IP is outside the range you'll use for DHCP
   - Disable any other network interfaces if possible to avoid conflicts

2. **Physical connections**:
   - Connect your computer's Ethernet port to a PoE switch
   - Connect factory-reset Axis cameras to the same switch
   - Ensure cameras are powered on and booted completely

### 2. DHCP Server Configuration
1. Start the application
2. In the "Network Setup & DHCP Server" section:
   - Select your network interface from the list (this should show your static IP)
   - Keep "Use Default DHCP Settings" checked for standard scenarios
   - For advanced users: customize the DHCP range and lease time if needed
   - Note: The DNS server will automatically be set to the same IP as the DHCP server
   - Click "Start DHCP Server"
3. Verify the DHCP server status shows "Active"

### 3. Camera Discovery
1. Wait approximately 30-60 seconds for cameras to receive IP addresses
2. Click "Discover Cameras on Network"
3. The application will search for Axis cameras and display them in the table
4. Verify the number of discovered cameras matches your physical setup

### 4. Camera Configuration
1. In the "Camera Discovery & Credentials" section:
   - Enter the new administrator username and password you want to set
   - Enter the ONVIF username and password (or use the same as admin)
   - Verify factory default root credentials (typically "root"/"pass")
   - Select HTTP or HTTPS protocol (HTTP recommended for initial setup)
2. Click "Start Camera Configuration"
3. Monitor progress in the logs section
4. Wait for the process to complete
5. View the summary information for success/failure count

### 5. Report Generation & Handoff
1. Once configuration is complete, click "Save Configuration Report..."
2. Select a location to save the CSV file
3. This report contains all cameras' MAC addresses, temporary IPs, and configuration status
4. Provide this report to the team using Axis Device Manager for final IP assignment
5. Stop the DHCP server when finished

## Troubleshooting Guide

### DHCP Server Issues

| Problem | Possible Causes | Solution |
|---------|-----------------|----------|
| "Port already in use" error | Another DHCP server is running | Stop other DHCP services (e.g., Windows DHCP Server) or network management tools |
| DHCP server won't start | Insufficient permissions | Run the application as Administrator/root |
| DHCP server starts but cameras don't get IP addresses | Network adapter misconfiguration | Verify your static IP is correctly set and on the same subnet |
| | Firewall blocking DHCP | Add exception for UDP port 67 in your firewall settings |

### Camera Discovery Issues

| Problem | Possible Causes | Solution |
|---------|-----------------|----------|
| No cameras discovered | Cameras haven't received IP addresses yet | Wait longer and try discovery again |
| | Cameras not properly connected | Check physical connections and power |
| | Cameras not factory reset | Reset cameras to factory defaults |
| | Wrong network interface selected | Verify you're using the interface connected to the cameras |
| Discovery extremely slow | Too many devices on network | Isolate the camera network from other networks |

### Camera Configuration Issues

| Problem | Possible Causes | Solution |
|---------|-----------------|----------|
| Authentication failures | Incorrect factory default credentials | Verify the root/pass credentials (may vary by model) |
| | Cameras not in factory state | Reset cameras to factory defaults |
| Partial configuration success | Network interruption | Retry configuration for failed cameras |
| | Camera firmware variations | Check logs for specific error messages |
| Configuration appears to hang | Camera rebooting during process | Allow more time; the camera may be applying changes |

### Application-wide Issues

| Problem | Possible Causes | Solution |
|---------|-----------------|----------|
| Application crashes | Memory limitations | Reduce batch size of cameras |
| | Python environment issues | Verify correct Python version and dependencies |
| Unexpected error messages | Bug or edge case | Check log file for details and report the issue |

## Batch Processing Strategy

For large deployments with hundreds or thousands of cameras:

1. **Divide and conquer**: Process cameras in batches based on your switch capacity
2. **Methodical approach**: Label cameras with their MAC addresses as you go
3. **Documentation**: Keep all generated reports organized by batch
4. **Consistency**: Use the same admin/ONVIF credentials for all batches

## Project Origin & Customization

This "Axis Camera Pre-Configuration Utility" was initially developed to address a specific internal camera setup workflow. While designed to be robust for this purpose, you might find you need additional features or different default configurations for your unique environment.

## Feature Requests, Issues & Contributions

If you require new functionalities, encounter issues, have suggestions for improvements, or wish to contribute, please feel free to:
* Open an issue on this GitHub repository.
* Contact Geoffrey Stephens directly at gstephens@storypolish.com.

## License

MIT License