Skip to main content

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)

  1. Install Poetry

  2. Clone this repo:

git clone https://github.com/wanjawischmeier/tuya-strip.git
cd tuya-strip
  1. Install dependencies:
poetry install

[!NOTE] To enable sudo tuya-strip commands, 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 devices entry in the generated snapshot.json -> id field
    • Or initially in the cloud console, under <Your-Project> -> Devices -> All Devices -> Device ID
  • Device IP
    • Can be found in the same entry -> ip field
    • Or in the devices.json under the same field
  • Local Key
    • Can be found in the same entry -> key field
    • Or in the devices.json under the same field
  • Protocol Version (default: 3.3)
    • Can be found in the devices.json, at the very bottom of the respective device -> version field

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 with poetry 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

tuya_strip-0.1.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

tuya_strip-0.1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

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

Hashes for tuya_strip-0.1.2.tar.gz
Algorithm Hash digest
SHA256 236fe1041c4cd4cfb33e44919b00dd20ce88cf3b08a0117cc29ebc9998f27f18
MD5 15e482b90d690358fa9778ea56287dc7
BLAKE2b-256 2fd9c5dd7df9c530aeb3d72a0fce9b1787742f032a51b4082555e31efd9de657

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuya_strip-0.1.2.tar.gz:

Publisher: python-publish.yml on wanjawischmeier/tuya-strip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for tuya_strip-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f76910d968d6c1f23b955416bfe832dfbc2b06e8bc959d344b9fa71b106a454
MD5 98d858460ed6e632695891925db52f43
BLAKE2b-256 1d979a4cc6ec9993e5457ae0d72b89792d8bdb7ad3c4e8f71aec8b3302348e96

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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