CLI for controlling a Tuya 3-way power strip over LAN
Project description
Tuya Outlet CLI
A simple Python CLI to control a Tuya-compatible 3-way smart power strip over your local network without using the Tuya cloud (except once during setup). Basically just a simple wrapper around the awesome tinytuya project.
Features
- Turn each plug on/off individually
- Show status including plug states and energy data (voltage, current, power)
- Simple setup command for device configuration
- Robust configuration management with timeout and retry options
Installation
Option 1: Install from PyPI (System-wide)
pipx install tuya-strip
Option 2: Install from Source (System-wide)
git clone https://github.com/wanjawischmeier/tuya-strip.git
cd tuya-strip
pipx install .
Option 3: Install from Source (Local development)
-
Install Poetry
-
Clone this repo:
git clone https://github.com/wanjawischmeier/tuya-strip.git
cd tuya-strip
- Install dependencies:
poetry install
[!NOTE] To enable
sudo tuya-stripcommands, create a system symlink:sudo ln -sf ~/.local/bin/tuya-strip /usr/local/bin/tuya-strip
Setup
Configure your device credentials:
tuya-strip setup
For system-wide configuration (requires sudo):
sudo tuya-strip setup --system-wide
The setup command will prompt you to enter your device details (you can get these by running the tinytuya setup wizard):
- Device ID
- Can be found in the respective
devicesentry in the generatedsnapshot.json->idfield - Or initially in the cloud console, under
<Your-Project> -> Devices -> All Devices -> Device ID
- Can be found in the respective
- Device IP
- Can be found in the same entry ->
ipfield - Or in the
devices.jsonunder the same field
- Can be found in the same entry ->
- Local Key
- Can be found in the same entry ->
keyfield - Or in the
devices.jsonunder the same field
- Can be found in the same entry ->
- Protocol Version (default: 3.3)
- Can be found in the
devices.json, at the very bottom of the respective device ->versionfield
- Can be found in the
Configuration is saved to your home directory (~/.tuya-strip) by default. Use --system-wide to store configuration in /etc/tuya-strip/config for all users.
[!NOTE]
If you installed for local development, prefix all commands withpoetry run(e.g.,poetry run tuya-strip setup)
Usage
tuya-strip status # Show current state and energy data
tuya-strip on 1 # Turn on plug 1
tuya-strip off 3 # Turn off plug 3
tuya-strip --timeout 5 status # Use custom timeout
tuya-strip --retries 5 on 2 # Use custom retry count
Example Output
Loading config from: C:\Users\username\.tuya-strip
Switches: {'1': True, '2': False, '3': True}
Energy: {'voltage_V': 229, 'current_mA': 120, 'power_W': 24}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tuya_strip-0.1.2.tar.gz.
File metadata
- Download URL: tuya_strip-0.1.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236fe1041c4cd4cfb33e44919b00dd20ce88cf3b08a0117cc29ebc9998f27f18
|
|
| MD5 |
15e482b90d690358fa9778ea56287dc7
|
|
| BLAKE2b-256 |
2fd9c5dd7df9c530aeb3d72a0fce9b1787742f032a51b4082555e31efd9de657
|
Provenance
The following attestation bundles were made for tuya_strip-0.1.2.tar.gz:
Publisher:
python-publish.yml on wanjawischmeier/tuya-strip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tuya_strip-0.1.2.tar.gz -
Subject digest:
236fe1041c4cd4cfb33e44919b00dd20ce88cf3b08a0117cc29ebc9998f27f18 - Sigstore transparency entry: 523508554
- Sigstore integration time:
-
Permalink:
wanjawischmeier/tuya-strip@e8f92136cd3788468d621ed9d6fb63c4817f52c8 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/wanjawischmeier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e8f92136cd3788468d621ed9d6fb63c4817f52c8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tuya_strip-0.1.2-py3-none-any.whl.
File metadata
- Download URL: tuya_strip-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f76910d968d6c1f23b955416bfe832dfbc2b06e8bc959d344b9fa71b106a454
|
|
| MD5 |
98d858460ed6e632695891925db52f43
|
|
| BLAKE2b-256 |
1d979a4cc6ec9993e5457ae0d72b89792d8bdb7ad3c4e8f71aec8b3302348e96
|
Provenance
The following attestation bundles were made for tuya_strip-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on wanjawischmeier/tuya-strip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tuya_strip-0.1.2-py3-none-any.whl -
Subject digest:
7f76910d968d6c1f23b955416bfe832dfbc2b06e8bc959d344b9fa71b106a454 - Sigstore transparency entry: 523508577
- Sigstore integration time:
-
Permalink:
wanjawischmeier/tuya-strip@e8f92136cd3788468d621ed9d6fb63c4817f52c8 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/wanjawischmeier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@e8f92136cd3788468d621ed9d6fb63c4817f52c8 -
Trigger Event:
release
-
Statement type: