Developer Foundational APIs

Technical Support
Technical Support
  • Updated

The U home foundational API reference contains the definitions for all skill interfaces. These APIs include general directives, response events, discovery, state reporting, change reporting, and error reporting.

 

Uhome.Configure

SET

This interface is primarily used to register URIs for U Home related event notifications, such as device change notifications and event reports.

//Request Example

{
   "header": {

        "namespace": "Uhome.Configure",

        "name": "Set",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },

    "payload": {

        "configure": {

            "notification": {

                "access_token": "xxxxx-xxxxx-xxxxx-xxxxx",

                "url": "https://xxxxxxxxx"
           }

        }

    }

}

acces_token: When sending push notifications, essential valid authentication information is required. It is recommended that users periodically update this value to ensure connection security. For detailed usage instructions, refer to the Event Notification documentation.

URL: The registered notification URI address supports only http:// and https:// protocols. When using https://, the SSL/TLS certificate must be obtained from a trusted Certificate Authority (CA).

 

Uhome.User

GET

Retrieve the basic information of the current user.

//Request Example

{

    "header": {

        "namespace": "Uhome.User",

        "name": "Get",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },

    "payload": {},
}

//Response

{

    "header": {

        "namespace": "Uhome.User",

        "name": "Get",

        "messageId": "Matches the one in the request header."

        "payloadVersion": "1"

    },

    "payload": {

        "user": {

            "id": "abc-ddd-eee-ff",

            "lastName": "Lastname",

            "FirstName": "Firstname"

        }

    }

}

Logout 

Log out the current user.

//Request Example

{
   "header": {

        "namespace": "Uhome.User",

        "name": "Logout",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },

    "payload": {},

}

Uhome.Device

DISCOVERY

The Discovery interface describes the message used to identify the endpoints associated with a customer device account. You can issue this command and U home OpenApi will respond with a list of all supported devices and their associated properties and capabilities.

//Request Example

{
   "header": {

        "namespace": "Uhome.Device",

        "name": "Discovery",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },
   "payload": {}

}

//Reponse

{
   "header": {

        "namespace": "Uhome.Device",

        "name": "Discovery",

        "messageId": "Matches the one in the request header."

        "payloadVersion": "1"
   },

    "payload": {

        "devices": [

            {
               "id": "Unique ID of the endpoint",

                "name": "Sample Lock",

                "category": "LOCK",

                "handleType": "utec-lock",

                "deviceInfo": {

                    "manufacturer": "U-tec",

                    "model": "U-Bolt-Pro-WiFi",

                    "hwVersion": "03.40.0023"

                },

                "customData": {

                    "userId": 123,

                    "otherData": "abc"

                }

            },

            {
               "id": "Unique ID of the endpoint",

                "name": "Sample Light",

                "type": "LIGHT",

                "handleType": "utec-bulb-color-rgbw",

                "deviceInfo": {

                    "manufacturer": "U-tec",

                    "model": "A19-C1",

                    "hwVersion": "03.40.0023"

                },

                "attributes": {

                     "colorModel": "RGB",

                     "colorTemperatureRange": {

                         "min": 2000,

                         "max": 9000,

                         "step": 1

                     }   

                }

            }

        ]

    }

}

Device Parameter Description Example

Attribute Name Data type Description
id String The unique ID of the device (currently the device's BLE MAC address or serial number, which is encrypted once more for privacy compliance).
name String Device Name
category StringEnum) Predefined Device Types
handleType StringEnum) Predefined Set of Device Functions
deviceInfo Object Device Basic Information
manufacturer String Device Manufacturer
model String Device Model
hwVersion String Firmware Version
attributes Object Configuration of parameters defined by `handleType`.
colorModel String Color configuration types (e.g., RGB, HSL), to be defined.

colorTemperatureRange

Object Color Temperature Configuration
min Integer Supported Minimum Color Temperature Value
max Integer Supported Maximum Color Temperature Value
step Integer Supported Color Temperature Adjustment Steps
......   Subsequently, parameters will be gradually added based on supported devices.
customData Object Custom return data must be included with each device operation request to customer service. This can be used for purposes such as door unlock verification.

 

QUERY

Through this interface, you can query the real-time status information of U Home devices.

//Request Example

{
   "header": {

        "namespace": "Uhome.Device",

        "name": "Query",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },

    "payload": {

        "devices": [

            {
               "id": "Device ID from discovery list",

                "customData": {

                    "userId": 123,

                    "otherData": "abc"

                }

            },

            {

                "id": "Device ID from discovery list"

            }

        ]

    }

}


//Response

{

    "header": {

        "namespace": "Uhome.Device",

        "name": "Query",

        "messageId": "Matches the one in the request header."

        "payloadVersion": "1"

    },

    "payload": {

        "devices": [

            {

                "id": "Unique ID of the endpoint",

                "states": [

                    {

                        "capability": "st.healthCheck",

                        "name": "status",

                        "value": "online"

                    },

                    {

                        "capability": "st.Lock",

                        "name": "lockState",

                        "value": "locked"

                    },

                    {

                        "capability": "st.BatteryLevel",

                        "name": "level",

                        "value": 2

                    }

                ]

            }

        ]

    }

}

COMMAND

Handle the Command request by triggering the commands for the list of devices.

//Request Example

{

    "header": {

        "namespace": "Uhome.Device",

        "name": "Command",

        "messageId": "Unique identifier, preferably a version 4 UUID",

        "playloadVersion": "1"

    },

    "payload": {

        "devices": [

            {

                "id": "Device ID from discovery list",

                "customData": {

                    "userId": 123,

                    "otherData": "abc"

                },

                "command": {

                    "capability": "st.switch",

                    "name": "setLevel",

                    "arguments": {

                        "level": 100

                    }

                }

            }

        ]

    }

}

//Reponse

{

    "header": {

        "namespace": "Uhome.Device",

        "name": "Command",

        "messageId": "Matches the one in the request header."

        "payloadVersion": "1"

    },

    "payload": {

        "devices": [

            {

                "id": "Unique ID of the endpoint",

                "states": [

                    {

                        "capability": "st.deferredResponse",

                        "name": "seconds",

                        "value": 10

                    }

                ]

            }

        ]

    }

}

 

 

 

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.