Skip to content

Deploying a Domoticz App

Introduction

Domoticz is a lightweight, open-source home automation system that puts you in complete control of your smart home. Built with C++ and featuring a responsive HTML5 web interface, Domoticz works seamlessly with hundreds of devices including RFXCOM transceivers, Zigbee, Z-Wave, P1 smart meters, Philips Hue, and countless sensors. Whether you’re monitoring temperature, controlling lights, tracking energy consumption, or automating your entire home, Domoticz provides the flexibility and power you need.

Deploying Domoticz on Klutch.sh with a Dockerfile gives you a production-ready smart home hub with persistent storage for all your device configurations, historical data, and automation scripts. Access your home automation dashboard from anywhere at klutch.sh/app, and control your devices through the mobile-optimized interface that adapts to any screen size.


Why Deploy Domoticz on Klutch.sh?

Running Domoticz on Klutch.sh offers several advantages for your home automation setup:

  • Always-On Accessibility — Control your smart home devices from anywhere with 24/7 uptime
  • Persistent Storage — Never lose your device configurations, automation rules, or historical sensor data
  • Automatic Docker Detection — Place your Dockerfile at the root and Klutch.sh handles the rest
  • Mobile-Optimized — Access Domoticz’s responsive web interface from any device
  • Secure Deployment — Environment variable management keeps your credentials safe
  • Multi-Device Support — Connect hundreds of sensors, switches, and smart devices
  • Flexible Monitoring — Track temperature, humidity, energy usage, and more with extended logging
  • Push Notifications — Receive alerts on iOS, Android, and Windows 10 devices
  • No Vendor Lock-In — Open-source platform with full data ownership

Prerequisites

Before deploying Domoticz, ensure you have:

  • A Klutch.sh account (sign up here)
  • A GitHub repository for your Domoticz deployment (GitHub is the only supported git source)
  • Basic understanding of home automation concepts and device protocols
  • Smart home devices compatible with Domoticz (RFXCOM, Zigbee, Z-Wave, etc.)

For platform onboarding, refer to the Quick Start Guide.


Architecture Overview

Domoticz operates as a standalone home automation hub with these key components:

Core Application

  • Written in C++ for optimal performance and low resource usage
  • Built-in web server serving HTML5 responsive interface
  • Real-time device communication and status updates
  • Plugin system for extending functionality
  • Lua and Python scripting for custom automation

Web Interface

  • Mobile-responsive HTML5 frontend
  • Auto-adapts to desktop and mobile devices
  • Real-time dashboard with device controls
  • Historical data visualization with graphs
  • Event log and notification center

Device Support

  • RFXCOM transceivers (433MHz/868MHz)
  • Zigbee devices via compatible gateways
  • Z-Wave controllers and devices
  • P1 smart meters (Dutch/Belgian)
  • Philips Hue and other smart lights
  • 1-Wire temperature sensors
  • Pulse counters and utility meters
  • IP cameras and security systems
  • Weather stations and environmental sensors

Data Storage

  • SQLite database for device configurations
  • Historical sensor data and event logs
  • User accounts and permissions
  • Automation scripts and scenes
  • Device learning and recognition data

Port Configuration

  • Domoticz web interface serves on port 8080 by default
  • Select HTTP traffic when deploying on Klutch.sh
  • Additional ports may be needed for specific hardware interfaces

Repository Preparation

Step 1: Create Repository Structure

Set up your repository with the following layout:

domoticz/
├── Dockerfile # Must be at repo root for auto-detection
├── .dockerignore # Exclude unnecessary files
├── .env.example # Template for environment variables
└── README.md # Documentation

Step 2: Create the Dockerfile

Create a production-ready Dockerfile at your repository root. Klutch.sh automatically detects and uses this file:

# Domoticz Home Automation Dockerfile
FROM debian:bookworm-slim
# Set environment variables
ENV DOMOTICZ_VERSION=2025.2 \
LANG=C.UTF-8 \
TZ=UTC
# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
libssl3 \
libcurl4 \
libusb-0.1-4 \
libudev1 \
python3 \
python3-dev \
libpython3.11 \
libboost-system1.74.0 \
libboost-thread1.74.0 \
libboost-filesystem1.74.0 \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Download and install Domoticz
RUN mkdir -p /opt/domoticz && \
curl -L "https://releases.domoticz.com/releases/release/domoticz_linux_x86_64.tgz" | \
tar xzf - -C /opt/domoticz && \
chmod +x /opt/domoticz/domoticz
# Create data directory for persistent storage
RUN mkdir -p /opt/domoticz/userdata
# Set working directory
WORKDIR /opt/domoticz
# Expose web interface port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/ || exit 1
# Start Domoticz
CMD ["./domoticz", \
"-www", "8080", \
"-userdata", "/opt/domoticz/userdata", \
"-log", "/opt/domoticz/userdata/domoticz.log"]

Step 3: Create .dockerignore

Optimize build performance by excluding unnecessary files:

.git
.github
.env
.env.*
!.env.example
*.log
*.db
*.db-shm
*.db-wal
.DS_Store
userdata
backups

Step 4: Create .env.example

Provide a template for environment variables:

Terminal window
# Domoticz Configuration
TZ=America/New_York
DOMOTICZ_VERSION=2025.2
# Web Interface
WEB_PORT=8080
ENABLE_SSL=false
# Database
DATABASE_PATH=/opt/domoticz/userdata/domoticz.db
# Logging
LOG_LEVEL=normal
LOG_SQL=false
# Security
DOMOTICZ_USER=admin
DOMOTICZ_PASSWORD=change-this-password
# Device Configuration
# Add your device-specific settings here
# Example: RFXCOM serial port, Z-Wave USB device, etc.
# Notification Settings (Optional)
PUSHOVER_TOKEN=
PUSHOVER_USER=
EMAIL_SERVER=
EMAIL_PORT=587
EMAIL_FROM=
EMAIL_TO=
# External Services (Optional)
WEATHER_API_KEY=
GOOGLE_MAPS_API_KEY=

Step 5: Create README.md

Document your deployment:

# Domoticz Home Automation on Klutch.sh
Open-source home automation system for monitoring and controlling smart devices.
## Features
- Multi-device support (RFXCOM, Zigbee, Z-Wave, Philips Hue)
- Temperature, humidity, and environmental monitoring
- Energy consumption tracking (electricity, gas, water)
- Lighting control and automation
- Security system integration
- Mobile-responsive web interface
- Push notifications (iOS, Android, Windows 10)
- Lua and Python scripting
- Event-based automation rules
## Deployment
This repository is configured for deployment on Klutch.sh with automatic Dockerfile detection.
### Environment Variables
Copy `.env.example` and configure with your specific settings before deploying.
### Security
**IMPORTANT**: Change the default credentials immediately after first deployment!
Default credentials:
- Username: `admin`
- Password: `domoticz`
Access the web interface and go to Setup > Settings > System to change these.
### Local Development
```bash
docker build -t domoticz .
docker run -p 8080:8080 -v ./userdata:/opt/domoticz/userdata domoticz

Access at http://localhost:8080

Device Configuration

After deployment, configure your devices in Setup > Hardware. Supported protocols:

  • RFXCOM (433MHz/868MHz transceivers)
  • Zigbee (via compatible gateways)
  • Z-Wave (USB controllers)
  • P1 Smart Meter (Dutch/Belgian)
  • Philips Hue Bridge
  • 1-Wire sensors
  • MQTT devices
  • And many more…

Documentation

Full documentation available at: https://wiki.domoticz.com/ Community forum: https://forum.domoticz.com/

---
## Deploy Domoticz on Klutch.sh
### Step 1: Push Repository to GitHub
Commit and push your repository with the Dockerfile to GitHub:
```bash
git init
git add .
git commit -m "Initial Domoticz deployment"
git remote add origin https://github.com/YOUR_USERNAME/domoticz.git
git push -u origin main

Step 2: Create Project on Klutch.sh

  1. Navigate to klutch.sh/app
  2. Click New Project and give it a descriptive name (e.g., "Smart Home Hub")
  3. Click Add App within your project

Step 3: Configure App Settings

  1. Select Repository: Choose your GitHub repository containing the Dockerfile
  2. Traffic Type: Select HTTP
  3. Internal Port: Set to 8080
  4. Branch: Select main or your deployment branch

Step 4: Configure Environment Variables

Add these essential environment variables in Klutch.sh:

Basic Configuration:

  • TZ=America/New_York (or your timezone)
  • WEB_PORT=8080
  • LOG_LEVEL=normal

Optional Settings:

  • ENABLE_SSL=false (HTTPS handled by Klutch.sh)
  • LOG_SQL=false (enable for database query debugging)

Notification Configuration (Optional):

  • PUSHOVER_TOKEN=your-token (for push notifications)
  • PUSHOVER_USER=your-user-key
  • EMAIL_SERVER=smtp.gmail.com
  • EMAIL_PORT=587
  • EMAIL_FROM=alerts@yourdomain.com
  • EMAIL_TO=your-email@example.com

Step 5: Attach Persistent Storage

Domoticz requires persistent storage for device configurations, historical data, and automation scripts:

  1. In your app settings, navigate to Storage
  2. Click Add Volume
  3. Configure the volume:
    • Mount Path: /opt/domoticz/userdata
    • Size: 10GB (adjust based on device count and data retention)

This volume stores:

  • SQLite database (domoticz.db)
  • Device configurations
  • Automation scripts (Lua, Python)
  • Event logs and history
  • User settings and preferences
  • Backup files

Step 6: Deploy

  1. Review all settings and environment variables
  2. Click Deploy
  3. Klutch.sh will automatically detect the Dockerfile and build your application
  4. Monitor the build logs for any issues
  5. Once deployed, your app will be available at https://YOUR-APP-NAME.klutch.sh

Step 7: Initial Setup

  1. Visit your deployed app at https://YOUR-APP-NAME.klutch.sh
  2. Log in with default credentials:
    • Username: admin
    • Password: domoticz
  3. IMMEDIATELY change the default password:
    • Navigate to SetupSettingsSystem
    • Under "Website protection," change username and password
    • Click Apply Settings
  4. Configure your location and units:
    • Set your geographic location for weather and sunrise/sunset
    • Choose temperature units (Celsius/Fahrenheit)
    • Select wind speed and pressure units

Device Configuration

After deployment, configure your smart home devices:

Adding Hardware

Step 1: Access Hardware Setup

  1. Navigate to SetupHardware
  2. Click Add to configure a new hardware interface

Step 2: Select Hardware Type

Choose from the extensive list of supported devices:

  • RFXCOM Transceiver — 433MHz/868MHz wireless devices
  • Zigbee Gateway — Zigbee-compatible devices
  • Z-Wave Controller — Z-Wave USB stick or gateway
  • P1 Smart Meter — Dutch/Belgian energy meters
  • Philips Hue Bridge — Hue lights and accessories
  • MQTT Client — MQTT-enabled devices
  • 1-Wire — Temperature sensors
  • Dummy — Virtual devices for testing

Step 3: Configure Hardware

Each hardware type has specific settings. Common configurations:

RFXCOM Example:

Name: My RFXCOM
Type: RFXCOM Transceiver
Serial Port: /dev/ttyUSB0
Baud Rate: 38400

Philips Hue Example:

Name: Hue Bridge
Type: Philips Hue Bridge
IP Address: 192.168.1.100
Port: 80
Username: (obtained via bridge pairing)

MQTT Example:

Name: MQTT Devices
Type: MQTT Client Auto Discovery
IP Address: mqtt.example.com
Port: 1883
Username: mqttuser
Password: mqttpass

Discovering Devices

Automatic Discovery:

  1. After adding hardware, Domoticz automatically detects devices
  2. New devices appear in SetupDevices
  3. Enable devices by clicking the green arrow icon
  4. Devices become visible on the main dashboard

Manual Device Creation:

For switches and sensors that don’t auto-discover:

  1. Go to SetupDevices
  2. Click Manual Light/Switch
  3. Configure device properties
  4. Save and test functionality

Organizing Devices

Create rooms and organize devices for easier management:

  1. Navigate to SetupMore OptionsPlans
  2. Click Add Floor Plan to create rooms
  3. Drag devices onto floor plans
  4. Create custom icons and layouts

Automation and Scenes

Domoticz provides powerful automation capabilities:

Creating Scenes

Group multiple devices for one-touch control:

Step 1: Create Scene

  1. Navigate to SwitchesNewScene
  2. Name your scene (e.g., “Movie Night”, “Good Morning”)
  3. Click Add

Step 2: Add Devices

  1. Click Edit on your scene
  2. Select devices to include
  3. Configure each device’s state (On/Off, dim level, etc.)
  4. Save the scene

Example Scenes:

Movie Night:

  • Living room lights: 20% brightness
  • TV backlight: Blue color
  • Blinds: Closed

Good Morning:

  • Bedroom lights: 100% brightness
  • Thermostat: 72°F
  • Coffee maker: On

Event-Based Automation

Create rules that trigger based on events:

Step 1: Access Events

Navigate to SetupMore OptionsEvents

Step 2: Create Blockly Event

  1. Click AddBlockly
  2. Name your event (e.g., “Turn on lights at sunset”)
  3. Use visual blocks to create logic

Step 3: Common Automation Examples

Temperature-Based:

When temperature sensor < 68°F
Then turn on heater

Time-Based:

When sunset
Then turn on outdoor lights

Motion-Triggered:

When motion detector = On
And time between 22:00 and 06:00
Then turn on hallway lights for 5 minutes

Presence Detection:

When nobody home
Then set thermostat to 65°F
And turn off all lights

Lua Scripting

For advanced automation, use Lua scripts:

Step 1: Create Script

  1. Navigate to SetupMore OptionsEvents
  2. Click AddLuaDevice
  3. Name your script

Step 2: Write Lua Code

-- Example: Turn on lights when dark and motion detected
commandArray = {}
if (devicechanged['Motion Sensor'] == 'On') then
lux = tonumber(otherdevices_svalues['Light Sensor'])
if (lux < 50) then
commandArray['Living Room Lights'] = 'On'
commandArray['Hallway Lights'] = 'On FOR 300' -- Auto-off after 5 minutes
end
end
return commandArray

Common Lua Functions:

-- Device control
commandArray['Device Name'] = 'On'
commandArray['Device Name'] = 'Off'
commandArray['Device Name'] = 'Set Level 50'
-- Timing
commandArray['Device Name'] = 'On FOR 300' -- 5 minutes
commandArray['Device Name'] = 'On AFTER 60' -- Delay 60 seconds
-- Notifications
commandArray['SendNotification'] = 'Title#Message'
-- Variables
uservariables['MyVariable'] = value

Monitoring and Visualization

Domoticz excels at data visualization and monitoring:

Dashboard Widgets

The main dashboard displays real-time device status:

Temperature Sensors:

  • Current temperature
  • Humidity levels
  • Dew point
  • Historical graphs

Energy Monitoring:

  • Current power usage (Watts)
  • Daily consumption (kWh)
  • Cost calculations
  • Usage graphs

Switches and Lights:

  • Current state (On/Off)
  • Dim levels
  • Last seen timestamp
  • Usage statistics

Custom Graphs

Create detailed graphs for any sensor:

  1. Click on any sensor device
  2. Select Log tab
  3. Choose time range (Day, Week, Month, Year)
  4. View detailed graphs with min/max/average values

Graph Types:

  • Temperature trends over time
  • Energy consumption patterns
  • Humidity variations
  • Device usage statistics

Utility Meter Tracking

Monitor your utility consumption:

Electricity:

Current Usage: 2,450 W
Today: 28.5 kWh ($3.42)
This Month: 654 kWh ($78.48)

Gas:

Current Usage: 1.8 m³/h
Today: 5.2 m³
This Month: 142 m³

Water:

Today: 280 L
This Month: 7,850 L

Historical Data

Domoticz stores all sensor data in SQLite:

  • Configurable retention periods
  • Automatic data compression
  • Export to CSV
  • Database backup options

Notifications and Alerts

Stay informed about your home’s status:

Push Notifications

Configure push notifications for mobile devices:

Step 1: Enable Notifications

  1. Navigate to SetupSettingsNotifications
  2. Choose notification provider:
    • Pushover (iOS, Android)
    • Telegram
    • Discord
    • Slack
    • Email

Step 2: Configure Pushover (Recommended)

  1. Create account at pushover.net
  2. Get API token and user key
  3. In Domoticz, set:
    • Application Token: your-api-token
    • User Key: your-user-key
    • Priority: Normal/High/Emergency

Step 3: Test Notification

Click Test to verify configuration

Notification Rules

Create rules for when to send notifications:

Step 1: Device Notifications

  1. Click Edit on any device
  2. Enable Notifications
  3. Configure notification settings:
    • On state change
    • On threshold exceeded
    • Custom message

Step 2: System Notifications

Configure alerts for:

  • Device offline/unreachable
  • Low battery warnings
  • Temperature extremes
  • Motion detection
  • Door/window sensors
  • Smoke/CO detectors

Example Notification Rules:

Security Alert:

When: Front door opened
And: Nobody home
Send: HIGH priority notification
Message: "⚠️ Front door opened while away!"

Temperature Warning:

When: Freezer temperature > 10°F
Send: Normal priority notification
Message: "❄️ Freezer temperature rising: {temperature}°F"

Device Offline:

When: Sensor offline for 30 minutes
Send: Low priority notification
Message: "📡 {device_name} is offline"

Email Notifications

Configure email alerts:

SMTP Settings:

  1. Navigate to SetupSettingsNotifications
  2. Configure email server:
    • SMTP Server: smtp.gmail.com
    • Port: 587 (TLS) or 465 (SSL)
    • From: domoticz@yourdomain.com
    • To: your-email@example.com
    • Username: Your email account
    • Password: App-specific password

Gmail Configuration:

For Gmail, use an app-specific password.


Mobile Access

Domoticz provides excellent mobile device support:

Web Interface

The HTML5 interface automatically adapts to mobile screens:

Features:

  • Touch-friendly controls
  • Responsive layout
  • Fast loading
  • Offline capability
  • Home screen shortcuts

Access on Mobile:

  1. Open browser on iOS/Android
  2. Navigate to https://YOUR-APP-NAME.klutch.sh
  3. Log in with credentials
  4. Tap ShareAdd to Home Screen

Mobile Apps

Domoticz has native mobile applications:

iOS:

  • Download from App Store
  • Search “Domoticz”
  • Configure server URL and credentials

Android:

  • Download from Google Play
  • Search “Domoticz”
  • Configure connection settings

App Features:

  • Push notifications
  • Widgets for home screen
  • Geofencing (location-based automation)
  • Quick actions
  • Device shortcuts

Geofencing

Enable location-based automation:

  1. Install mobile app
  2. Enable location permissions
  3. Configure in SetupMore OptionsMobile Devices
  4. Set home location radius
  5. Create automation rules:
    • When arriving home
    • When leaving home

Example Geofencing Rules:

Arriving Home:

When: Smartphone enters home zone
Then:
- Turn on entryway lights
- Set thermostat to 72°F
- Disarm security system
- Open garage door

Leaving Home:

When: All smartphones leave home zone
Then:
- Turn off all lights
- Set thermostat to 65°F
- Arm security system
- Lock all doors

Security Best Practices

Protect your Domoticz installation:

Change Default Credentials

CRITICAL SECURITY STEP:

The default credentials are publicly known:

  • Username: admin
  • Password: domoticz

Change immediately:

  1. Navigate to SetupSettingsSystem
  2. Under “Website protection”
  3. Change username and password
  4. Use strong password (16+ characters)
  5. Click Apply Settings

Enable HTTPS

Klutch.sh provides automatic HTTPS, but ensure it’s enforced:

  1. Access only via https://YOUR-APP-NAME.klutch.sh
  2. Never use HTTP for remote access
  3. Avoid storing credentials in browser

User Management

Create separate accounts for family members:

  1. Navigate to SetupSettingsSystem
  2. Add new users
  3. Set appropriate permissions:
    • Admin (full access)
    • User (device control)
    • Viewer (read-only)

IP Whitelisting (Optional)

Restrict access to known IP addresses:

  1. Navigate to SetupSettingsSystem
  2. Under “Local Networks”
  3. Add trusted IP ranges
  4. Devices outside these ranges will be denied

API Security

If using the Domoticz API:

  1. Generate unique API tokens
  2. Store tokens in environment variables
  3. Rotate tokens regularly
  4. Monitor API access logs

Backup and Recovery

Protect your configuration and data:

Manual Backup

Create backups through the web interface:

Step 1: Create Backup

  1. Navigate to SetupSettingsSystem
  2. Scroll to “Database”
  3. Click Create Backup
  4. Download backup file

What’s Backed Up:

  • SQLite database (domoticz.db)
  • Device configurations
  • Automation scripts
  • User settings
  • Historical data

Automated Backups

Configure automatic backups:

Step 1: Enable Auto-Backup

  1. Navigate to SetupSettingsSystem
  2. Under “Backup”
  3. Set backup frequency (daily, weekly)
  4. Set retention period
  5. Enable automatic cleanup

Step 2: Download Backups

  1. Regular backups stored in /opt/domoticz/userdata/backups/
  2. Download via web interface
  3. Store off-site for disaster recovery

Restore from Backup

Step 1: Upload Backup

  1. Navigate to SetupSettingsSystem
  2. Under “Restore Database”
  3. Upload backup file
  4. Confirm restoration

Step 2: Restart Domoticz

The application restarts automatically after restore.

Volume Snapshots

Use Klutch.sh volume snapshots:

  1. Navigate to your app in Klutch.sh dashboard
  2. Go to StorageVolumes
  3. Create snapshot of /opt/domoticz/userdata
  4. Schedule automatic snapshots
  5. Restore from snapshot if needed

Troubleshooting

Common issues and solutions:

Web Interface Not Accessible

Issue: Cannot access Domoticz web interface

Solution:

  1. Verify deployment status in Klutch.sh dashboard
  2. Check build logs for errors
  3. Ensure port 8080 is correctly configured
  4. Verify persistent volume is attached
  5. Check application logs:
Terminal window
# View logs in Klutch.sh dashboard
# Or check health check status

Devices Not Discovered

Issue: Hardware added but devices not appearing

Solution:

  1. Verify hardware configuration is correct
  2. Check device compatibility with Domoticz
  3. Ensure hardware is powered and connected
  4. Check SetupLog for error messages
  5. Restart hardware interface:
    • Go to SetupHardware
    • Click Edit on hardware
    • Click Update

Database Locked Error

Issue: “Database is locked” error message

Solution:

  1. Too many simultaneous connections
  2. Wait a moment and retry
  3. If persistent, restart Domoticz
  4. Check for corrupted database:
-- If you have database access
PRAGMA integrity_check;

High Memory Usage

Issue: Container using excessive memory

Solution:

  1. Check number of devices and logging level
  2. Reduce log retention period
  3. Disable SQL logging if enabled
  4. Consider reducing device poll frequency
  5. Compact database:
    • SetupSettingsSystem
    • Click Compact Database

Automation Not Triggering

Issue: Events or scenes not executing

Solution:

  1. Check event logs: SetupLog
  2. Verify event conditions are met
  3. Test device functionality manually
  4. Review Lua script syntax errors
  5. Check event is enabled
  6. Verify device is reachable

Notification Not Received

Issue: Push notifications not arriving

Solution:

  1. Test notification configuration
  2. Verify API keys are correct
  3. Check mobile app permissions
  4. Verify internet connectivity
  5. Check notification priority settings
  6. Test with different priority levels

Time Zone Issues

Issue: Incorrect timestamps or scheduling

Solution:

  1. Set correct timezone environment variable: TZ=America/New_York
  2. Redeploy application
  3. Verify time in SetupSettingsSystem
  4. Check sunrise/sunset times match location

Advanced Configuration

Extend Domoticz capabilities:

Custom Plugins

Install community-developed plugins:

Step 1: Enable Plugin System

  1. Navigate to SetupSettingsSystem
  2. Enable “Accept new Hardware Devices”
  3. Enable “Plugin System”
  4. Click Apply Settings

Step 2: Install Plugin

  1. Access /opt/domoticz/userdata/plugins/ directory
  2. Clone plugin repository:
Terminal window
cd /opt/domoticz/userdata/plugins/
git clone https://github.com/plugin-author/plugin-name.git
  1. Restart Domoticz
  2. Plugin appears in SetupHardware

Popular Plugins:

  • Xiaomi Mi Home — Xiaomi smart devices
  • Shelly — Shelly smart switches
  • Tuya — Tuya-based devices
  • Yeelight — Xiaomi Yeelight bulbs
  • OpenTherm Gateway — Thermostat control

Python Scripting

Advanced automation with Python:

Step 1: Create Python Script

  1. Navigate to /opt/domoticz/userdata/scripts/python/
  2. Create new file: my_script.py

Step 2: Write Python Code

#!/usr/bin/env python3
# Domoticz Python Script Example
import DomoticzEvents as DE
def onDeviceModified(self, unit):
"""Called when device state changes"""
# Example: React to motion sensor
if unit == 1: # Motion sensor device ID
sensor_data = self.devices[unit]
if sensor_data.sValue == "On":
# Motion detected
self.send_notification("Motion Detected",
"Motion sensor activated in hallway")
# Turn on lights
self.devices[2].Update(nValue=1, sValue="On")
return True
def onHeartbeat(self):
"""Called every heartbeat (10 seconds)"""
# Example: Check temperature every 10 seconds
temp_sensor = self.devices[5]
temperature = float(temp_sensor.sValue)
if temperature > 80:
self.send_notification("High Temperature",
f"Temperature is {temperature}°F")
return True

Step 3: Activate Script

  1. Make script executable
  2. Restart Domoticz
  3. Script runs automatically

Custom Dashboard

Create personalized dashboard views:

Step 1: Create Custom Page

  1. Navigate to /opt/domoticz/userdata/www/
  2. Create custom.html

Step 2: Design Interface

<!DOCTYPE html>
<html>
<head>
<title>My Custom Dashboard</title>
<style>
.widget {
display: inline-block;
margin: 10px;
padding: 20px;
background: #f0f0f0;
border-radius: 8px;
}
</style>
</head>
<body>
<h1>Home Status</h1>
<div class="widget" id="temperature">
<h2>Temperature</h2>
<p id="temp-value">Loading...</p>
</div>
<script>
// Fetch device data via API
fetch('/json.htm?type=devices&rid=123')
.then(response => response.json())
.then(data => {
document.getElementById('temp-value').innerText =
data.result[0].Data;
});
</script>
</body>
</html>

Step 3: Access Custom Page

Navigate to https://YOUR-APP-NAME.klutch.sh/custom.html

API Integration

Integrate Domoticz with external services:

API Authentication:

Terminal window
# Get session ID
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command&param=getauth"

Control Device:

Terminal window
# Turn on device
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command&param=switchlight&idx=123&switchcmd=On"
# Set dim level
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command&param=switchlight&idx=123&switchcmd=Set%20Level&level=50"

Get Device Status:

Terminal window
# Get all devices
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&used=true"
# Get specific device
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&rid=123"

Get Sensor Data:

Terminal window
# Temperature sensors
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&filter=temp&used=true"
# Weather data
curl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&filter=weather&used=true"

MQTT Integration

Connect MQTT devices:

Step 1: Add MQTT Hardware

  1. Navigate to SetupHardware
  2. Select MQTT Client Gateway with LAN interface
  3. Configure:
    • Name: MQTT Broker
    • IP Address: mqtt.example.com
    • Port: 1883
    • Username: mqttuser
    • Password: mqttpass
    • Topic: domoticz/in (incoming)

Step 2: Publish to MQTT

Terminal window
# Turn on device via MQTT
mosquitto_pub -h mqtt.example.com -t "domoticz/in" \
-m '{"idx": 123, "nvalue": 1, "svalue": "On"}'
# Send sensor data
mosquitto_pub -h mqtt.example.com -t "domoticz/in" \
-m '{"idx": 456, "nvalue": 0, "svalue": "25.5"}'

Step 3: Subscribe to Updates

Terminal window
# Monitor all Domoticz messages
mosquitto_sub -h mqtt.example.com -t "domoticz/out/#"

Performance Optimization

Optimize Domoticz for large deployments:

Database Optimization

Regular Maintenance:

  1. Navigate to SetupSettingsSystem
  2. Click Compact Database monthly
  3. Configure appropriate log retention:
    • Sensor data: 30-90 days
    • Events: 7-30 days
    • Notifications: 7 days

Disable Unnecessary Logging:

  1. SetupSettingsSystem
  2. Under “Log Settings”
  3. Disable debug logging in production
  4. Disable SQL query logging

Device Polling

Reduce polling frequency for stable devices:

  1. Edit hardware interface
  2. Increase polling interval for:
    • Temperature sensors: 5-10 minutes
    • Switches: 1-2 minutes
    • Power meters: 30-60 seconds

Resource Allocation

For large installations (100+ devices):

  1. Increase volume size to 20GB+
  2. Consider upgrading Klutch.sh plan
  3. Monitor resource usage in dashboard
  4. Disable unused features

Integration Examples

Connect Domoticz with popular services:

Home Assistant

Bridge Domoticz with Home Assistant:

Step 1: Configure MQTT in Domoticz

Enable MQTT as described in Advanced Configuration

Step 2: Home Assistant Configuration

configuration.yaml
mqtt:
broker: mqtt.example.com
port: 1883
username: mqttuser
password: mqttpass
domoticz:
host: YOUR-APP-NAME.klutch.sh
port: 443
ssl: true
username: admin
password: your-password

Amazon Alexa

Control devices with voice commands:

Step 1: Enable Alexa Skill

  1. In Domoticz, navigate to SetupSettings
  2. Enable “Amazon Alexa” support
  3. Note the authorization token

Step 2: Configure Alexa Skill

  1. Open Alexa app
  2. Search for “Domoticz” skill
  3. Enable and link account
  4. Discover devices

Voice Commands:

  • “Alexa, turn on living room lights”
  • “Alexa, set bedroom temperature to 72 degrees”
  • “Alexa, what’s the temperature in the living room?”

Google Assistant

Use Google Home with Domoticz:

Step 1: Enable Google Assistant

  1. SetupSettingsGoogle Home
  2. Enable Google Assistant support
  3. Configure OAuth credentials

Step 2: Link Accounts

  1. Open Google Home app
  2. Add Domoticz smart home integration
  3. Authorize and discover devices

IFTTT Integration

Create custom automations:

Example Applets:

Weather-Based:

If weather forecast shows rain
Then close smart blinds in Domoticz

Location-Based:

If you enter home area
Then trigger "Arriving Home" scene

Time-Based:

Every day at sunset
Then turn on outdoor lights

Production Checklist

Before going live, verify:

Pre-Deployment

  • Repository contains Dockerfile at root
  • Environment variables configured
  • Persistent volume attached (10GB+)
  • Timezone set correctly
  • Port 8080 configured for HTTP traffic

Security

  • Default credentials changed
  • Strong password set (16+ characters)
  • HTTPS access configured
  • User accounts created for family members
  • Notification providers configured
  • Backup strategy implemented

Device Configuration

  • All hardware interfaces added
  • Devices discovered and enabled
  • Device names are descriptive
  • Rooms/floor plans created
  • Device icons customized

Automation

  • Essential scenes created
  • Event-based automation configured
  • Notification rules set up
  • Geofencing enabled (if using mobile app)
  • Scripts tested and working

Monitoring

  • Energy monitoring configured
  • Temperature sensors calibrated
  • Historical data recording verified
  • Graphs displaying correctly
  • Alerts functioning properly

Backup

  • Manual backup created and downloaded
  • Automatic backup enabled
  • Backup retention configured
  • Volume snapshots scheduled
  • Restore procedure tested

Performance

  • Database compacted
  • Unnecessary logging disabled
  • Device polling optimized
  • Resource usage monitored
  • Load times acceptable

Additional Resources

Official Documentation

Device Compatibility

Community Resources


Conclusion

Domoticz on Klutch.sh provides a powerful, flexible home automation platform that puts you in complete control. With support for hundreds of devices, extensive automation capabilities, and mobile access from anywhere, you can build a smart home that truly works for you.

By following this guide, you’ve learned how to:

  • ✅ Deploy Domoticz with a production-ready Dockerfile
  • ✅ Configure persistent storage for device data and history
  • ✅ Add and manage smart home devices across multiple protocols
  • ✅ Create automation rules and scenes for effortless control
  • ✅ Set up notifications and monitoring for your entire home
  • ✅ Secure your installation with best practices
  • ✅ Integrate with popular services and voice assistants
  • ✅ Optimize performance for large device deployments

Your Domoticz installation is now ready to monitor and control your smart home devices from anywhere, with all your data safely stored and accessible only to you. The open-source nature ensures you’re never locked into a proprietary ecosystem, and the active community provides endless possibilities for customization and expansion.

Start small with a few devices and expand as your smart home grows—Domoticz scales seamlessly from a handful of sensors to hundreds of devices across your entire property.