Control your Somfy smart home devices from any device - desktop, server, or automation scripts. Works entirely through your local gateway with no cloud dependencies required.
✅ Universal Device Control - Control from any device, not just your mobile app
✅ 100% Local & Private - Communicates directly with your local TaHoma gateway - no cloud required
✅ Automation Ready - Perfect for scripts, cron jobs, and home automation systems
The Somfy CLI provides comprehensive control over Somfy smart home devices through the TaHoma Local API, allowing you to discover devices, control device states, manage aliases, and monitor device events directly from the command line.
Built on the Somfy SDK for reliable and efficient communication with your TaHoma gateway.
# Add the tap (one-time setup)
brew tap markusz/somfy-cli
# Install somfy-cli
brew install somfy-cli
# Update to latest version
brew upgrade somfy-cliDownload the latest release from GitHub Releases:
- macOS:
somfy-cli-macos-x86_64(Intel) orsomfy-cli-macos-aarch64(Apple Silicon) - Linux:
somfy-cli-linux-x86_64 - Windows:
somfy-cli-windows-x86_64.exe
# Example for macOS (Intel)
curl -L https://github.com/markusz/somfy-cli/releases/latest/download/somfy-cli-macos-x86_64 -o somfy
chmod +x somfy
sudo mv somfy /usr/local/bin/git clone https://github.com/markusz/somfy-cli.git
cd somfy-cli
cargo build --releaseThe compiled binary will be available at target/release/somfy.
cargo install --path .The CLI supports multiple authentication methods, with the following order of precedence:
somfy --api-key YOUR_API_KEY --gateway-url gateway.local.ip --gateway-port 8443 lsexport SOMFY_API_KEY=your_api_key_here
export SOMFY_GATEWAY_HOSTNAME=192.168.1.100
export SOMFY_GATEWAY_PORT=8443
somfy lsCreate a configuration file at ~/.config/somfy-cli/env.json (or %APPDATA%\somfy-cli\env.json on Windows):
{
"protocol": "Https",
"hostname": "192.168.1.100",
"port": 8443,
"api_key": "your_api_key_here"
}Before using the Somfy CLI, you need:
- Developer Mode Enabled - Your TaHoma gateway must have developer mode enabled
- API Key - A valid API key for local access
The CLI provides comprehensive help documentation for all commands using the --help flag:
# General help
somfy --help
# Help for specific commands
somfy open --help
somfy alias --help
somfy position --helpCompletely opens a device (blinds, shutters, etc.):
somfy open <device_url_or_alias>Completely closes a device:
somfy close <device_url_or_alias>Moves a device to a specific position (0-100%):
somfy position <device_url_or_alias> <percentage>Lists all available devices:
somfy lsShows all currently running device executions:
somfy current-execsListens for real-time device events:
somfy listenCreate and manage aliases for device URLs to simplify commands:
somfy alias add <alias_name> <device_url>
somfy alias add <alias_name> <device_url> --overwrite # Overwrite existing aliassomfy alias rm <alias_name>somfy alias lsOnce created, aliases can be used in place of device URLs:
somfy alias add living-room io://1234-5678-9012/device1
somfy open living-room # Instead of: somfy open io://1234-5678-9012/device1The CLI supports two output formats that can be configured per-command:
somfy ls --output-style json
# or
somfy -S json ls
somfy ls # Omitting the params defaults to JSONExample JSON output:
[
{
"label": "Living Room Blinds",
"device_url": "io://1234-5678-9012/device1",
"controllable_name": "io:StackComponent",
"states": [
{
"name": "core:StatusState",
"value": "available"
},
{
"name": "core:ClosureState",
"value": 75
}
]
}
]Output can be piped, e.g.
somfy ls | jq '.[].label'
somfy ls --output-style table
# or
somfy ls -S tableExample table output:
┌────────────────────┬─────────────────────────────┬─────────────────────┬─────────────┬──────────────┬─────────────┬───────────┬───────────────────┬────────────────┬────────────┐
│ Label │ Device URL │ Device Type │ Open/Close │ Status │ Closure (%) │ Tilt (%) │ 'My' position (%) │ 'My' tilt (%) │ Is Moving? │
├────────────────────┼─────────────────────────────┼─────────────────────┼─────────────┼──────────────┼─────────────┼───────────┼───────────────────┼────────────────┼────────────┤
│ Living Room Blinds │ io://1234-5678-9012/device1 │ io:StackComponent │ closed │ available │ 75 │ 0 │ 50 │ 0 │ false │
│ Bedroom Shutters │ io://1234-5678-9012/device2 │ io:StackComponent │ closed │ available │ 100 │ 0 │ 25 │ 0 │ false │
└────────────────────┴─────────────────────────────┴─────────────────────┴─────────────┴──────────────┴─────────────┴───────────┴───────────────────┴────────────────┴────────────┘
- API Key: Your Somfy API authentication key, obtain from your local gateway (required)
- Gateway URL: Your TaHoma gateway IP address or hostname (required)
- Gateway Port: Port number (optional, defaults to 8443)
The CLI automatically configures:
- Protocol: HTTPS for secure connections
- Certificate Handling: Automatic handling of self-signed certificates
- Timeouts: Reasonable timeouts for API calls
# List all devices
somfy ls
# Open living room blinds using device URL
somfy open io://1234-5678-9012/device1
# Create an alias and use it
somfy alias add living-room io://1234-5678-9012/device1
somfy close living-room
# Set blinds to 50% closed
somfy position living-room 50
# Monitor device events
somfy listen# Using environment variables
export SOMFY_API_KEY=abc123
export SOMFY_GATEWAY_HOSTNAME=192.168.1.100
somfy ls
# Using command line parameters
somfy --api-key abc123 --gateway-url 192.168.1.100 ls
# Using different output formats
somfy ls --output-style table
somfy current-execs -S jsoncargo build --releasecargo testcargo run -- ls
cargo run -- --api-key YOUR_KEY --gateway-url YOUR_GATEWAY ls- Authentication errors: Verify your API key and gateway URL are correct
- Network timeouts: Check gateway connectivity and network settings
- Permission errors: Ensure your API key has necessary permissions
- Certificate errors: The CLI handles self-signed certificates automatically
Run with detailed logging:
RUST_LOG=debug cargo run -- lsThis project is licensed under the MIT License - see the LICENSE file for details.