This integration allows you to control your Domoticz devices through Amazon Alexa using the Alexa Smart Home API v3.
Since 2023, Domoticz includes a built-in OAuth2 server that works with Alexa's account linking. The Lambda function will use the JWT tokens issued by Domoticz to authenticate API requests.
- Control lights (on/off, dimming)
- Control scenes and groups
- Control selector switches (mode controllers)
- Monitor temperature sensors
- Monitor humidity sensors
- Control thermostats
- Control blinds and locks
- Monitor various sensors (weight, pH, absolute humidity)
- Domoticz home automation system - Your Domoticz instance must be accessible from the Lambda function over Legacy IP, with a valid SSL certificate.
- Amazon Developer Account - Sign up at developer.amazon.com to create your Alexa Smart Home skill
- AWS Account - Needed to host the Lambda function that bridges Alexa and Domoticz. AWS Lambda offers a free tier with 1 million requests per month, which is more than sufficient for typical home automation use.
Before setting up the Alexa skill, ensure your Domoticz instance is properly configured:
-
Network accessibility - Your Domoticz instance must be accessible from the internet via Legacy IP, as Lambda functions cannot use IPv6 without additional VPC configuration. You may need to configure port forwarding on your router.
-
Valid SSL certificate - Domoticz must use HTTPS with a certificate from a recognized Certificate Authority. Self-signed certificates will not work. LetsEncrypt certificates work well and are free.
-
Create a dedicated Alexa user (recommended):
- Go to Setup → Settings → Users
- Create a new user (e.g., "alexa")
- Grant access only to the devices you want to control via Alexa
- This limits the scope of what Alexa can access
-
Assign devices to room plans - Each device you want to control via Alexa must be assigned to a room plan in Domoticz.
-
Configure OAuth2 application:
- Ensure Domoticz is started with the
-vhostnameoption to use the correct hostname in OAuth2 tokens (e.g.,-vhostname your-domoticz-host.example.com). Check that the correct hostname appears in the URLs returned from https://your-domoticz-host.example.com/.well-known/openid-configuration and that those URLs are reachable from the outside. - Go to Setup → Applications
- Click "Add Application"
- Application Name:
domoticz-alexa(or your preferred name) - Client Secret: Generate a secure random string (save this for later)
- Leave "Is Public" switch OFF
- Click "Add"
- Note the Client ID and Client Secret (you'll need these for Alexa account linking)
- Ensure Domoticz is started with the
- Log in to the Alexa Developer Console
- Click "Create Skill"
- Configure the skill:
- Skill name: Choose a name (e.g., "Domoticz")
- Primary locale: English (US) or your preferred locale
- Choose a model: Smart Home
- Choose a method to host: Provision your own
- Click "Create skill"
- Note your Skill ID (you'll need this later)
Leave this browser tab open — you'll return to complete the skill setup after creating the Lambda function.
It's easiest to create the Lambda function using the Makefile if you have the AWS CLI configured, or you can do it through the AWS Console in your web browser.
Using the Makefile:
- Configure AWS CLI credentials (see AWS CLI Quick Start). For a personal setup, it's acceptable to use user credentials
- Set
SKILL_IDat the top of theMakefile(recommended for better security, but not strictly required) - Run the setup commands:
make create-role make create-function make add-alexa-permission
To deploy code updates later, you can run:
make deployUsing the AWS Console:
- Log in to the AWS Console
- Navigate to Lambda and click "Create function"
- Choose "Author from scratch"
- Configure the function:
- Function name:
domoticz-alexa(or your preferred name) - Runtime: Node.js 22.x
- Architecture: arm64
- Execution role: Create a new role with basic Lambda permissions
- Function name:
- Click "Create function"
- In the Configuration tab:
- Set Timeout to 80 seconds
- Set Memory to 512 MiB
- In the Code tab, create a zip file and upload it:
Then click "Upload from" → ".zip file" and select
make zip
lambda-domoticz-alexa.zip - Click "Add trigger"
- Select "Alexa Smart Home"
- Enter your Skill ID (found in the Alexa Developer Console under "Skill ID")
- Click "Add"
- Note your Lambda function ARN (you'll need this later)
Return to the Alexa Developer Console browser tab from earlier. You should be in the Build tab.
- Go to "Smart Home"
- Set "Payload version" to "v3"
- Under "Default endpoint", enter your Lambda function ARN
- Click "Save"
- Go to your skill's "Account Linking" section
- Configure the OAuth settings to use Domoticz's built-in OAuth2 server:
- Authorization URI:
https://your-domoticz-host.example.com/oauth2/v1/authorize - Access Token URI:
https://your-domoticz-host.example.com/oauth2/v1/token - Client ID: Same as configured in Domoticz (e.g.,
domoticz-alexa) - Client Secret: Same as configured in Domoticz
- Authentication Scheme: Credentials in request body
- Scope:
profile(or any value — Domoticz doesn't use scopes but Alexa requires one)
- Authorization URI:
- Click "Save"
- (Optional) Go to your skill's "Permissions" section and enable "Send Alexa Events". We do not support this yet, but we hope to add it in future.
- (Optional) Go to the "Distribution" tab and add skill icons:
- Small Skill Icon (108x108 px): Upload
icons/app_icon.png - Large Skill Icon (512x512 px): Upload
icons/app_icon_large.png - Click "Save"
- Small Skill Icon (108x108 px): Upload
- Open the Alexa app on your phone
- Go to Skills & Games → Your Skills → Dev
- Find your skill and click "Enable to Use"
- Complete the account linking process
- Alexa will discover your Domoticz devices
Say "Alexa, discover devices" or use the Alexa app:
- Open the Alexa app
- Go to Devices
- Tap the "+" icon
- Select "Add Device"
- Choose "Other" and follow the prompts
Your Domoticz devices should now appear in Alexa!
- PowerController (on/off)
- BrightnessController (dimming)
- ColorController (RGB color)
- ColorTemperatureController (white temperature)
- SceneController (activate scenes)
- PowerController (on/off for groups)
- ModeController with custom modes based on Domoticz LevelNames
- TemperatureSensor
- TemperatureSensor and HumiditySensor (combined)
- ThermostatController (set target temperature)
- TemperatureSensor (current temperature)
- RangeController (position control with open/close presets)
- LockController
- RangeController (weight, pH, absolute humidity)
- PercentageController (percentage sensors)
Devices are automatically discovered from Domoticz when you enable the skill in the Alexa app. The integration:
- Fetches all devices from Domoticz
- Maps them to appropriate Alexa device types
- Configures capabilities based on device features
- Returns discovery response to Alexa
To rediscover devices after adding new ones in Domoticz:
- Open the Alexa app
- Go to Devices
- Tap the "+" icon
- Select "Add Device"
- Choose your skill and rediscover
The integration supports state reporting for all device types. When you view a device in the Alexa app, it queries the current state from Domoticz.
State reporting is configured with:
retrievable: true- Alexa can query device stateproactivelyReported: false- No proactive updates (polling mode)
- "Alexa, turn on the kitchen light"
- "Alexa, dim the bedroom light to 50%"
- "Alexa, set the living room light to blue"
- "Alexa, activate bedtime"
- "Alexa, turn on movie time"
- "Alexa, set Albie to kept in"
- "Alexa, set lounge source to HDMI 1"
- "Alexa, set kitchen temperature to 20 degrees"
- "Alexa, open the bedroom blind"
- "Alexa, close the living room blind"
- "Alexa, set the office blind to 50 percent"
- "Alexa, what's the temperature in the bedroom?"
- Check that the device is marked as "Used" in Domoticz
- Verify the Domoticz user has access to the device
- Check Lambda CloudWatch logs for errors
- Ensure device names are clear and distinct
- Check that the device type is supported
- Verify the skill is enabled in the Alexa app
- State updates require polling (every 3 seconds when device is open in app)
- Check Domoticz is accessible from Lambda
- Review CloudWatch logs for errors
Test discovery:
node test-discovery.jsTest device control:
node test-control.jsCloudWatch logs show:
- Incoming Alexa requests
- Domoticz API calls
- Device state queries
- Errors and responses
View logs:
aws logs tail /aws/lambda/domoticz-alexa --followAlexa Cloud
↓
AWS Lambda (Node.js)
↓
Domoticz API (HTTPS)
↓
Domoticz Devices
The Lambda function acts as a bridge between Alexa's Smart Home API and Domoticz's JSON API.
domapi.js- Main Lambda handlerdomo-code/Discovery.js- Device discoverydomo-code/Control.js- Device control and state reportingdomo-code/get_Devices.js- Domoticz device mappingdomo-code/domoticz.js- Domoticz API clientconf.json- Configuration file
This project is provided as-is for personal use.
Contributions are welcome! Please test thoroughly before submitting pull requests.
This is based on the original alexa_domo project from Nick Madge.