Set_version(version) # Set device version 3.1 or 3.3 (all new devices) Parent = None (object): Gateway device object this is a child ofĬloud(apiRegion, apiKey, apiSecret, apiDeviceID, new_sign_algorithm) Persist = False (bool): Keep TCP link open Version = 3.1 (float): Tuya Protocol (e.g. 10.0.1.99 or "Auto" to auto-findĭev_type (str): Device type for payload options (see below)Ĭonnection_timeout = 5 (int): Timeout in seconds Set_debug(toggle, color) # Activate verbose debugging outputĭev_id (str): Device ID e.g. Scan() # Interactive scan of local network Here is an example for a Tuya smart switch or plug:ĭevices = deviceScan() # Returns dictionary of devices found on local network The TinyTuya Wizard was inspired by the TuyAPI CLI which is an alternative way to fetch the Local_Keys: npm i -g and run tuya-cli wizardĪfter importing tinytuya, you create a device handle for the device you want to read or control.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.Make sure your LAN and firewall permit UDP (6666, 66) and TCP (6668) traffic. If you do, it will display the status of all devices on record and create a snapshot.json file with these results. The Wizard will ask if you want to poll all the devices.The wizard also creates a local file tuya-raw.json that contains the entire payload from Tuya Cloud. 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 viceScan() or when running python -m tinytuya scan. The "key"s in this list are the Devices' Local_Key you will use to access your device. 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).You can have the wizard scan for one (enter scan), use one from step 2 above or in the Device List on your Tuya IoT project. It will also ask for a sample Device ID.API Secret: Access Secret/Client Secret.To find those again, go to, choose your project and click Overview.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.Python -m tinytuya wizard # use -nocolor for non-ANSI-color terminals From your Linux/Mac/Win PC run the TinyTuya Setup Wizard to fetch the Local_Keys for all of your registered devices:.Select the API Groups from the dropdown and click Subscribe ( screenshot). Make sure you authorize your Project to use those APIs: Very important: disable popup blockers otherwise subscribing won't work without providing any indication of a failure. To be sure, click subscribe again on every service.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |