shelly-cli 0.1.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shelly_cli/__init__.py +10 -0
- shelly_cli/__main__.py +49 -0
- shelly_cli/py.typed +0 -0
- shelly_cli-0.1.0.data/scripts/shelly.exe +0 -0
- shelly_cli-0.1.0.dist-info/METADATA +181 -0
- shelly_cli-0.1.0.dist-info/RECORD +9 -0
- shelly_cli-0.1.0.dist-info/WHEEL +4 -0
- shelly_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
- shelly_cli-0.1.0.dist-info/sboms/shelly-cli.cyclonedx.json +5673 -0
shelly_cli/__init__.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
shelly-cli: A fast CLI for discovering, monitoring, and controlling Shelly devices.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from importlib.metadata import version
|
|
7
|
+
__version__ = version("shelly-cli")
|
|
8
|
+
except ImportError:
|
|
9
|
+
from importlib_metadata import version
|
|
10
|
+
__version__ = version("shelly-cli")
|
shelly_cli/__main__.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command-line interface for shelly-cli.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
import subprocess
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def find_native_binary() -> str:
|
|
14
|
+
"""Find the native Rust binary."""
|
|
15
|
+
project_root = Path(__file__).resolve().parent.parent.parent
|
|
16
|
+
target_binary = project_root / "target" / "release" / "shelly"
|
|
17
|
+
if target_binary.exists() and not target_binary.is_dir():
|
|
18
|
+
return str(target_binary)
|
|
19
|
+
|
|
20
|
+
if sys.platform == "win32":
|
|
21
|
+
target_binary = project_root / "target" / "release" / "shelly.exe"
|
|
22
|
+
if target_binary.exists() and not target_binary.is_dir():
|
|
23
|
+
return str(target_binary)
|
|
24
|
+
|
|
25
|
+
raise FileNotFoundError(
|
|
26
|
+
"Could not find the native shelly binary. "
|
|
27
|
+
"Please ensure it was built with 'cargo build --release'."
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def main() -> int:
|
|
32
|
+
"""Run the shelly command line tool."""
|
|
33
|
+
try:
|
|
34
|
+
native_binary = find_native_binary()
|
|
35
|
+
args = [native_binary] + sys.argv[1:]
|
|
36
|
+
|
|
37
|
+
if sys.platform == "win32":
|
|
38
|
+
completed_process = subprocess.run(args)
|
|
39
|
+
return completed_process.returncode
|
|
40
|
+
else:
|
|
41
|
+
os.execv(native_binary, args)
|
|
42
|
+
return 0
|
|
43
|
+
except FileNotFoundError as e:
|
|
44
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
45
|
+
return 1
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
sys.exit(main())
|
shelly_cli/py.typed
ADDED
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shelly-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Topic :: Home Automation
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Summary: CLI for managing and controlling Shelly devices
|
|
14
|
+
Home-Page: https://github.com/rvben/shelly-cli
|
|
15
|
+
Author-email: Ruben Jongejan <ruben.jongejan@gmail.com>
|
|
16
|
+
License: MIT
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
19
|
+
Project-URL: Homepage, https://github.com/rvben/shelly-cli
|
|
20
|
+
Project-URL: Repository, https://github.com/rvben/shelly-cli.git
|
|
21
|
+
|
|
22
|
+
# shelly
|
|
23
|
+
|
|
24
|
+
A fast CLI for discovering, monitoring, and controlling Shelly smart home devices.
|
|
25
|
+
|
|
26
|
+
 [](https://crates.io/crates/shelly-cli) [](LICENSE)
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- Auto-discovery of Shelly devices on the local network
|
|
31
|
+
- Unified Gen1 + Gen2/Gen3 support (transparent protocol handling)
|
|
32
|
+
- Interactive watch dashboard with live power, temperature, WiFi monitoring -- and switch control
|
|
33
|
+
- Device health checks (temperature, WiFi signal, firmware, uptime)
|
|
34
|
+
- Device groups with filter-based and name-based definitions
|
|
35
|
+
- Firmware check and update across all devices
|
|
36
|
+
- Device renaming from the CLI
|
|
37
|
+
- Structured JSON output for scripting and AI agent integration
|
|
38
|
+
- Shell completions (bash, zsh, fish, powershell)
|
|
39
|
+
- Fuzzy device name matching with "did you mean?" suggestions
|
|
40
|
+
- Color output with automatic detection
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
### uv (recommended)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv tool install shelly-cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### pip
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install shelly-cli
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Cargo
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cargo install shelly-cli
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Homebrew (macOS/Linux)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
brew install rvben/tap/shelly-cli
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Pre-built binaries
|
|
69
|
+
|
|
70
|
+
Download from [GitHub Releases](https://github.com/rvben/shelly-cli/releases).
|
|
71
|
+
|
|
72
|
+
### From source
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/rvben/shelly-cli.git
|
|
76
|
+
cd shelly-cli
|
|
77
|
+
cargo install --path .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 1. Discover devices on your network
|
|
84
|
+
shelly discover --subnet 192.168.1.0/24
|
|
85
|
+
|
|
86
|
+
# 2. See what you found
|
|
87
|
+
shelly devices
|
|
88
|
+
|
|
89
|
+
# 3. Check device health
|
|
90
|
+
shelly health
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Usage
|
|
94
|
+
|
|
95
|
+
### Device control
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
shelly on "Kitchen Light" # Turn on
|
|
99
|
+
shelly off "Kitchen Light" # Turn off
|
|
100
|
+
shelly toggle -n "Living Room" # Toggle
|
|
101
|
+
shelly status -n "Kitchen Light" # Get status
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Monitoring
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
shelly watch # Interactive dashboard
|
|
108
|
+
shelly health # Health check all devices
|
|
109
|
+
shelly power -a # Power usage for all devices
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Device management
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
shelly rename -n "old-name" "New Name" # Rename device
|
|
116
|
+
shelly firmware check -a # Check for updates
|
|
117
|
+
shelly firmware update -a # Update all firmware
|
|
118
|
+
shelly reboot -n "Kitchen Light" # Reboot device
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Groups
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
shelly group add lights "Kitchen" "Living Room" "Bedroom"
|
|
125
|
+
shelly group list
|
|
126
|
+
shelly -g lights off # Turn off all lights
|
|
127
|
+
shelly -g lights status # Status of all lights
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Configuration
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
shelly config get -n "Kitchen" # Get device config
|
|
134
|
+
shelly completions zsh # Generate shell completions
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Agent Integration
|
|
138
|
+
|
|
139
|
+
Designed for scripting and AI agent use with structured, machine-readable output.
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Structured JSON output (auto-enabled when piped)
|
|
143
|
+
shelly status -a | jq '.data'
|
|
144
|
+
|
|
145
|
+
# Consistent envelope: {"ok": true, "data": ...} or {"ok": false, "error": {...}}
|
|
146
|
+
shelly -n "nonexistent" status
|
|
147
|
+
# {"ok": false, "error": {"code": "DEVICE_NOT_FOUND", "message": "..."}}
|
|
148
|
+
|
|
149
|
+
# Machine-readable schema
|
|
150
|
+
shelly schema
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Groups Configuration
|
|
154
|
+
|
|
155
|
+
Groups are defined in a TOML file:
|
|
156
|
+
|
|
157
|
+
```toml
|
|
158
|
+
# ~/.config/shelly-cli/groups.toml (Linux)
|
|
159
|
+
# ~/Library/Application Support/shelly-cli/groups.toml (macOS)
|
|
160
|
+
|
|
161
|
+
[groups]
|
|
162
|
+
lights = ["Kitchen Light", "Living Room Light", "Bedroom Light"]
|
|
163
|
+
gen1 = { filter = "gen1" }
|
|
164
|
+
gen3 = { filter = "gen3" }
|
|
165
|
+
all = { filter = "all" }
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Or manage via CLI: `shelly group add`, `shelly group remove`, `shelly group show`.
|
|
169
|
+
|
|
170
|
+
## Supported Devices
|
|
171
|
+
|
|
172
|
+
| Generation | Examples | Status |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Gen1 | Shelly 1, 1PM, 2.5, Plug S, Dimmer | Supported (switch, power, firmware) |
|
|
175
|
+
| Gen2 | Shelly Plus 1, Plus 1PM, Plus 2PM | Supported (switch, power, firmware) |
|
|
176
|
+
| Gen3 | Shelly Mini 1PM G3, Plus series G3 | Supported (switch, power, firmware) |
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
MIT License -- see [LICENSE](LICENSE) file.
|
|
181
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
shelly_cli/__init__.py,sha256=LFXz8WH0VBmDz4h96zD9rcQ8psVvfwtKWTgPRLHa_EU,294
|
|
2
|
+
shelly_cli/__main__.py,sha256=rrROt7VhrYCakadWAIUVrz5U83Ris75zi64JhiEv3p4,1394
|
|
3
|
+
shelly_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
shelly_cli-0.1.0.data/scripts/shelly.exe,sha256=0WmojkcTxOgolRnh2LoLDAPvaqt7Tih8KcgaRpdrqR4,5857280
|
|
5
|
+
shelly_cli-0.1.0.dist-info/METADATA,sha256=13eBxO8Uv9cfd5mjBnKKS3rPoEIgD-DX3tWrF-xARb0,4943
|
|
6
|
+
shelly_cli-0.1.0.dist-info/WHEEL,sha256=uJOc2U-Q1x95AlblQcqMRb3iR4QnPtdI7X2ycPN99rM,94
|
|
7
|
+
shelly_cli-0.1.0.dist-info/licenses/LICENSE,sha256=YyJnikhAW7_HwaUPeO-iJud1fh2UplNX6MZP1zd1OXY,1092
|
|
8
|
+
shelly_cli-0.1.0.dist-info/sboms/shelly-cli.cyclonedx.json,sha256=x55VHperaL4ETSIcYSyknccyNSxG4wEnh8Ra1hzNN78,179667
|
|
9
|
+
shelly_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ruben Jongejan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|