Skip to content

Deploying Gladys

Introduction

Gladys Assistant is a privacy-focused, self-hosted home automation platform that puts you in control of your smart home. Built with Node.js and designed for simplicity, Gladys provides a beautiful interface for managing devices, creating scenes, and automating your home without relying on cloud services.

Originally created in France and actively developed since 2013, Gladys has grown into a mature platform with a vibrant community. Unlike cloud-dependent alternatives, Gladys runs entirely on your own infrastructure, ensuring your home automation data stays private and accessible even without internet connectivity.

Key highlights of Gladys:

  • Privacy-First: All data stays on your server, no cloud required
  • Beautiful Dashboard: Modern, responsive interface accessible from any device
  • Device Integrations: Support for Zigbee, Z-Wave, MQTT, Philips Hue, Sonoff, and more
  • Scene Automation: Create complex automations with triggers and actions
  • Voice Control: Integration with voice assistants
  • Presence Detection: Track who’s home and automate based on presence
  • Calendar Integration: Connect calendars for time-based automations
  • Music Control: Integrate with Sonos and other music systems
  • Telegram Bot: Control your home via Telegram messages
  • Multi-User Support: Create accounts for family members
  • 100% Open Source: Licensed under Apache 2.0

This guide walks through deploying Gladys on Klutch.sh using Docker, configuring device integrations, and setting up home automations.

Why Deploy Gladys on Klutch.sh

Deploying Gladys on Klutch.sh provides several advantages for your smart home:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Gladys without complex orchestration. Push to GitHub, and your home automation platform deploys automatically.

Persistent Storage: Attach persistent volumes for your device configurations, scenes, and historical data. Your automations survive container restarts and redeployments.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure access to your smart home dashboard from anywhere.

GitHub Integration: Connect your configuration repository directly from GitHub. Updates to your Dockerfile trigger automatic redeployments.

Remote Access: Access your smart home dashboard from anywhere in the world without complex VPN or port forwarding setup.

Environment Variable Management: Securely store sensitive configuration through Klutch.sh’s environment variable system.

Custom Domains: Assign a custom domain to your Gladys instance for a professional home automation URL.

Always-On Availability: Your home automation hub remains accessible 24/7 for remote monitoring and control.

Prerequisites

Before deploying Gladys on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your Gladys configuration
  • Basic familiarity with Docker and containerization concepts
  • Smart home devices you want to integrate (optional for initial setup)
  • (Optional) A custom domain for your Gladys instance

Understanding Gladys Architecture

Gladys is built on a modern, modular architecture:

Node.js Backend: The core server handles device communication, automation logic, and API requests. Built with Express.js and optimized for low resource usage.

SQLite Database: User data, device configurations, scenes, and historical data are stored in an embedded SQLite database. No external database required.

Service System: Device integrations are implemented as services that can be enabled/disabled independently. Each service handles communication with specific device types.

WebSocket Communication: Real-time updates between the server and dashboard use WebSocket connections for instant device status changes.

Docker-First Design: Gladys is designed to run in Docker, making deployment consistent across different platforms.

Preparing Your Repository

To deploy Gladys on Klutch.sh, create a GitHub repository containing your Dockerfile and configuration.

Repository Structure

gladys-deploy/
├── Dockerfile
├── README.md
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM gladysassistant/gladys:v4
# Set environment variables
ENV NODE_ENV=production
ENV SERVER_PORT=80
ENV TZ=${TZ:-UTC}
# Create data directory
RUN mkdir -p /var/lib/gladysassistant
# Expose the web interface port
EXPOSE 80
# The base image includes the default entrypoint

Advanced Dockerfile with Custom Configuration

For more control over your deployment:

FROM gladysassistant/gladys:v4
# Set production environment
ENV NODE_ENV=production
ENV SERVER_PORT=80
# Timezone configuration
ENV TZ=${TZ:-UTC}
# SQLite configuration
ENV SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db
# Optional: Configure external MQTT broker
ENV GLADYS_MQTT_URL=${GLADYS_MQTT_URL}
ENV GLADYS_MQTT_USERNAME=${GLADYS_MQTT_USERNAME}
ENV GLADYS_MQTT_PASSWORD=${GLADYS_MQTT_PASSWORD}
# Create data directories
RUN mkdir -p /var/lib/gladysassistant
# Set proper permissions
RUN chmod -R 755 /var/lib/gladysassistant
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/api/v1/ping || exit 1
EXPOSE 80
# The base image includes the default entrypoint

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
README.md
LICENSE
.gitignore
*.log
.DS_Store
.env
.env.local
node_modules/

Environment Variables Reference

VariableRequiredDefaultDescription
NODE_ENVNoproductionNode.js environment
SERVER_PORTNo80HTTP server port
TZNoUTCTimezone for the server
SQLITE_FILE_PATHNo/var/lib/gladysassistant/gladys-production.dbDatabase file location
GLADYS_MQTT_URLNo-External MQTT broker URL
GLADYS_MQTT_USERNAMENo-MQTT username
GLADYS_MQTT_PASSWORDNo-MQTT password

Deploying Gladys on Klutch.sh

Once your repository is prepared, follow these steps to deploy Gladys:

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial Gladys deployment configuration"
    git remote add origin https://github.com/yourusername/gladys-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “gladys” or “smart-home”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Gladys Dockerfile.

    Configure HTTP Traffic

    Gladys serves its web interface over HTTP. In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80 (Gladys default port)

    Set Environment Variables

    In the environment variables section, add the following:

    VariableValue
    TZYour timezone (e.g., America/New_York)
    NODE_ENVproduction

    Add MQTT credentials if using an external broker:

    VariableValue
    GLADYS_MQTT_URLmqtt://your-broker:1883
    GLADYS_MQTT_USERNAMEYour MQTT username
    GLADYS_MQTT_PASSWORDYour MQTT password

    Attach Persistent Volumes

    Persistent storage is essential for Gladys. Add the following volumes:

    Mount PathRecommended SizePurpose
    /var/lib/gladysassistant5 GBDatabase and configuration storage

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the Gladys container
    • Provision an HTTPS certificate

    Access Gladys

    Once deployment completes, access your Gladys instance at https://your-app-name.klutch.sh. The setup wizard will guide you through creating your account.

Initial Setup and Configuration

First-Time Setup

When you first access your Gladys instance:

  1. Language Selection: Choose your preferred language
  2. Account Creation: Create your admin account with email and password
  3. House Setup: Configure your home’s rooms and floors
  4. Device Setup: Start adding your smart home devices

Configuring Your Home

Set up your home’s structure:

  1. Go to Settings > Houses
  2. Add your house name and location
  3. Create floors within your house
  4. Add rooms to each floor
  5. Assign devices to rooms

Room Configuration

Room PropertyDescription
NameDisplay name for the room
FloorWhich floor the room is on
PictureOptional room image
DevicesDevices located in this room

Device Integrations

Available Integrations

Gladys supports many device protocols:

IntegrationDevice Types
Zigbee2MQTTZigbee sensors, lights, switches
Z-Wave JSZ-Wave devices
MQTTAny MQTT-compatible device
Philips HueHue lights and sensors
SonoffSonoff WiFi devices
XiaomiMi Home devices
TuyaTuya/Smart Life devices
BroadlinkIR/RF controllers
TP-LinkKasa smart devices
TasmotaTasmota-flashed devices

Enabling Integrations

Activate device integrations:

  1. Go to Settings > Integrations
  2. Find the integration you need
  3. Click to enable and configure
  4. Follow the setup instructions

Zigbee2MQTT Setup

Connect Zigbee devices:

  1. Enable the Zigbee2MQTT integration
  2. Configure your Zigbee2MQTT broker URL
  3. Discover devices automatically
  4. Assign devices to rooms

MQTT Integration

Connect MQTT devices:

  1. Enable the MQTT integration
  2. Configure broker connection details
  3. Create device topics
  4. Map topics to Gladys devices

Cloud Integrations

Some integrations require network access:

IntegrationRequirements
Philips HueLocal network bridge
TelegramInternet access
CalendarCalDAV server access
WeatherInternet access

Dashboard Configuration

Creating Dashboards

Build custom dashboards:

  1. Go to Dashboard
  2. Click “Edit Dashboard”
  3. Add widgets by clicking ”+”
  4. Arrange widgets by dragging
  5. Save your layout

Available Widgets

Widget TypeDescription
DevicesControl lights, switches, sensors
CameraView camera feeds
WeatherCurrent weather and forecast
ChartHistorical sensor data
RoomQuick access to room controls
MusicMusic player controls
CalendarUpcoming events
User PresenceWho’s home indicator

Dashboard Tips

  • Create separate dashboards for different purposes (main view, bedroom controls, etc.)
  • Use the room widget for quick access to common areas
  • Add charts for monitoring energy usage or temperature trends

Scenes and Automations

Creating Scenes

Build automation scenes:

  1. Go to Scenes
  2. Click “Create Scene”
  3. Add triggers that start the scene
  4. Add actions to perform
  5. Save and enable the scene

Trigger Types

TriggerDescription
Device StateWhen a device changes state
TimeAt specific times or intervals
Sunrise/SunsetBased on sun position
User PresenceWhen someone arrives/leaves
Calendar EventWhen events start/end
Telegram MessageOn Telegram command

Action Types

ActionDescription
Control DeviceTurn on/off, dim, set values
Send NotificationPush or Telegram notification
WaitDelay before next action
ConditionIf/then logic
HTTP RequestCall external APIs
Set VariableStore values for later use

Example Automations

Morning Routine:

  • Trigger: Time = 7:00 AM on weekdays
  • Actions: Turn on lights gradually, start coffee maker

Welcome Home:

  • Trigger: User presence = home
  • Actions: Turn on entry lights, adjust thermostat

Goodnight Scene:

  • Trigger: Telegram message = “goodnight”
  • Actions: Turn off all lights, lock doors, arm security

User Management

Creating Users

Add family members:

  1. Go to Settings > Users
  2. Click “Create User”
  3. Enter name, email, and password
  4. Assign a role
  5. Configure presence detection

User Roles

RolePermissions
AdminFull system access
UserDashboard and device control
GuestLimited dashboard access

Presence Detection

Track who’s home:

  1. Configure presence detection method
  2. Set up geofencing or network detection
  3. Create presence-based automations

Telegram Integration

Setting Up Telegram Bot

Control Gladys via Telegram:

  1. Create a bot with @BotFather on Telegram
  2. Get your bot token
  3. Enable Telegram integration in Gladys
  4. Enter your bot token
  5. Link your Telegram account

Telegram Commands

CommandDescription
/scene morningRun a scene
/temperatureGet temperature readings
/camera kitchenGet camera snapshot
/statusSystem status

Calendar Integration

Connecting Calendars

Integrate with CalDAV calendars:

  1. Enable Calendar integration
  2. Add your CalDAV server URL
  3. Enter credentials
  4. Select calendars to sync

Calendar Automations

Use calendar events in scenes:

  • Trigger: Meeting starts

  • Action: Set “Do Not Disturb” mode

  • Trigger: Vacation starts

  • Action: Enable away mode

Production Best Practices

Security Recommendations

  • Strong Passwords: Use unique, strong passwords for all accounts
  • HTTPS Only: Always access via HTTPS (automatic with Klutch.sh)
  • Regular Updates: Keep Gladys updated for security patches
  • Telegram Security: Protect your Telegram bot token
  • API Access: Secure any external API integrations

Performance Optimization

  • Database Maintenance: Gladys handles this automatically
  • Integration Selection: Enable only needed integrations
  • History Retention: Configure appropriate data retention
  • Resource Allocation: Monitor CPU/memory usage

Backup Strategy

Protect your configuration:

  1. Database Backups: Back up /var/lib/gladysassistant/ regularly
  2. Scene Export: Document your scenes
  3. Integration Notes: Keep track of device configurations
  4. Test Restores: Verify backups work

Monitoring and Logging

Accessing Logs

View Gladys logs through:

  1. Klutch.sh Dashboard: View runtime logs
  2. System Logs: Check container logs for errors
  3. Integration Logs: Review specific integration issues

System Status

Monitor your Gladys instance:

  1. Check dashboard for device status
  2. Monitor scene execution history
  3. Review integration health
  4. Track database size

Troubleshooting Common Issues

Devices Not Responding

Symptoms: Devices show offline or don’t respond to commands.

Solutions:

  • Check device network connectivity
  • Verify integration configuration
  • Restart the affected integration
  • Check device-specific logs

Scenes Not Running

Symptoms: Automations don’t trigger or complete.

Solutions:

  • Verify trigger conditions are met
  • Check scene is enabled
  • Review scene execution logs
  • Test individual actions

Dashboard Not Loading

Symptoms: Web interface is slow or unresponsive.

Solutions:

  • Clear browser cache
  • Check server resources
  • Verify database integrity
  • Review container logs

Integration Connection Issues

Symptoms: Integration shows disconnected status.

Solutions:

  • Verify credentials and URLs
  • Check network connectivity
  • Restart the integration
  • Review integration logs

Updating Gladys

To update to a newer version:

  1. Check Release Notes: Review Gladys blog for updates
  2. Backup Data: Ensure database is backed up
  3. Update Dockerfile: Pull latest image
  4. Push Changes: Commit and push to trigger redeployment
  5. Verify: Test dashboards and automations

Additional Resources

Conclusion

Deploying Gladys on Klutch.sh gives you a powerful, self-hosted home automation platform with automatic builds, persistent storage, and secure remote access. The combination of Gladys’s privacy-focused design and Klutch.sh’s deployment simplicity means you can focus on automating your home rather than managing infrastructure.

With support for numerous device protocols, flexible scene automation, and a beautiful dashboard, Gladys on Klutch.sh provides a complete smart home solution that respects your privacy. Whether you’re controlling a few lights or building a fully automated home, Gladys delivers the functionality you need with complete control over your data.

Note: For local device integrations (Zigbee, Z-Wave, local network devices), you may need a local Gladys instance that can communicate directly with those devices. Cloud-accessible integrations and dashboard access work seamlessly with Klutch.sh deployments.