Smart Home Control

Last Updated on : 2023-06-20 12:39:04download

Control smart home through intent text.

API address

POST: /v1.0/iot-01/voice/homes/{home_id}/dm

Request parameter

Parameter name Type IN Required Description
text String true The intent text.
lang String false The language. Valid values:
  • zh: Chinese. Default value.
  • en: English.
    session_id String false The session ID. When it is used for multiple sessions, use the first returned session ID.
    request_id String false The unique identifier of the request, generated according to the universal UUID specification. See Get the instruction set by device or Get the instruction set of the device.

    Return parameter

    Parameter name Type Description
    result Object The returned result.
    success Boolean Indicates whether the request succeeded. Valid values: true: succeeded. false: failed.
    t Long The returned 13-bit timestamp.
    code Integer The error code. It is empty on success.
    msg String The error message that is returned if the request fails. It is empty on success.

    Description of result

    Parameter name Type Description
    request_id String The unique identifier of the request.
    session_id String The session ID.
    keep_session String Indicates whether to keep the session alive.
    nlg String The broadcast text.
    nlu Object The result of intent recognition.
    skill Object The result of the skill.

    Request example

    POST: /v1.0/iot-01/voice/homes/31426304/dm
    { "text": "Turn off the light in the living room" }

    Return example

    { "result": { "nlg": "OK, the light in the living room is turned off. To control all the lights, you can say 'Turn off all the lights'.", "session_id": "c3d27d8860b8b282b194fcebb1b3c0cd", "keep_session": false, "request_id": "f854b94194454cc6a5033e653df39bea_1627973468573" }, "t": 1627973470247, "success": true }

    Error code

    For more information, see error code.