GithubHelp home page GithubHelp logo

tuya / tuya-open-sdk-for-device Goto Github PK

View Code? Open in Web Editor NEW
21.0 16.0 12.0 6.81 MB

Tuya open source IoT development framework for device

Home Page: https://github.com/tuya/tuya-open-sdk-for-device

License: Other

CMake 0.60% C 88.52% Makefile 0.66% HTML 0.01% Perl 0.42% Tcl 0.01% Shell 5.21% Python 4.52% SmPL 0.01% Batchfile 0.01% Dockerfile 0.03% GDB 0.02%
iot

tuya-open-sdk-for-device's Introduction

tuya-open-sdk-for-device

English | 简体中文

Overview

tuya-open-sdk-for-device is an open source IoT development framework that supports cross-chip platforms and operating systems. It is designed based on a universal southbound interface and supports communication protocols such as Bluetooth, Wi-Fi, and Ethernet. It provides core functionalities for IoT development, including pairing, activation, control, and upgrading. The sdk has robust security and compliance capabilities, including device authentication, data encryption, and communication encryption, meeting data compliance requirements in various countries and regions worldwide.

IoT products developed using the tuya-open-sdk-for-device, if utilizing the functionality of the tuya_cloud_service component, can make use of the powerful ecosystem provided by the Tuya APP and cloud services, and achieve interoperability with Power By Tuya devices.

Getting Start

Prerequisites

Ubuntu and Debian

$ sudo apt-get install lcov cmake-curses-gui build-essential wget git python3 python3-pip python3-venv libc6-i386 libsystemd-dev

Clone the repository

$ git clone https://github.com/tuya/tuya-open-sdk-for-device.git
$ git submodule update --init

Setup and Compilation

Setting Environment Variables

$ cd tuya-open-sdk-for-device
$ export PATH=$PATH:$PWD

Or add the tuya-open-sdk-for-device path to your system environment variables.

Configuration

To configure the selected examples or apps project, run the following command in the corresponding project directory for menu-driven configuration:

$ cd examples/get-started/sample_project
$ tos menuconfig

Compilation

Choose the current examples or apps project to compile.

$ cd examples/get-started/sample_project
$ tos build

After compilation, the target files will be located in the examples/get-started/sample_project/.build/t2/bin/t2_1.0.0 directory.

Tuya Cloud Applications Project

switch_demo demonstrates a simple cross-platform, cross-system switch example that supports multiple connections. Through the Tuya App and Tuya Cloud Service, this switch can be remotely controlled.

  1. Create a product and obtain the Product ID (PID):

Refer to the documentation at https://developer.tuya.com/en/docs/iot-device-dev/application-creation?id=Kbxw7ket3aujc to create a product on https://iot.tuya.com and obtain the PID for the created product.

  1. Modify the example:

In the file apps/tuya_cloud/switch_demo/src/tuya_config.h, the macros TUYA_PRODUCT_KEY, TUYA_DEVICE_UUID, and TUYA_DEVICE_AUTHKEY correspond to the PID and uuid, authkey respectively. Please correctly modify these according to the PID and uuid, authkey obtained in steps 1 and 2, then delete the #error statement.

FAQ

  1. The supported boards for tuya-open-sdk-for-device are dynamically downloaded through subrepositories. Updating the tuya-open-sdk-for-device repository itself will not automatically update the subrepositories. If you encounter any issues with compilation, please navigate to the corresponding directory in the "board" folder and use the git pull command to update, or delete the corresponding directory in the "board" folder and download it again.

  2. Activation through QR code scanning requires the product PID to support the "Device Direct Cloud" feature. Otherwise, activation will result in an error and prevent normal activation.

qrencode

License

Distributed under the Apache License Version 2.0. For more information, see LICENSE.

Disclaimer and Liability Clause

Users should be clearly aware that this project may contain submodules developed by third parties. These submodules may be updated independently of this project. Considering that the frequency of updates for these submodules is uncontrollable, this project cannot guarantee that these submodules are always the latest version. Therefore, if users encounter problems related to submodules when using this project, it is recommended to update them as needed or submit an issue to this project.

If users decide to use this project for commercial purposes, they should fully recognize the potential functional and security risks involved. In this case, users should bear all responsibility for any functional and security issues, perform comprehensive functional and safety tests to ensure that it meets specific business needs. Our company does not accept any liability for direct, indirect, special, incidental, or punitive damages caused by the user's use of this project or its submodules.

tuya-open-sdk-for-device's People

Contributors

flyingcys avatar

Stargazers

Fields avatar letian avatar  avatar  avatar  avatar 思门 avatar  avatar Jason avatar leo.chen avatar Howe1024_Li avatar Libing avatar KyleDeng avatar  avatar 杨杰 avatar  avatar  avatar evan.xia avatar SenlinDing avatar jamlook avatar Linch avatar

Watchers

Lucian avatar fengxiao avatar miyazaki2048 avatar 张凯 avatar ZeroL avatar Ronbin avatar beautifulzzzz avatar  avatar hick avatar  avatar yangwoo avatar  avatar  avatar evan.xia avatar 秋风 avatar  avatar

tuya-open-sdk-for-device's Issues

mqtt connect fail

when i excute demo, here are the error log

[02-01 09:47:05 ty E][mqtt_client_wrapper.c:228] mqtt connect err: Connection not authorized(11)
[02-01 09:47:05 ty D][tls_transporter.c:94] tls transporter close socket fd:7
[02-01 09:47:05 ty D][tcp_transporter.c:175] tcp transporter close socket fd:7
[02-01 09:47:05 ty D][tls_transporter.c:102] tls transporter close tls handler:0x7fd3a7add5e8
[02-01 09:47:05 ty D][tuya_tls.c:685] TUYA_TLS Disconnect ENTER
[02-01 09:47:05 ty D][tuya_tls.c:710] TUYA_TLS Disconnect Success
[02-01 09:47:05 ty E][mqtt_service.c:406] MQTT connect fail:3
[02-01 09:47:05 ty E][mqtt_bind.c:107] tuya mqtt connect fail:-34, retry..
[02-01 09:47:07 ty I][mqtt_service.c:394] clientid:acon_uuidxxxxxxxxxxxxxxxx
[02-01 09:47:07 ty I][mqtt_service.c:395] username:acon_uuidxxxxxxxxxxxxxxxx|pv=2.3
[02-01 09:47:07 ty D][mqtt_service.c:396] password:8346f0e4d2e9d2e4
[02-01 09:47:07 ty I][mqtt_service.c:397] topic_in:d/ai/uuidxxxxxxxxxxxxxxxx
[02-01 09:47:07 ty I][mqtt_service.c:398] topic_out:
[02-01 09:47:07 ty I][mqtt_service.c:399] tuya_mqtt_start...
[02-01 09:47:07 ty D][tcp_transporter.c:77] bind ip:00000000 port:0 ok
q[02-01 09:47:07 ty D][tuya_tls.c:488] TUYA_TLS Begin Connect m2.tuyacn.com:8883
[02-01 09:47:07 ty D][tuya_tls.c:300] mbedtls authmode: MBEDTLS_SSL_VERIFY_REQUIRED
[02-01 09:47:07 ty D][tuya_tls.c:313] load root ca cert.

mqtt connect fail

[01-07 00:52:10 ty E][mqtt_service.c:406] MQTT connect fail:3
[01-07 00:52:10 ty E][mqtt_bind.c:107] tuya mqtt connect fail:-34, retry..

tuya_config.h has been set correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.