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
8080by 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 # DocumentationStep 2: Create the Dockerfile
Create a production-ready Dockerfile at your repository root. Klutch.sh automatically detects and uses this file:
# Domoticz Home Automation DockerfileFROM debian:bookworm-slim
# Set environment variablesENV DOMOTICZ_VERSION=2025.2 \ LANG=C.UTF-8 \ TZ=UTC
# Install dependenciesRUN 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 DomoticzRUN 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 storageRUN mkdir -p /opt/domoticz/userdata
# Set working directoryWORKDIR /opt/domoticz
# Expose web interface portEXPOSE 8080
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:8080/ || exit 1
# Start DomoticzCMD ["./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_StoreuserdatabackupsStep 4: Create .env.example
Provide a template for environment variables:
# Domoticz ConfigurationTZ=America/New_YorkDOMOTICZ_VERSION=2025.2
# Web InterfaceWEB_PORT=8080ENABLE_SSL=false
# DatabaseDATABASE_PATH=/opt/domoticz/userdata/domoticz.db
# LoggingLOG_LEVEL=normalLOG_SQL=false
# SecurityDOMOTICZ_USER=adminDOMOTICZ_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=587EMAIL_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
```bashdocker build -t domoticz .docker run -p 8080:8080 -v ./userdata:/opt/domoticz/userdata domoticzAccess 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:
```bashgit initgit add .git commit -m "Initial Domoticz deployment"git remote add origin https://github.com/YOUR_USERNAME/domoticz.gitgit push -u origin mainStep 2: Create Project on Klutch.sh
- Navigate to klutch.sh/app
- Click New Project and give it a descriptive name (e.g., "Smart Home Hub")
- Click Add App within your project
Step 3: Configure App Settings
- Select Repository: Choose your GitHub repository containing the Dockerfile
- Traffic Type: Select HTTP
- Internal Port: Set to
8080 - Branch: Select
mainor 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=8080LOG_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-keyEMAIL_SERVER=smtp.gmail.comEMAIL_PORT=587EMAIL_FROM=alerts@yourdomain.comEMAIL_TO=your-email@example.com
Step 5: Attach Persistent Storage
Domoticz requires persistent storage for device configurations, historical data, and automation scripts:
- In your app settings, navigate to Storage
- Click Add Volume
- Configure the volume:
- Mount Path:
/opt/domoticz/userdata - Size:
10GB(adjust based on device count and data retention)
- Mount Path:
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
- Review all settings and environment variables
- Click Deploy
- Klutch.sh will automatically detect the Dockerfile and build your application
- Monitor the build logs for any issues
- Once deployed, your app will be available at
https://YOUR-APP-NAME.klutch.sh
Step 7: Initial Setup
- Visit your deployed app at
https://YOUR-APP-NAME.klutch.sh - Log in with default credentials:
- Username:
admin - Password:
domoticz
- Username:
- IMMEDIATELY change the default password:
- Navigate to Setup → Settings → System
- Under "Website protection," change username and password
- Click Apply Settings
- 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
- Navigate to Setup → Hardware
- 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 RFXCOMType: RFXCOM TransceiverSerial Port: /dev/ttyUSB0Baud Rate: 38400Philips Hue Example:
Name: Hue BridgeType: Philips Hue BridgeIP Address: 192.168.1.100Port: 80Username: (obtained via bridge pairing)MQTT Example:
Name: MQTT DevicesType: MQTT Client Auto DiscoveryIP Address: mqtt.example.comPort: 1883Username: mqttuserPassword: mqttpassDiscovering Devices
Automatic Discovery:
- After adding hardware, Domoticz automatically detects devices
- New devices appear in Setup → Devices
- Enable devices by clicking the green arrow icon
- Devices become visible on the main dashboard
Manual Device Creation:
For switches and sensors that don’t auto-discover:
- Go to Setup → Devices
- Click Manual Light/Switch
- Configure device properties
- Save and test functionality
Organizing Devices
Create rooms and organize devices for easier management:
- Navigate to Setup → More Options → Plans
- Click Add Floor Plan to create rooms
- Drag devices onto floor plans
- 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
- Navigate to Switches → New → Scene
- Name your scene (e.g., “Movie Night”, “Good Morning”)
- Click Add
Step 2: Add Devices
- Click Edit on your scene
- Select devices to include
- Configure each device’s state (On/Off, dim level, etc.)
- 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 Setup → More Options → Events
Step 2: Create Blockly Event
- Click Add → Blockly
- Name your event (e.g., “Turn on lights at sunset”)
- Use visual blocks to create logic
Step 3: Common Automation Examples
Temperature-Based:
When temperature sensor < 68°FThen turn on heaterTime-Based:
When sunsetThen turn on outdoor lightsMotion-Triggered:
When motion detector = OnAnd time between 22:00 and 06:00Then turn on hallway lights for 5 minutesPresence Detection:
When nobody homeThen set thermostat to 65°FAnd turn off all lightsLua Scripting
For advanced automation, use Lua scripts:
Step 1: Create Script
- Navigate to Setup → More Options → Events
- Click Add → Lua → Device
- Name your script
Step 2: Write Lua Code
-- Example: Turn on lights when dark and motion detectedcommandArray = {}
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 endend
return commandArrayCommon Lua Functions:
-- Device controlcommandArray['Device Name'] = 'On'commandArray['Device Name'] = 'Off'commandArray['Device Name'] = 'Set Level 50'
-- TimingcommandArray['Device Name'] = 'On FOR 300' -- 5 minutescommandArray['Device Name'] = 'On AFTER 60' -- Delay 60 seconds
-- NotificationscommandArray['SendNotification'] = 'Title#Message'
-- Variablesuservariables['MyVariable'] = valueMonitoring 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:
- Click on any sensor device
- Select Log tab
- Choose time range (Day, Week, Month, Year)
- 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 WToday: 28.5 kWh ($3.42)This Month: 654 kWh ($78.48)Gas:
Current Usage: 1.8 m³/hToday: 5.2 m³This Month: 142 m³Water:
Today: 280 LThis Month: 7,850 LHistorical 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
- Navigate to Setup → Settings → Notifications
- Choose notification provider:
- Pushover (iOS, Android)
- Telegram
- Discord
- Slack
Step 2: Configure Pushover (Recommended)
- Create account at pushover.net
- Get API token and user key
- In Domoticz, set:
- Application Token:
your-api-token - User Key:
your-user-key - Priority: Normal/High/Emergency
- Application Token:
Step 3: Test Notification
Click Test to verify configuration
Notification Rules
Create rules for when to send notifications:
Step 1: Device Notifications
- Click Edit on any device
- Enable Notifications
- 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 openedAnd: Nobody homeSend: HIGH priority notificationMessage: "⚠️ Front door opened while away!"Temperature Warning:
When: Freezer temperature > 10°FSend: Normal priority notificationMessage: "❄️ Freezer temperature rising: {temperature}°F"Device Offline:
When: Sensor offline for 30 minutesSend: Low priority notificationMessage: "📡 {device_name} is offline"Email Notifications
Configure email alerts:
SMTP Settings:
- Navigate to Setup → Settings → Notifications
- Configure email server:
- SMTP Server:
smtp.gmail.com - Port:
587(TLS) or465(SSL) - From:
domoticz@yourdomain.com - To:
your-email@example.com - Username: Your email account
- Password: App-specific password
- SMTP Server:
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:
- Open browser on iOS/Android
- Navigate to
https://YOUR-APP-NAME.klutch.sh - Log in with credentials
- Tap Share → Add 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:
- Install mobile app
- Enable location permissions
- Configure in Setup → More Options → Mobile Devices
- Set home location radius
- Create automation rules:
- When arriving home
- When leaving home
Example Geofencing Rules:
Arriving Home:
When: Smartphone enters home zoneThen:- Turn on entryway lights- Set thermostat to 72°F- Disarm security system- Open garage doorLeaving Home:
When: All smartphones leave home zoneThen:- Turn off all lights- Set thermostat to 65°F- Arm security system- Lock all doorsSecurity Best Practices
Protect your Domoticz installation:
Change Default Credentials
CRITICAL SECURITY STEP:
The default credentials are publicly known:
- Username:
admin - Password:
domoticz
Change immediately:
- Navigate to Setup → Settings → System
- Under “Website protection”
- Change username and password
- Use strong password (16+ characters)
- Click Apply Settings
Enable HTTPS
Klutch.sh provides automatic HTTPS, but ensure it’s enforced:
- Access only via
https://YOUR-APP-NAME.klutch.sh - Never use HTTP for remote access
- Avoid storing credentials in browser
User Management
Create separate accounts for family members:
- Navigate to Setup → Settings → System
- Add new users
- Set appropriate permissions:
- Admin (full access)
- User (device control)
- Viewer (read-only)
IP Whitelisting (Optional)
Restrict access to known IP addresses:
- Navigate to Setup → Settings → System
- Under “Local Networks”
- Add trusted IP ranges
- Devices outside these ranges will be denied
API Security
If using the Domoticz API:
- Generate unique API tokens
- Store tokens in environment variables
- Rotate tokens regularly
- Monitor API access logs
Backup and Recovery
Protect your configuration and data:
Manual Backup
Create backups through the web interface:
Step 1: Create Backup
- Navigate to Setup → Settings → System
- Scroll to “Database”
- Click Create Backup
- 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
- Navigate to Setup → Settings → System
- Under “Backup”
- Set backup frequency (daily, weekly)
- Set retention period
- Enable automatic cleanup
Step 2: Download Backups
- Regular backups stored in
/opt/domoticz/userdata/backups/ - Download via web interface
- Store off-site for disaster recovery
Restore from Backup
Step 1: Upload Backup
- Navigate to Setup → Settings → System
- Under “Restore Database”
- Upload backup file
- Confirm restoration
Step 2: Restart Domoticz
The application restarts automatically after restore.
Volume Snapshots
Use Klutch.sh volume snapshots:
- Navigate to your app in Klutch.sh dashboard
- Go to Storage → Volumes
- Create snapshot of
/opt/domoticz/userdata - Schedule automatic snapshots
- Restore from snapshot if needed
Troubleshooting
Common issues and solutions:
Web Interface Not Accessible
Issue: Cannot access Domoticz web interface
Solution:
- Verify deployment status in Klutch.sh dashboard
- Check build logs for errors
- Ensure port 8080 is correctly configured
- Verify persistent volume is attached
- Check application logs:
# View logs in Klutch.sh dashboard# Or check health check statusDevices Not Discovered
Issue: Hardware added but devices not appearing
Solution:
- Verify hardware configuration is correct
- Check device compatibility with Domoticz
- Ensure hardware is powered and connected
- Check Setup → Log for error messages
- Restart hardware interface:
- Go to Setup → Hardware
- Click Edit on hardware
- Click Update
Database Locked Error
Issue: “Database is locked” error message
Solution:
- Too many simultaneous connections
- Wait a moment and retry
- If persistent, restart Domoticz
- Check for corrupted database:
-- If you have database accessPRAGMA integrity_check;High Memory Usage
Issue: Container using excessive memory
Solution:
- Check number of devices and logging level
- Reduce log retention period
- Disable SQL logging if enabled
- Consider reducing device poll frequency
- Compact database:
- Setup → Settings → System
- Click Compact Database
Automation Not Triggering
Issue: Events or scenes not executing
Solution:
- Check event logs: Setup → Log
- Verify event conditions are met
- Test device functionality manually
- Review Lua script syntax errors
- Check event is enabled
- Verify device is reachable
Notification Not Received
Issue: Push notifications not arriving
Solution:
- Test notification configuration
- Verify API keys are correct
- Check mobile app permissions
- Verify internet connectivity
- Check notification priority settings
- Test with different priority levels
Time Zone Issues
Issue: Incorrect timestamps or scheduling
Solution:
- Set correct timezone environment variable:
TZ=America/New_York - Redeploy application
- Verify time in Setup → Settings → System
- Check sunrise/sunset times match location
Advanced Configuration
Extend Domoticz capabilities:
Custom Plugins
Install community-developed plugins:
Step 1: Enable Plugin System
- Navigate to Setup → Settings → System
- Enable “Accept new Hardware Devices”
- Enable “Plugin System”
- Click Apply Settings
Step 2: Install Plugin
- Access
/opt/domoticz/userdata/plugins/directory - Clone plugin repository:
cd /opt/domoticz/userdata/plugins/git clone https://github.com/plugin-author/plugin-name.git- Restart Domoticz
- Plugin appears in Setup → Hardware
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
- Navigate to
/opt/domoticz/userdata/scripts/python/ - 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 TrueStep 3: Activate Script
- Make script executable
- Restart Domoticz
- Script runs automatically
Custom Dashboard
Create personalized dashboard views:
Step 1: Create Custom Page
- Navigate to
/opt/domoticz/userdata/www/ - 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:
# Get session IDcurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command¶m=getauth"Control Device:
# Turn on devicecurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command¶m=switchlight&idx=123&switchcmd=On"
# Set dim levelcurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=command¶m=switchlight&idx=123&switchcmd=Set%20Level&level=50"Get Device Status:
# Get all devicescurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&used=true"
# Get specific devicecurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&rid=123"Get Sensor Data:
# Temperature sensorscurl -k "https://YOUR-APP-NAME.klutch.sh/json.htm?type=devices&filter=temp&used=true"
# Weather datacurl -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
- Navigate to Setup → Hardware
- Select MQTT Client Gateway with LAN interface
- Configure:
- Name: MQTT Broker
- IP Address:
mqtt.example.com - Port:
1883 - Username:
mqttuser - Password:
mqttpass - Topic:
domoticz/in(incoming)
Step 2: Publish to MQTT
# Turn on device via MQTTmosquitto_pub -h mqtt.example.com -t "domoticz/in" \ -m '{"idx": 123, "nvalue": 1, "svalue": "On"}'
# Send sensor datamosquitto_pub -h mqtt.example.com -t "domoticz/in" \ -m '{"idx": 456, "nvalue": 0, "svalue": "25.5"}'Step 3: Subscribe to Updates
# Monitor all Domoticz messagesmosquitto_sub -h mqtt.example.com -t "domoticz/out/#"Performance Optimization
Optimize Domoticz for large deployments:
Database Optimization
Regular Maintenance:
- Navigate to Setup → Settings → System
- Click Compact Database monthly
- Configure appropriate log retention:
- Sensor data: 30-90 days
- Events: 7-30 days
- Notifications: 7 days
Disable Unnecessary Logging:
- Setup → Settings → System
- Under “Log Settings”
- Disable debug logging in production
- Disable SQL query logging
Device Polling
Reduce polling frequency for stable devices:
- Edit hardware interface
- 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):
- Increase volume size to 20GB+
- Consider upgrading Klutch.sh plan
- Monitor resource usage in dashboard
- 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
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-passwordAmazon Alexa
Control devices with voice commands:
Step 1: Enable Alexa Skill
- In Domoticz, navigate to Setup → Settings
- Enable “Amazon Alexa” support
- Note the authorization token
Step 2: Configure Alexa Skill
- Open Alexa app
- Search for “Domoticz” skill
- Enable and link account
- 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
- Setup → Settings → Google Home
- Enable Google Assistant support
- Configure OAuth credentials
Step 2: Link Accounts
- Open Google Home app
- Add Domoticz smart home integration
- Authorize and discover devices
IFTTT Integration
Create custom automations:
Example Applets:
Weather-Based:
If weather forecast shows rainThen close smart blinds in DomoticzLocation-Based:
If you enter home areaThen trigger "Arriving Home" sceneTime-Based:
Every day at sunsetThen turn on outdoor lightsProduction 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
Related Klutch.sh Guides
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.