-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The FastyBird IoT Tuya Connector is an extension for the FastyBird IoT ecosystem that enables seamless integration with Tuya devices. It allows users to easily connect and control Tuya devices from within the FastyBird IoT ecosystem, providing a simple and user-friendly interface for managing and monitoring your devices.
The connector uses the following naming convention for its entities:
A connector is an entity that manages communication with Tuya devices. It needs to be configured for a specific device interface.
A device is an entity that represents a physical Tuya device.
The Tuya devices transmit information, referred to as "data points" (DPS) or "device function points," in a JSON string format. These DPS attributes determine the state of the device. The keys within the DPS dictionary correspond to key-value pairs, where the key is the DP ID and its value is the dpValue.
To use Tuya devices with the FastyBird IoT ecosystem, you will need to configure at least one connector. The connector can be configured using the FastyBird IoT user interface or through the console.
There are two types of connectors available for selection:
- Local - This connector uses the local network for communication.
- Cloud - This connector communicates with the Tuya cloud instance.
Before using the Tuya connector, you will need to pair your Tuya devices with the Tuya cloud platform and mobile app. Refer to your device's manual for instructions on how to do this.
In order to use the Tuya connector, you will need to obtain certain access credentials. These can be obtained by following these steps:
To get started, go to iot.tuya.com and either create a new account or log in if you already have one. Note that this account is different from the account you use for the Tuya mobile app.
NOTE: Tuya frequently updates their portal and the process for obtaining credentials may change. If you have trouble following these instructions, please create an issue or pull request with screenshots so we can update them.
From side menu select cloud platform:
And now click on "Create Cloud Project" button:
Fill in you new project details a do not forget to select all Data Centers you are using in your Tuya application:
Now you have to authorize basic Tuya services. This services enables OpenApi for you cloud project and this API interface will be used by Tuya connector to get devices details.
On the overview page you could find your Access ID and Access Secret. Note these credentials, you will use them later.
Open Devices tab and then open Link Tuya App Account and click on Add App Account
Scan given QR code with you Tuya application, and follow steps shown in you application. When application authorization is finished, you will see your devices in the Devices list.
To configure the connector through the console, run the following command:
php bin/fb-console fb:tuya-connector:initialize
NOTE: The path to the console command may vary depending on your FastyBird application distribution. For more information, refer to the FastyBird documentation.
The console will ask you to confirm that you want to continue with the configuration.
Tuya connector - initialization
=================================
! [NOTE] This action will create|update connector configuration.
Would you like to continue? (yes/no) [no]:
> y
You will then be prompted to choose an action:
What would you like to do?:
[0] Create new connector configuration
[1] Edit existing connector configuration
[2] Delete existing connector configuration
> 0
If you choose to create a new connector, you will be asked to choose the mode in which the connector will communicate with the devices:
In what mode should this connector communicate with devices? [Local network mode]:
[0] Local network mode
[1] Cloud server mode
> 0
You will then be asked to provide a connector identifier and name:
Provide connector identifier:
> my-tuya
Provide connector name:
> My Tuya
In the following steps, you will need to input your Access ID and Access Secret, which you obtained previously.
Provide cloud authentication Access ID:
> q3ctsrwvcqdprx5kjtm7
Provide cloud authentication Access Secret:
> dc098fa182774e1ca292e76328f8beb6
Provide which cloud data center you are using? [Central Europe]:
[0] Central Europe
[1] Western Europe
[2] Western America
[3] Eastern America
[4] China
[5] India
> 0
After providing the necessary information, your new Tuya connector will be ready for use.
[OK] New connector "My Tuya" was successfully created
You can also configure the Tuya connector using the FastyBird IoT user interface. For more information on how to do this, please refer to the FastyBird IoT documentation.
The Tuya connector includes a built-in feature for automatic device discovery. This feature can be triggered manually through a console command or from the FastyBird IoT user interface.
To manually trigger device discovery, use the following command:
php bin/fb-console fb:tuya-connector:discover
NOTE: The path to the console command may vary depending on your FastyBird application distribution. For more information, refer to the FastyBird documentation.
The console will prompt for confirmation before proceeding with the discovery process.
Tuya connector - discovery
============================
! [NOTE] This action will run connector devices discovery.
Would you like to continue? (yes/no) [no]:
> y
You will then be prompted to select the connector to use for the discovery process.
Would you like to discover devices with "My Tuya" connector (yes/no) [no]:
> y
The connector will then begin searching for new Tuya devices, which may take a few minutes to complete. Once finished, a list of found devices will be displayed.
[INFO] Starting Tuya connector discovery...
[============================] 100% 36 secs/36 secs %
[INFO] Found 2 new devices
+----+--------------------------------------+----------------------------------------+---------------+--------------+
| # | ID | Name | Type | IP address |
+----+--------------------------------------+----------------------------------------+---------------+--------------+
| 1 | eebbc85d-76e0-4597-883d-8a8f93e7cd54 | Filament bulb | N/A | N/A |
| 2 | 366e4c13-34c5-4bfe-ac5c-383157f5bd10 | WiFi 2Gang Dimmer Module | 105b | 10.10.10.130 |
+----+--------------------------------------+----------------------------------------+---------------+--------------+
[OK] Devices discovery was successfully finished
Now that all newly discovered devices have been found, they are available in the FastyBird IoT system and can be utilized.
When using local network mode for device discovery, the connector may not always be able to accurately detect the data types of each device's DPS (data points). In such cases, it may be necessary to manually edit the device's properties and correct their configurations.
Tip
If you find incorrect or missing information, feel free to notify us. You could use the issue tracker or mail or X network for any idea that can improve the project. Thank you for testing, reporting and contributing.
Homepage https://www.fastybird.com and repository https://github.com/fastybird/tuya-connector.