Skip to main content

CLI for managing and controlling Shelly devices

Project description

shelly

A fast CLI for discovering, monitoring, and controlling Shelly smart home devices.

CI crates.io PyPI License: MIT

Features

  • Auto-discovery of Shelly devices on the local network (with subnet auto-detection)
  • Unified Gen1 + Gen2/Gen3 support (transparent protocol handling)
  • Multi-switch device support (e.g., Shelly 2.5 with dual relays)
  • Interactive watch dashboard with live power, temperature, WiFi monitoring -- and switch control
  • Energy consumption tracking (total kWh per device)
  • Detailed device info view (model, firmware, uptime, WiFi, temperature)
  • Device health checks (temperature, WiFi signal, firmware, uptime)
  • Device authentication (--password flag or config file)
  • Device groups with filter-based and name-based definitions
  • Firmware check and update across all devices
  • Config backup and restore with network-safe defaults
  • Schedule and webhook inspection (Gen2/Gen3)
  • Device renaming and configuration from the CLI
  • Structured JSON output for scripting and AI agent integration
  • Shell completions with dynamic device name suggestions (bash, zsh, fish)
  • Fuzzy device name matching with "did you mean?" suggestions
  • Color output with automatic detection

Install

uv (recommended)

uv tool install shelly-cli

Homebrew (macOS/Linux)

brew install rvben/tap/shelly-cli

pip

pip install shelly-cli

Cargo

cargo install shelly-cli

Pre-built binaries

Download from GitHub Releases.

Quick Start

# 1. Discover devices (auto-detects your subnet)
shelly discover

# 2. See what you found
shelly devices

# 3. Check device health
shelly health

Usage

Device control

shelly on "Kitchen Light"          # Turn on
shelly off "Kitchen Light"         # Turn off
shelly toggle -n "Living Room"     # Toggle
shelly status -n "Kitchen Light"   # Get status

Monitoring

shelly watch                       # Interactive dashboard
shelly health                      # Health check all devices
shelly power -a                    # Power usage for all devices
shelly energy -a                   # Total energy (kWh) per device
shelly info -n "Kitchen Light"     # Detailed device info

Device management

shelly rename -n "old-name" "New Name"    # Rename device
shelly firmware check -a                   # Check for updates
shelly firmware update -a                  # Update all firmware
shelly reboot -n "Kitchen Light"          # Reboot device

Configuration

shelly config get -n "Kitchen"                  # Get device config (JSON)
shelly config get -a                            # Get config for all devices
shelly config set -n "Kitchen" eco_mode true    # Set a config value
shelly config set -n "Kitchen" name "New Name"  # Rename via config

Supported config keys: name, eco_mode, led_status_disable.

Backup and restore

shelly backup -n "Kitchen"         # Backup single device
shelly backup -a                   # Backup all devices to shelly-backups/
shelly backup -a -o ~/backups      # Custom output directory

shelly restore -n "Kitchen" shelly-backups/kitchen-2025-01-15.json

Restore skips network/WiFi/MQTT/cloud settings to avoid bricking devices.

Schedules and webhooks

shelly schedule list -n "Kitchen"  # View device schedules (Gen2/Gen3)
shelly schedule list -a            # View all device schedules

shelly webhook list -n "Kitchen"   # View device webhooks
shelly webhook list -a             # View all device webhooks

Groups

shelly group add lights "Kitchen" "Living Room" "Bedroom"
shelly group list
shelly group show lights
shelly -g lights off               # Turn off all lights
shelly -g lights status            # Status of all lights
shelly -g gen3 firmware check      # Check firmware for Gen3 devices

Authentication

For devices with authentication enabled:

# Per-command
shelly --password "secret" status -a

# Or set in config file (~/.config/shelly-cli/config.toml)
# [auth]
# password = "secret"

Shell completions

# Generate completions (includes dynamic device name suggestions)
shelly completions zsh > ~/.zfunc/_shelly    # zsh
shelly completions bash > /etc/bash_completion.d/shelly  # bash
shelly completions fish > ~/.config/fish/completions/shelly.fish  # fish

# After installing, tab-complete device names:
# shelly -n <TAB>  →  "Kitchen Light"  "Living Room"  "Bedroom Fan"
# shelly -g <TAB>  →  "lights"  "gen1"  "gen3"

Agent Integration

Designed for scripting and AI agent use with structured, machine-readable output.

# Structured JSON output (auto-enabled when piped)
shelly status -a | jq '.data'

# Consistent envelope: {"ok": true, "data": ...} or {"ok": false, "error": {...}}
shelly -n "nonexistent" status
# {"ok": false, "error": {"code": "DEVICE_NOT_FOUND", "message": "..."}}

# Machine-readable schema with types, targeting docs, and error codes
shelly schema

Error codes: DEVICE_NOT_FOUND, DEVICE_UNREACHABLE, AUTH_REQUIRED, NETWORK_ERROR, INVALID_INPUT, GROUP_NOT_FOUND, NO_CACHED_DEVICES, PARTIAL_FAILURE.

Groups Configuration

Groups are defined in a TOML file:

# ~/.config/shelly-cli/groups.toml (Linux)
# ~/Library/Application Support/shelly-cli/groups.toml (macOS)

[groups]
lights = ["Kitchen Light", "Living Room Light", "Bedroom Light"]
gen1 = { filter = "gen1" }
gen3 = { filter = "gen3" }
all = { filter = "all" }

Or manage via CLI: shelly group add, shelly group remove, shelly group show.

Supported Devices

Generation Examples Status
Gen1 Shelly 1, 1PM, 2.5, Plug S, Dimmer Supported (switch, power, firmware, config)
Gen2 Shelly Plus 1, Plus 1PM, Plus 2PM Supported (switch, power, firmware, config, schedules, webhooks)
Gen3 Shelly Mini 1PM G3, Plus series G3 Supported (switch, power, firmware, config, schedules, webhooks)

License

MIT License -- see LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shelly_cli-0.1.9.tar.gz (59.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

shelly_cli-0.1.9-py3-none-win_amd64.whl (5.6 MB view details)

Uploaded Python 3Windows x86-64

shelly_cli-0.1.9-py3-none-manylinux_2_28_x86_64.whl (6.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

shelly_cli-0.1.9-py3-none-manylinux_2_28_aarch64.whl (5.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

shelly_cli-0.1.9-py3-none-macosx_11_0_arm64.whl (5.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

shelly_cli-0.1.9-py3-none-macosx_10_12_x86_64.whl (5.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file shelly_cli-0.1.9.tar.gz.

File metadata

  • Download URL: shelly_cli-0.1.9.tar.gz
  • Upload date:
  • Size: 59.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for shelly_cli-0.1.9.tar.gz
Algorithm Hash digest
SHA256 8439aa2c912e0ece4decb23b9320e5be1926830697908ee31c5255454b016b10
MD5 f68fcfe28c692af17410dc268b9ba5ce
BLAKE2b-256 4e19ad73b575283c50c3daf8cdf40a18ca18a75a0484a49958faac44651ec035

See more details on using hashes here.

File details

Details for the file shelly_cli-0.1.9-py3-none-win_amd64.whl.

File metadata

  • Download URL: shelly_cli-0.1.9-py3-none-win_amd64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for shelly_cli-0.1.9-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 55fa66c625ef327c9dc7cf91e8be2cbea1530c1c3dc3dbb8fa567bb794e71796
MD5 83b0dc290508ba2e959a3a47d13a98af
BLAKE2b-256 fbb3b53984f9bd0e70a3dba1c6d9ce6dce00614124aa2b08b95daf4a252a1e11

See more details on using hashes here.

File details

Details for the file shelly_cli-0.1.9-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for shelly_cli-0.1.9-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f6c950a36b4b15166ef1702307745e5e3ddca611b07b44c0153addd29d486fc0
MD5 ddb932f2c24a2c2e57b8ebdaed905540
BLAKE2b-256 9b11d99ad58d72d51279f7b7b08f572e29913bcf4c43b99cba0cf2904c7541db

See more details on using hashes here.

File details

Details for the file shelly_cli-0.1.9-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for shelly_cli-0.1.9-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 be24b9702044653e7dba11e18d8439c70438e98925785b20ee512c3d7be25b2c
MD5 134b691d2992bac3679b804cae82b9cb
BLAKE2b-256 d5ce1f1806a7a4c975a24f0c381395426f8b647bc7aea7245425156c06fb6215

See more details on using hashes here.

File details

Details for the file shelly_cli-0.1.9-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for shelly_cli-0.1.9-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e759dd21085f273fee9f7d82e4d2ed70da8e5efa117bfd986c5824bd19b02a8c
MD5 3f83698896b68af458b7bfea18346c41
BLAKE2b-256 28a483eba879090f342ed639fbbd56c056f6df829b6a6aeed327de8823ee3252

See more details on using hashes here.

File details

Details for the file shelly_cli-0.1.9-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for shelly_cli-0.1.9-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d1440ffbb1a2ff7f67984d6ee520256d6bf86fa427c41365c3b53ae5791b79c3
MD5 5fd44fde876eb2166390e940aa6f6725
BLAKE2b-256 6f71227e1336dc5f1a2cbf878d2a920914cd438d7f556d0c22a1c8992b7932f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page