Skip to main content

Pull power and state data from Tuya WiFi smart devices

Project description

TuyaPower - PyPi Module

Author: Jason A. Cox https://github.com/jasonacox/tuyapower

Description

Python module to pull power and state data from Tuya WiFi smart devices.

Preparation

 sudo apt-get install python-crypto python-pip		
 pip install pycrypto
 pip install pytuya
 pip install Crypto		
 pip install pyaes		

Functions

  • deviceInfo - Poll device and return on, w, mA, V and err data.
    (on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
    
  • devicePrint - Poll device and print formatted output to stdout.
    tuyapower.devicePrint(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
    
  • deviceJSON - Poll device and return JSON formatted details.
    dataJSON = tuyapower.deviceJSON(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
    

Usage:

import tuyapower

PLUGID = '01234567891234567890'
PLUGIP = '10.0.1.99'
PLUGKEY = '0123456789abcdef'
PLUGVERS = '3.1'

(on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID,PLUGIP,PLUGKEY,PLUGVERS)

Parameters:

  • PLUGID = Device ID e.g. 01234567891234567890
  • PLUGIP = Device IP Address e.g. 10.0.1.99
  • PLUGKEY = Device Key e.g. 0123456789abcdef
  • PLUGVERS = Version of Protocol 3.1 or 3.3

Response Data:

  • on = Switch state - true or false
  • w = Wattage
  • mA = milliamps
  • V = Voltage
  • err = Error message or OK

Note: If error occurs, on will be set to false, w, mA and V will be set to -99.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tuyapower-0.0.6-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tuyapower-0.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: tuyapower-0.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.4

File hashes

Hashes for tuyapower-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 31aa1fac275d741b34f10b2efb93417d8104fed8bd2d27da5fd4080927a22021
MD5 5a7a6764fb026fb6fb1eb13c49b52993
BLAKE2b-256 08b14c6f07799765935936f384ced6717f28615d8f88055682179e54058f1a95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page