fancli 0.1.0__tar.gz

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.
fancli-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Affan Sajid
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.
fancli-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: fancli
3
+ Version: 0.1.0
4
+ Summary: CLI for controlling smart fans (currently Atomberg)
5
+ Author-email: Affan Sajid <inbox.affansajid@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Affan-sajid/fancli
8
+ Project-URL: Repository, https://github.com/Affan-sajid/fancli
9
+ Project-URL: Issues, https://github.com/Affan-sajid/fancli/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Home Automation
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: requests>=2.28.0
27
+ Requires-Dist: python-dotenv>=1.0.0
28
+ Dynamic: license-file
29
+
30
+ # fancli
31
+
32
+ [![PyPI version](https://img.shields.io/pypi/v/fancli.svg)](https://pypi.org/project/fancli/)
33
+ [![Python versions](https://img.shields.io/pypi/pyversions/fancli.svg)](https://pypi.org/project/fancli/)
34
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Affan-sajid/fancli/blob/main/LICENSE)
35
+
36
+ Terminal CLI for smart fans. It refreshes and caches an access token, reads device state, and sends commands (power, speed, timer, lights, and more). **Atomberg** is supported today via the [Atomberg IoT developer API](https://api.developer.atomberg-iot.com); more vendors may be added later.
37
+
38
+ **Repository:** [github.com/Affan-sajid/fancli](https://github.com/Affan-sajid/fancli)
39
+
40
+ ## Requirements
41
+
42
+ - Python 3.9+
43
+
44
+ ## Install
45
+
46
+ ### From PyPI
47
+
48
+ ```bash
49
+ pip install fancli
50
+ ```
51
+
52
+ CLI only, isolated from your default Python environment (recommended):
53
+
54
+ ```bash
55
+ pipx install fancli
56
+ ```
57
+
58
+ That installs the `fancli` command on your `PATH`. With plain `pip`, prefer a virtual environment or `pip install --user` and ensure your user scripts directory is on `PATH`.
59
+
60
+ ### From source (development)
61
+
62
+ From a clone of this repository:
63
+
64
+ ```bash
65
+ python -m venv .venv
66
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
67
+ pip install -e .
68
+ ```
69
+
70
+ You should then have the `fancli` command on your `PATH`.
71
+
72
+ ## Quick start
73
+
74
+ 1. Run interactive setup (credentials, device list, save `DEVICE_ID`):
75
+
76
+ ```bash
77
+ fancli setup
78
+ ```
79
+
80
+ 2. Check status:
81
+
82
+ ```bash
83
+ fancli status
84
+ ```
85
+
86
+ 3. Send a command:
87
+
88
+ ```bash
89
+ fancli set power true
90
+ fancli set speed 3
91
+ ```
92
+
93
+ 4. Key/value reference for `set`:
94
+
95
+ ```bash
96
+ fancli set --help
97
+ ```
98
+
99
+ Or: **`fancli set -h`**
100
+
101
+ Run **`fancli`** or **`fancli help`** for the full user guide (same text as the bundled `help.txt`).
102
+
103
+ ## Environment
104
+
105
+ Configure via a `.env` file (project directory, current working directory, or after setup `~/.config/fancli/.env`) or your shell. **Do not commit** `.env` or paste real tokens into issues—use placeholders when asking for help.
106
+
107
+ Variables are **names only** below; get real values from the vendor developer portal and `fancli setup`.
108
+
109
+ | Variable | Required | Description |
110
+ |----------|----------|-------------|
111
+ | `REFRESH_TOKEN` | Yes | OAuth refresh token from the developer portal |
112
+ | `API_KEY` | Yes | API key (`x-api-key` header) |
113
+ | `DEVICE_ID` | For `status` / `set` | Target device UUID |
114
+
115
+ Optional:
116
+
117
+ | Variable | Description |
118
+ |----------|-------------|
119
+ | `API_URL` | API base URL (default: `https://api.developer.atomberg-iot.com`) |
120
+ | `FANCLI_COMPANY` | Vendor name (e.g. `atomberg`); set by `fancli setup` |
121
+ | `FANCLI_TOKEN_FILE` | Override path for cached access token JSON (default: `~/.config/fancli/token.json`) |
122
+
123
+ Access tokens are cached for up to 23 hours; fancli refreshes when the cache is stale or the API returns 401.
124
+
125
+ ## Commands (summary)
126
+
127
+ | Command | Purpose |
128
+ |---------|---------|
129
+ | `fancli` / `fancli help` | Full user guide |
130
+ | `fancli setup` | Interactive wizard: vendor, credentials, list devices, save selection |
131
+ | `fancli status` | Device state (`--json` for raw JSON) |
132
+ | `fancli set <key> <value>` | Send a command; **`fancli set --help`** / **`-h`** for the key/value reference (Quick start) |
133
+
134
+ ## Troubleshooting
135
+
136
+ - **`REFRESH_TOKEN is not set`** — Run `fancli setup` or set variables in `.env` or your environment.
137
+ - **HTTP 401** — fancli tries to refresh the token once; verify refresh token and API key if it keeps failing.
138
+ - **`help file not found`** — Reinstall the package or run from a checkout with `fancli/help.txt` present.
fancli-0.1.0/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # fancli
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/fancli.svg)](https://pypi.org/project/fancli/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/fancli.svg)](https://pypi.org/project/fancli/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Affan-sajid/fancli/blob/main/LICENSE)
6
+
7
+ Terminal CLI for smart fans. It refreshes and caches an access token, reads device state, and sends commands (power, speed, timer, lights, and more). **Atomberg** is supported today via the [Atomberg IoT developer API](https://api.developer.atomberg-iot.com); more vendors may be added later.
8
+
9
+ **Repository:** [github.com/Affan-sajid/fancli](https://github.com/Affan-sajid/fancli)
10
+
11
+ ## Requirements
12
+
13
+ - Python 3.9+
14
+
15
+ ## Install
16
+
17
+ ### From PyPI
18
+
19
+ ```bash
20
+ pip install fancli
21
+ ```
22
+
23
+ CLI only, isolated from your default Python environment (recommended):
24
+
25
+ ```bash
26
+ pipx install fancli
27
+ ```
28
+
29
+ That installs the `fancli` command on your `PATH`. With plain `pip`, prefer a virtual environment or `pip install --user` and ensure your user scripts directory is on `PATH`.
30
+
31
+ ### From source (development)
32
+
33
+ From a clone of this repository:
34
+
35
+ ```bash
36
+ python -m venv .venv
37
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
38
+ pip install -e .
39
+ ```
40
+
41
+ You should then have the `fancli` command on your `PATH`.
42
+
43
+ ## Quick start
44
+
45
+ 1. Run interactive setup (credentials, device list, save `DEVICE_ID`):
46
+
47
+ ```bash
48
+ fancli setup
49
+ ```
50
+
51
+ 2. Check status:
52
+
53
+ ```bash
54
+ fancli status
55
+ ```
56
+
57
+ 3. Send a command:
58
+
59
+ ```bash
60
+ fancli set power true
61
+ fancli set speed 3
62
+ ```
63
+
64
+ 4. Key/value reference for `set`:
65
+
66
+ ```bash
67
+ fancli set --help
68
+ ```
69
+
70
+ Or: **`fancli set -h`**
71
+
72
+ Run **`fancli`** or **`fancli help`** for the full user guide (same text as the bundled `help.txt`).
73
+
74
+ ## Environment
75
+
76
+ Configure via a `.env` file (project directory, current working directory, or after setup `~/.config/fancli/.env`) or your shell. **Do not commit** `.env` or paste real tokens into issues—use placeholders when asking for help.
77
+
78
+ Variables are **names only** below; get real values from the vendor developer portal and `fancli setup`.
79
+
80
+ | Variable | Required | Description |
81
+ |----------|----------|-------------|
82
+ | `REFRESH_TOKEN` | Yes | OAuth refresh token from the developer portal |
83
+ | `API_KEY` | Yes | API key (`x-api-key` header) |
84
+ | `DEVICE_ID` | For `status` / `set` | Target device UUID |
85
+
86
+ Optional:
87
+
88
+ | Variable | Description |
89
+ |----------|-------------|
90
+ | `API_URL` | API base URL (default: `https://api.developer.atomberg-iot.com`) |
91
+ | `FANCLI_COMPANY` | Vendor name (e.g. `atomberg`); set by `fancli setup` |
92
+ | `FANCLI_TOKEN_FILE` | Override path for cached access token JSON (default: `~/.config/fancli/token.json`) |
93
+
94
+ Access tokens are cached for up to 23 hours; fancli refreshes when the cache is stale or the API returns 401.
95
+
96
+ ## Commands (summary)
97
+
98
+ | Command | Purpose |
99
+ |---------|---------|
100
+ | `fancli` / `fancli help` | Full user guide |
101
+ | `fancli setup` | Interactive wizard: vendor, credentials, list devices, save selection |
102
+ | `fancli status` | Device state (`--json` for raw JSON) |
103
+ | `fancli set <key> <value>` | Send a command; **`fancli set --help`** / **`-h`** for the key/value reference (Quick start) |
104
+
105
+ ## Troubleshooting
106
+
107
+ - **`REFRESH_TOKEN is not set`** — Run `fancli setup` or set variables in `.env` or your environment.
108
+ - **HTTP 401** — fancli tries to refresh the token once; verify refresh token and API key if it keeps failing.
109
+ - **`help file not found`** — Reinstall the package or run from a checkout with `fancli/help.txt` present.
@@ -0,0 +1 @@
1
+ """Atomberg IoT fan CLI."""