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

Setup

  1. Clone this repo:
git clone https://github.com/yourname/tuya-powerstrip-cli.git
cd tuya-powerstrip-cli
  1. Install dependencies:
poetry install
  1. Configure your device credentials:
poetry run tuya-strip setup

The setup command will prompt you to enter your device details:

  • Device ID
  • Device IP address
  • Local Key
  • Protocol Version (default: 3.3)

Configuration is saved to your home directory (~/.tuya-strip) and will work from any directory.

Usage

poetry run tuya-strip status          # Show current state and energy data
poetry run tuya-strip on 1            # Turn on plug 1
poetry run tuya-strip off 3           # Turn off plug 3
poetry run tuya-strip --timeout 5 status  # Use custom timeout
poetry run 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.0.tar.gz (3.8 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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tuya_strip-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tuya_strip-0.1.0.tar.gz
Algorithm Hash digest
SHA256 14bad5248656abd671a8f8dbfdadb6e303247881b29cce31c031aad369018ccd
MD5 0b1c241bddd748340aefbc3c82174616
BLAKE2b-256 ec37ad1aa99e69c49d0c78bef6d89a3aef4a3c8dd0d2b75ed9aebb00f2df0172

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tuya_strip-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tuya_strip-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d32f4112d892fa2af904f422d7a0017db261716f252eebcb733c599d4410203
MD5 45c84899af212a2440c2e6dd15ea9405
BLAKE2b-256 044f31a7c312f5a44661b48ad80708280e4de5e0da273e57beb03c9bf34f11eb

See more details on using hashes here.

Provenance

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