Device Initialization

Last Updated on : 2024-01-19 09:21:46download

After a device is powered on and started, it calls a range of APIs to initialize the hardware environment, TuyaOS software, and applications.

Device types

Router: A device that acts as a relay node in a network, forwarding packets for other nodes. Its wireless receiver is always on, allowing for message transmission in the network at any time. Router devices are typically mains powered, such as light bulbs, sockets, and wall switches.

End device: A device that communicates with a single router, without forwarding packets for other nodes. It can power off its transceiver to save energy. End devices are usually low-power, such as battery-powered temperature and humidity sensors.

The end device is mostly in sleep mode and does not relay messages in the network. In sleep mode, the wireless receiver is turned off. The end device wakes up only at specific times, such as scheduled wake-ups or when the user initiates it. It establishes a parent-child relationship with a router. The router caches messages sent to its child end device, which will be requested when the child device wakes up.

Data model

Device Initialization
Term
Description
Fabric A fabric refers to a Matter network that is composed of one or more Matter devices.
Node A node represents a physical Matter device.
Endpoint A Matter device can have one or more endpoints, with endpoint 0 dedicated to node management. The TuyaOS SDK automatically initializes endpoint 0, so you do not need to handle its initialization in your application development.
Cluster A cluster is a collection of a specific feature. Each cluster consists of three parts: attribute, command, and event. However, not every cluster must include all three parts.
Attribute An attribute reflects the read/write states, configurations, and capabilities of the device.
Command The command exchanged between a client and a server.
Event An event represents a record of an activity that has occurred. An event can be seen as a log entry, and the event stream offers a chronological perspective of state changes on nodes.

Features

Initialize the data model, device type, device basic information, network parameters, attribute callbacks, network event callbacks, and hardware configurations. For more information, see Demo Introduction and TuyaOS Thread Sub-Device Initialization Process.

Support and help

If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.