tinytuya | Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the clo

 by   jasonacox Python Version: 1.14.1.dev0 License: MIT

kandi X-RAY | tinytuya Summary

kandi X-RAY | tinytuya Summary

tinytuya is a Python library typically used in Internet of Things (IoT) applications. tinytuya has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install tinytuya' or download it from GitHub, PyPI.

This python module controls and reads state of Tuya compatible WiFi Smart Devices (Plugs, Switches, Lights, Window Covers, etc.) using the local area network (LAN) or the cloud (TuyaCloud API). This is a compatible replacement for the pytuya PyPi module. Tuya devices are designed to communicate with the TuyaCloud but most also expose a local area network API, allowing us to directly control the devices without using the cloud. This python module provides a way to poll status and issue commands to these devices. Starting with v1.3.0, TinyTuya can also connect to the Tuya Cloud to poll status and issue commands to Tuya devices. NOTE: This module requires the devices to have already been activated by Smart Life App.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              tinytuya has a low active ecosystem.
              It has 492 star(s) with 112 fork(s). There are 23 watchers for this library.
              There were 3 major release(s) in the last 6 months.
              There are 56 open issues and 143 have been closed. On average issues are closed in 188 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of tinytuya is 1.14.1.dev0

            kandi-Quality Quality

              tinytuya has 0 bugs and 0 code smells.

            kandi-Security Security

              tinytuya has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              tinytuya code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              tinytuya is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              tinytuya releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 2350 lines of code, 113 functions and 15 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed tinytuya and discovered the below as its top functions. This is intended to give you an instant insight into tinytuya implemented functionality, and help decide if they suit your requirements.
            • Run TinyTiny wizard
            • Get OAuth token from Cloud Platform
            • Builds a TensorBoard URL
            • Filter a list of devices
            • List all available devices
            • Remove connection from server
            • Get my ip address
            • Handles GET requests
            • Generate payload
            • Prints a list of TensorBoard devices
            • List available devices
            • Send request to device
            • Close the socket
            • Set colour temperature
            • Set bulb mode
            • Return a list of devices
            • Get scene transitions
            • Turns the brightness
            • Set the brightness of the bulb
            • Set timer
            • Set white
            • Set bulb type
            • Print a snapshot of all devices
            • Generate a payload
            • Start the Tuybal thread
            • Receive a button
            • Return a list of polling devices
            • Set colour
            Get all kandi verified functions for this library.

            tinytuya Key Features

            No Key Features are available at this moment for tinytuya.

            tinytuya Examples and Code Snippets

            No Code Snippets are available at this moment for tinytuya.

            Community Discussions

            Trending Discussions on Internet of Things (IoT)

            QUESTION

            Display data from two json files in react native
            Asked 2020-May-17 at 23:55

            I have js files Dashboard and Adverts. I managed to get Dashboard to list the information in one json file (advertisers), but when clicking on an advertiser I want it to navigate to a separate page that will display some data (Say title and text) from the second json file (productadverts). I can't get it to work. Below is the code for the Dashboard and next for Adverts. Then the json files

            ...

            ANSWER

            Answered 2020-May-17 at 23:55

            The new object to get params in React Navigation 5 is:

            Source https://stackoverflow.com/questions/61859411

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install tinytuya

            Install pip and python modules if you haven't already. The PyPI module will attempt to install pycryptodome if you don't have it. The modules pycrypto, Crypto or pyaes could be used instead.
            TinyTuya has a built-in setup Wizard that uses the Tuya IoT Cloud Platform to generate a JSON list (devices.json) of all your registered devices, including secret Local_Key and Name of your devices. Follow the steps below:.
            PAIR - Download the Smart Life App or Tuya Smart App, available for iPhone or Android. Pair all of your Tuya devices (this is important as you cannot access a device that has not been paired).
            SCAN - Run the TinyTuya scan to get a list of Tuya devices on your network. It will show device Address, Device ID and Version number (3.1 or 3.3): python -m tinytuya scan NOTE: You will need to use one of the displayed Device IDs for step 4.
            TUYA ACCOUNT - Set up a Tuya Account: Create a Tuya Developer account on iot.tuya.com and log in. NOTE: Tuya makes changes to their portal and this process frequently so details may vary. Please create an issue or pull request with screenshots if we need to update these instructions. Click on "Cloud" icon -> "Create Cloud Project" Remember the "Data Center" you select. This will be used by TinyTuya Wizard (screenshot). Skip the configuration wizard but remember the Authorization Key: API ID and Secret for below (screenshot). Click on "Cloud" icon -> Select your project -> Devices -> Link Tuya App Account (see screenshot) Click Add App Account (screenshot) and it will display a QR code. Scan the QR code with the Smart Life app on your Phone (see step 1 above) by going to the "Me" tab in the Smart Life app and clicking on the QR code button [..] in the upper right hand corner of the app. When you scan the QR code, it will link all of the devices registered in your Smart Life app into your Tuya IoT project. NO DEVICES? If no devices show up after scanning the QR code, you will need to select a different data center and edit your project (or create a new one) until you see your paired devices from the Smart Life App show up. (screenshot). The data center may not be the most logical. As an example, some in the UK have reported needing to select "Central Europe" instead of "Western Europe". SERVICE API: Under "Service API" ensure these APIs are listed: IoT Core, Authorization and Smart Home Scene Linkage. To be sure, click subscribe again on every service. Very important: disable popup blockers otherwise subscribing won't work without providing any indication of a failure. Make sure you authorize your Project to use those APIs: Click "Service API" tab Click "Go to Authorize" button Select the API Groups from the dropdown and click Subscribe (screenshot)
            WIZARD - Run Setup Wizard: Tuya has changed their data center regions. Make sure you are using the latest version of TinyTuya (v1.2.10 or newer). From your Linux/Mac/Win PC run the TinyTuya Setup Wizard to fetch the Local_Keys for all of your registered devices: python -m tinytuya wizard # use -nocolor for non-ANSI-color terminals e.g. Windows cmd The Wizard will prompt you for the API ID key, API Secret, API Region (cn, us, us-e, eu, eu-w, or in) from your Tuya IoT project as set in Step 3 above. To find those again, go to iot.tuya.com, choose your project and click Overview API Key: Access ID/Client ID API Secret: Access Secret/Client Secret It will also ask for a sample Device ID. Use one from step 2 above or found in the Device List on your Tuya IoT project. The Wizard will poll the Tuya IoT Cloud Platform and print a JSON list of all your registered devices with the "name", "id" and "key" of your registered device(s). The "key"s in this list are the Devices' Local_Key you will use to access your device. In addition to displaying the list of devices, Wizard will create a local file devices.json that TinyTuya will use to provide additional details for scan results from tinytuya.deviceScan() or when running python -m tinytuya scan. The wizard also creates a local file tuya-raw.json that contains the entire payload from Tuya Cloud. The Wizard will ask if you want to poll all the devices. If you do, it will display the status of all devices on record and create a snapshot.json file with these results.
            If you ever reset or re-pair your smart devices, the Local_Key will be reset and you will need to repeat the steps above.
            The TinyTuya Wizard was inspired by the TuyAPI CLI which is an alternative way to fetch the Local_Keys: npm i @tuyapi/cli -g and run tuya-cli wizard

            Support

            Tuya devices only allow one TCP connection at a time. Make sure you close the TuyaSmart or SmartLife app before using TinyTuya to connect.Some devices ship with older firmware that may not work with TinyTuya. If you're experiencing issues, please try updating the device's firmware in the official app.The LOCAL KEY for Tuya devices will change every time a device is removed and re-added to the TuyaSmart app. If you're getting decrypt errors, try getting the key again as it might have changed.Devices running protocol version 3.1 (e.g. below Firmware 1.0.5) do not require a device Local_Key to read the status. Both 3.1 and 3.3 devices will require a device Local_Key to control the device.Some devices with 22 character IDs will require additional setting to poll correctly - here is an example: a = tinytuya.OutletDevice('here_is_my_key', '192.168.x.x', 'secret_key_here', 'device22') a.set_version(3.3) a.set_dpsUsed({"1": None}) # This needs to be a datapoint available on the device data = a.status() print(data)Windows 10 Users - TinyTuya wizard and scan interactive tools use ANSI color. This will work correctly in PowerShell but will show cryptic escape codes when run in Windows CMD. You can fix this by using the -nocolor option on tinytuya, or by changing the Windows CMD console registry to process ANSI escape codes by doing something like this: reg add HKEY_CURRENT_USER\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install tinytuya

          • CLONE
          • HTTPS

            https://github.com/jasonacox/tinytuya.git

          • CLI

            gh repo clone jasonacox/tinytuya

          • sshUrl

            git@github.com:jasonacox/tinytuya.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link