Smart Apartment Practice

Last Updated on : 2024-06-19 03:13:47download

Purpose

Smart home open service is a comprehensive open system that applies to both end users and servers in the smart home scenarios. This topic describes how to use the smart home open service. In the following example, a smart apartment project is created.

For example, on an apartment management platform, you can manage smart devices such as smart electricity meters and smoke detectors in the apartment. Moreover, you can pull the tenants’ monthly electricity bills, and use smoke detectors to timely discover any fire hazards.

Smart Apartment Practice

Procedure

A cloud project can be linked with devices in multiple ways. This section describes how to create a cloud project, link the project with an OEM app, and then develop a smart apartment management platform. Perform the following steps:

Smart Apartment Practice

Create a project

Create a cloud project named Smart Apartment Project.

For more information about how to create a project, see Quick Start for Smart Home.

Link with an OEM app

  1. Log in to the Cloud Development of Tuya Developer Platform.

  2. In the left-side navigation bar, choose Cloud > Development. Create a project or click an existing project to enter the details page, and choose Devices > Link My App > Add Apps.

    Smart Apartment Practice

  3. Select your app to link it with the project.

    The following figure shows the linking result.

    Smart Apartment Practice

Develop more services

Electricity bill prompt

At the beginning of each month, the apartment management platform can be used to automatically pull the electricity consumption of each apartment for the previous month, generate a bill, and push it to the tenants. You can pull the electricity consumption by using OpenAPI.

  1. Pull the main accounts of all tenants under the app.

    Smart Apartment Practice

    As shown above, the apartment currently has three main accounts. The account name and account ID are as follows:

    • 03f33010011: ay1661***4Eg3
    • 03f33020011: ay1661***K4bc
    • 03f33030011: ay1661***n3yx
  2. Pull the devices under each main account. The product type is smart electricity meter.

    Smart Apartment Practice

    There is a smart electricity meter device under the account ay1661***4Eg3. The property with code energy_month in its status represents the electricity consumption for a certain month. The example shows that 82.39 kWh electricity was used from July 2022 to August 2022.

    For the monthly electricity consumption function of smart electricity meters, see energy_month.

  3. Going through the above operations, you can also query devices whose product type is smart electricity meter under the app. The uid of each device is the main account of each apartment.

    Smart Apartment Practice

  4. Push the data to tenants. You can develop this custom function as needed. For example, send SMS notifications or make phone calls.

Fire alarm

The apartment management platform monitors the smoke detectors of each apartment in real time. If an alarm occurs, the administrator and tenants will be notified in time, or an alarm will be triggered automatically.

  1. Listen for messages.

    Smart Apartment Practice

  2. Notify the administrator and tenants. You can develop this custom function as needed. For example, make phone calls to alert the administrator and tenants, call the police, and beyond.

    You can use the above OpenAPI calls and message listening in your own services by programming. For more information, see API Reference and Message Queue.