Configuration Guide

Complete setup and configuration guide for your PawVision Pet TV system.

Installation

Quick Install

Run this one-liner on your Raspberry Pi:

curl -sSL https://raw.githubusercontent.com/mkroemer/pawvision/main/install.sh | bash

This installer will:

Manual Installation

  1. Clone the repository:

    git clone https://github.com/mkroemer/PawVision.git
    cd PawVision
    
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate
    
  3. Install dependencies:

     pip install -r requirements.txt
    
  4. Run PawVision:

    python pawvision.py
    

Web Interface

Configuration Options

Video Settings

Setting Description Range Default
Playback Duration How long videos play 1-180 minutes 30 minutes
Post-Playback Cooldown Delay before next video 0-60 minutes 5 minutes
Volume Audio volume level 0-100 50
{
  "playback_duration_minutes": 30,
  "post_playback_cooldown_minutes": 5,
  "volume": 50
}

Night Mode Settings

Configure quiet hours when volume is muted:

Setting Description Format Default
Night Mode Start When quiet hours begin HH:MM 22:00
Night Mode End When quiet hours end HH:MM 06:00
{
  "night_mode_start": "22:00",
  "night_mode_end": "06:00"
}

Button Control Settings

Physical GPIO button configuration:

Setting Description Default
Button Enabled Enable/disable physical button true
Second Press Stops Allow button to stop video true
Button Cooldown Seconds between button presses 60
Disable Start Time When to disable button (optional) null
Disable End Time When to re-enable button (optional) null
{
  "button_enabled": true,
  "button_disable_start": "23:30",
  "button_disable_end": "06:00",
  "second_press_stops": true,
  "button_cooldown_seconds": 60
}

Motion Detection Settings

Optional motion sensor integration:

Setting Description Default
Motion Sensor Enabled Enable motion sensor support false
Motion Stop Enabled Stop video on motion detected false
Motion Stop Timeout Time to wait before stopping video 300 seconds
{
  "motion_sensor_enabled": false,
  "motion_stop_enabled": false,
  "motion_stop_timeout_seconds": 300
}

Hardware Settings (Config File Only)

These settings are only configurable in the JSON file for security:

Setting Description Default
Monitor GPIO GPIO pin for monitor control null
Button Pin GPIO pin for physical button 17
Motion Sensor Pin GPIO pin for motion sensor null
{
  "monitor_gpio": null,
  "button_pin": 17,
  "motion_sensor_pin": 18
}

Play Schedule

Set up automatic playback times:

{
  "play_schedule": ["08:00", "12:00", "16:00", "20:00"]
}

Use the web interface time picker to easily add/remove scheduled times.

Statistics Settings

Track your pet’s viewing patterns:

{
  "enable_statistics": true,
  "statistics_file": "./pawvision_stats.json",
  "statistics_db": "./pawvision_stats.db"
}

Web Interface vs Config File

✅ Configurable via Web Interface

❌ Config File Only

Video Management

Default Video Location

Place videos in:

/home/pi/videos/

USB Support

Plug in a USB stick - it will be auto-mounted to /media/usb and videos will be detected automatically.

Supported Formats

Monitor Control

PawVision automatically controls your HDMI monitor:

API Integration

REST API Endpoints

Endpoint Method Description
/api/play POST Start video playback
/api/stop POST Stop video playback
/api/status GET Get current status

Home Assistant Example

rest_command:
  pawvision_play:
    url: "http://192.168.1.50:5001/api/play"
    method: POST
  pawvision_stop:
    url: "http://192.168.1.50:5001/api/stop"
    method: POST

Best Practices

Hardware Setup

Configuration Tips

Maintenance

Troubleshooting

Common Issues

Button Not Responding

Motion Sensor Not Working

Web Interface Not Accessible

Videos Not Playing

Log Messages

Common log messages and their meanings:

Getting Help

For additional support:

Example Configurations

Basic Setup

{
  "playback_duration_minutes": 15,
  "volume": 75,
  "night_mode_start": "22:00",
  "night_mode_end": "07:00",
  "button_enabled": true
}

Advanced Setup with Motion Detection

{
  "playbook_duration_minutes": 30,
  "post_playback_cooldown_minutes": 2,
  "volume": 60,
  "night_mode_start": "21:30",
  "night_mode_end": "07:30",
  "button_enabled": true,
  "button_disable_start": "23:00",
  "button_disable_end": "07:00",
  "motion_sensor_enabled": true,
  "motion_stop_enabled": true,
  "motion_stop_timeout_seconds": 300,
  "play_schedule": ["08:00", "14:00", "19:00"]
}

🧪 Running and Writing Tests

PawVision uses pytest for all unit and integration tests. All test files are located in the tests/ directory and are organized by domain (e.g., config, statistics, web interface).

To run all tests:

python run_tests.py --all

To run a specific test file:

python run_tests.py --file tests/test_config.py

To run a specific test class:

python run_tests.py --class TestConfigManager

To run a specific test class in a file:

python run_tests.py --file tests/test_config.py --class TestConfigManager

All tests should pass before submitting changes. Logging errors during test shutdown are harmless and only occur in test environments.