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.3.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.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file tuya_strip-0.1.3.tar.gz.

File metadata

  • Download URL: tuya_strip-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 aa805aa32d770e3c73041de9285a999fd91955a6a59afeb6e8981f8d6f6e2493
MD5 abfcec97b7ee24c078e0f511c8c575ec
BLAKE2b-256 fd7ae48cd43803a1540a05c27afc0d94e086bd51dbccc42da77e7762a61069f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuya_strip-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: tuya_strip-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 27f7a2c7239fc6187e9cfe0633e91b1e9eb7f8b07bfa5296ac520c3166d948e3
MD5 8984e24bd856069beabe00399f2aebbb
BLAKE2b-256 33024e28726fbfd0864273664f16a6fd5a3306d88f5d85513928aa11b23897d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tuya_strip-0.1.3-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