Skip to main content

Python interface to Tuya WiFi smart devices.

Project description

TuyaFace

Tuya client that allows you to locally communicate with tuya devices without the tuya-cloud.

Installation

pip install tuyaface

Public Interface

Request current device status

status(device: dict)
Returns dict

Update device dps state

set_state(device: dict, value: bool, idx: int = 1)
Returns dict

Update device status

set_status(device: dict, dps: dict)
Returns dict

Device dict

device = {
    'protocol': '3.3', # 3.1 | 3.3
    'deviceid': '34280100600194d17c96',
    'localkey': 'e7e9339aa82abe61',
    'ip': '192.168.1.101',            
}

DPS dict

dps = {
    '1': True,
    '2': False,
    '101': 255,
    '102': 128,
    ...etc...
}

Todo

Changelog

v1.1.6

  • payload protocol exception
  • fix return values
  • fix checks
  • inline function documentation
  • as per #27 retries/max recursion
  • clean up _connect
  • always return json (now json or None)
  • removed pyaes
  • revert #20

v1.1.5

  • fix #24
  • additional condition on #20
  • use const in _generate_json_data

v1.1.4

  • _select_reply use filter correction

v1.1.3

  • _select_reply use filter (fix #20?)
  • added check for empty string replies
  • corrected setup.py

v1.1.2

  • moved constants to separate file
  • _stitch_payload type casting

v1.1.1

  • better description pub interface
  • replaced pycrypto with pycryptodome

v1.1.0 Breaking

  • function set_status was added
  • functionname set_status was changed to set_state

v1.0.5

  • setup fixed
  • split _generate_payload function to a readable format
  • add support for older devices back in (untested, please report back)
  • solved recursion problem in send_request
  • moved functions back to init
  • removed TuyaConnection class, use send_request in try/except
  • declassified aescipher
  • moved to a more functional programming style
  • yield and list comprehensions
  • setup.py
  • removed code for older devices < 3.3

Implementations

Acknowledgements

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

tuyaface-1.1.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

tuyaface-1.1.6-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file tuyaface-1.1.6.tar.gz.

File metadata

  • Download URL: tuyaface-1.1.6.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for tuyaface-1.1.6.tar.gz
Algorithm Hash digest
SHA256 11536351cf4331e1d0c932b8ba85fd87ba161e27f7783ea9fc0a285f08f59709
MD5 cd89c560d68d50f1377c772b10d5e10d
BLAKE2b-256 f08e6dc7e4ef7c36c9b3f092e285483196d1201416aaaee796a24f1d7df5951b

See more details on using hashes here.

File details

Details for the file tuyaface-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: tuyaface-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for tuyaface-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 daa1600916e5531ec1a5924dd2101de00677c433b4706ab8c656ce502e2831eb
MD5 c12c9b6062afbf190b942fe3613f68ac
BLAKE2b-256 28833fd92ed35d20fea9f3d21306f14da022d4bb8d669878ff966bdfb9b63a2d

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