Developer Guide for iOS

Last Updated on : 2022-03-03 06:40:21

Tuya Smart Residence App SDK for iOS provides useful features such as account role management, site management, access control, device pairing, and device control, and forms the backbone of Tuya’s smart residence SaaS development framework.

The SDK accelerates your implementation of smart residence scenarios targeted to end users. The rental property management background integrates with a variety of smart devices such as smart locks, smart cameras, sensors, and thermostats to empower your smart apartment and rental scenarios.

Feature overview

Module Feature
Account roles Register and log in to accounts and manage permissions and roles
Site management Manage and use private or authorized sites
Access control Authorize access permissions and access passwords
Device management Install, manage, and use smart devices
Smart scenes Create, manage, and use smart scenes

Account roles

The Smart Residence App SDK supports login with a verification code that is sent to a user’s email address. Users can be assigned the following types of roles:

  • Owner: the owner with full permissions on assets, including sites and devices.
  • Administrator: a member who is granted most permissions on specific assets, including sites and devices.
  • Member: a common member who is only authorized to use assets such as devices but cannot manage assets.

Their permission levels are sorted in the following descending order: owner > administrator > member.

Site management

Smart Residence App SDK is designed to provide a variety of modules and components for mobile app development in smart apartment rental scenarios. In light of this purpose, the philosophy of sites is abstracted away from smart home scenarios. Each home or site encompasses a collection of devices, accounts, permissions, and other resources that are managed by app users.

Site management supports the following capabilities:

  • Query a list of sites
  • Add, modify, and remove a site.
  • Manage site information such as site names, location details, rooms, and members.
  • Manage resources for sites. For example, add devices, modify site information, listen for device status changes, and remove listeners.

Access control

The following access control methods are supported:

  • Access control with passwords

    The password of an access control device such as a smart lock can be sent to a specific email address. The user of the email address can use this password to unlock the door. Currently, only online passwords can be sent.

  • Access control for app users

    A specified user can be granted access permissions for a long time. The member allowed for access can only use the target access control device.

Device management

Pair, manage, and control devices.

  • Device pairing

    Tuya Smart Residence App SDK empowers smart devices to be paired through routers or gateways. The typical pairing mode is Wi-Fi Easy Connect (EZ). In this mode, the SDK gets the pairing token from the cloud and enables the app to broadcast the pairing information. The router ID, password, and pairing token are published. Then, the smart device receives the pairing information and starts the activation process. The activated device is connected to both the app and the cloud. Now, you have kicked off your journey with smart control in the cloud.

  • Device management

    The SDK supports operations to manage devices. For example, listen for changes in device status, rename devices, update device firmware, remove devices, and restore default settings.

  • Device control

    Smart devices have gained ground in many sites and industries, but how to deliver secure and flexible permission management has become a challenge. In the old days, application scenarios are pretty simple, and a mobile app was used to control only one smart device. However, nowadays, more and more IoT devices are serving smart scenes. Each mobile app is used to control a host of smart devices.

    In specific scenarios, certain devices are controlled by multiple users. For example, furniture-like smart power strips can be switched on or off by all site members. In this case, the following requirements must be met: a mobile app can be used to control multiple devices. Multiple users can be authorized to mutually control multiple devices. Therefore, group management and smart scenes are designed to achieve these purposes.