IR device management

Currently, the devices that support infrared function are: Air Condition Controller P3, M2 Hub.

Query infrared device type list

  • API intent: query.ir.categories
  • Description: This interface is used to query the types of infrared devices currently supported, such as TVs, air conditioners, etc.
  • Request parameters: NA
  • Request Demo
{
  "intent": "query.ir.categories",
  "data": {}
}
  • Response parameters
Name Type Description
categoryId Integer Infrared device type id
enName String Device type English name
iconId String Icon id
name String Device type Chinese name
model String Device model
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": [
    {
      "iconId": "device_ir_stb",
      "enName": "STB",
      "name": "Set-top Box",
      "model": "virtual.ir.stb",
      "categoryId": 1
    },
    {
      "iconId": "device_ir_tv",
      "enName": "TV",
      "name": "TV",
      "model": "virtual.ir.tv",
      "categoryId": 2
    },
    {
      "iconId": "device_ir_box",
      "enName": "BOX",
      "name": "TV box",
      "model": "virtual.ir.box",
      "categoryId": 3
    }
  ]
}

Query brand list based on device type

  • API intent: query.ir.brands
  • Description: This interface can query the list of supported brands according to the type of infrared device.
  • Request parameters
Name Type Is required? Description
categoryId Integer Yes Infrared device type id
  • Request Demo
{
  "intent": "query.ir.brands",
  "data": {
    "categoryId": 1
  }
}
  • Response parameters
Name Type Description
brandId int Brand id
enName String Brand English name
pinyin String pinyin
name String Brand Chinese name
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": [
    {
      "iconId": 307,
      "pinyin": "aihua",
      "enName": "Aiwa",
      "name": "Aiwa"
    },
    {
      "iconId": 151,
      "pinyin": "aoguangkeji",
      "enName": "Aoguang",
      "name": "Aoguang"
    },
    {
      "iconId": 452,
      "pinyin": "bubugao",
      "enName": "BBK",
      "name": "BBK"
    }
  ]
}

Query match tree information

  • API intent: query.ir.match
  • Description: This interface can query infrared matching tree information according to the type and brand of infrared devices, including key functions, such as switch, wind speed, etc.
  • Request parameters
Name Type Is required? Description
type Integer Yes 1 Query by category and brand
categoryId Integer Yes Category id (returned by obtaining device Type list)
brandId String Yes Brand id
  • Request Demo
{
  "intent": "query.ir.match",
  "data": {
    "type": 1,
    "categoryId": 8,
    "brandId": 1077
  }
}
  • Response parameters
Name Type Description
category Object Categories to which this matching tree applies
brand Object The brand to which this match tree applies
keys Array(Object) Keys that may be used in the matching tree
nodes Array(Object) Schemes that may be used in the matching tree
version String Version

category description

Name Type Description
id Integer Category id
name String Category name

brand description

Name Type Description
id Integer Brand id
name String Brand Name
enName String Brand English name

keys description

Name Type Description
id Integer Brand id
name String Brand Name
enName String Brand English name
mustMatch Boolean Is it matched

nodes description

Name Type Description
cursor Integer Current scheme cursor
mismatched Integer If it does not match, the next node id to be matched, if it is null, it means the match failed
total Integer Total number of plans
controller_id Integer Remote control id
count Integer Number of remaining plans
matched Integer If it matches, the next node id to be matched. If this field is null, it means the match is successful, and the target remote control id is the controller_id
id Integer Plan id
key Object The key information of the scheme, please refer to the key description for details
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "nodes": [
      {
        "cursor": 1,
        "mismatched": 3,
        "total": 3,
        "controllerId": 4676,
        "count": 2,
        "matched": 2,
        "id": 1,
        "key": {
          "name": "POWER",
          "enName": "POWER",
          "id": 1
        }
      },
      {
        "cursor": 1,
        "mismatched": 3,
        "total": 3,
        "controllerId": 4676,
        "count": 2,
        "id": 2,
        "key": {
          "name": "TIMER",
          "enName": "TIMER",
          "id": 23
        }
      }
    ],
    "keys": [
      {
        "name": "电源",
        "enName": "POWER",
        "mustMatch": true,
        "id": 1
      },
      {
        "name": "风速",
        "enName": "FAN_SPEED",
        "mustMatch": false,
        "id": 9367
      },
      {
        "name": "摆风",
        "enName": "SWING",
        "mustMatch": false,
        "id": 9362
      }
    ],
    "category": {
      "name": "FAN",
      "id": 8
    },
    "brand": {
      "name": "天敏",
      "enName": "10moons",
      "id": 1077
    },
    "version": "20200820"
  }
}

Add remote control

  • API intent: config.ir.create
  • Description: This interface is used to create an infrared remote control.
  • Request parameters
Name Type Is required? Description
parentDId String Yes Gateway id
positionId String No Position id
categoryId Integer Yes categoryId of the remote control, (returned by obtaining the device Type list)
brandId Integer Yes Remote control brand ID, (returned by the brand list obtained by obtaining the device Type)
controllerId Integer Yes Remote control id
name String Yes Remote control Name
  • Request Demo
{
  "intent": "config.ir.create",
  "data": {
    "brandId": 1077,
    "categoryId": 8,
    "name": "name",
    "parentDid": "virtual2.32056709824364",
    "controllerId": 4676
  }
}
  • Response parameters
Name Type Description
did String Remote control device id
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "did": "ir.837355405973868544"
  }
}

Delete remote control

  • API intent: config.ir.delete
  • Description: This interface is used to delete an infrared remote control.
  • Request parameters
Name Type Is required? Description
did String Yes Remote control device id
  • Request Demo
{
  "intent": "config.ir.delete",
  "data": {
    "did": "ir.837355405973868544"
  }
}
  • Response parameters: NA

  • Response demo

{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": ""
}

Update remote control

  • API intent: config.ir.update
  • Description: This interface is used to modify the name of the infrared remote control.
  • Request parameters
Name Type Is required? Description
did String Yes Device ID of the remote control to be updated
name String Yes Device Name of the remote control to be updated
  • Request Demo
{
  "intent": "config.ir.update",
  "data": {
    "did": "ir.837371837843460096",
    "name": "new name"
  }
}
  • Response parameters: NA

  • Response demo

{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": ""
}

Query remote control information

  • API intent: query.ir.info
  • Description: This interface is used to query the detailed information of the infrared remote control, including brand, type, creation time, etc.
  • Request parameters
Name Type Is required? Description
did String Yes Device ID of the remote control to be updated
  • Request parameters
{
  "intent": "query.ir.info",
  "data": {
    "did": "ir.837371837843460096"
  }
}
  • Response parameters
Name Type Description
did String Device ID of the remote control
controllerId int Remote control id
categoryId int Remote control type
brandId int Remote control brand id
brandName String Brand Name
type int Air conditioner only (0 and 1 means stateless air conditioner, 2 means stateful air conditioner)
createTime long Remote control creation time, time stamp
updateTime long Remote control update time, time stamp
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "brandName": "10moons",
    "lineupId": "",
    "controllerId": 4676,
    "createTime": 1619686475286,
    "brandId": 1077,
    "updateTime": 1619686475286,
    "type": 1,
    "did": "ir.837371837843460096",
    "categoryId": 8
  }
}

Query the remote control list under the gateway

  • API intent: query.ir.list
  • Description: This interface is used to query the infrared remote control list under the specified gateway device.
  • Request parameters
Name Type Is required? Description
did String Yes Gateway ID
  • Request parameters
{
  "intent": "query.ir.list",
  "data": {
    "parentDid": "virtual2.32056709824364"
  }
}
  • Response parameters
Name Type Description
did String Device id
state Integer Device status (1 online, 0 offline)
positionId String Position id
parentDid String Parent device id
deviceName String Device Name
model String Device model
type int 0 and 1 mean stateless air conditioning, 2 means stateful air conditioning
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": [
    {
      "parentDid": "virtual2.32056709824364",
      "positionId": "real1.829743976676106240",
      "model": "virtual.ir.fan",
      "state": 1,
      "type": 1,
      "deviceName": "new name",
      "did": "ir.837371837843460096"
    }
  ]
}

Click the remote control button

  • API intent: write.ir.click
  • Description: This interface is used to control the keys of the remote control.
  • Request parameters
Name Type Is required? Description
did String Yes Device ID (when there is no device id of the remote control, it will be passed into the gateway did)
brandId Integer No Brand id (required when the air conditioner is matched)
controllerId String No Remote control id (this field is required when there is no remote control device id)
keyId String No Infrared Key (this field is used for non-air conditioners and stateless air conditioners)
isAcMatch String No Air condition controller is required, 0-matched; 1-matching
acKey String No Air conditioner key (required for stateful air conditioner, keyId field for stateless air conditioner), state air conditioner incoming rule: Turn on air conditioner: P0; Turn off air conditioning: P1; Air conditioning status: Mm_Ty_Ss; m indicates mode (0: cooling, 1: heating, 2: automatic, 3: wind, 4: dry); y indicates temperature (temperature range is 16~30); *s indicates wind speed (0: automatic, 1: low, 2: middle, 3: high); For example, if the air conditioning state is controlled to be refrigeration, 18 degrees, and the amount of high air is passed, M0_T18_S3 is transmitted.
  • Request Demo
{
  "intent": "write.ir.click",
  "data": {
    "did": "ir.837371837843460096",
    "brandId": 1077,
    "controllerId": 4676,
    "keyId": "1"
  }
}
  • Response parameters: NA

  • Response demo

{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {}
}

Query the state of the stateful air conditioner

  • API intent: query.ir.acState
  • Description: This interface is used to query the detailed information of the stateful air conditioner, such as temperature, mode, wind speed, etc.
  • Request parameters
Name Type Is required? Description
did String Yes Device id
  • Request Demo
{
  "intent": "query.ir.acState",
  "data": {
    "did": "ir.837392177046114304"
  }
}
  • Response parameters:
Name Type Description
acState String Air conditioning status Px_Mm_Ty_Ss_Dd x means switch (AC_POWER_ON = 0, AC_POWER_OFF = 1) m means mode (0: cooling, 1: heating, 2: automatic, 3: air supply, 4: dehumidification) y means temperature (temperature range) Generally 16~30) s means wind speed (0: automatic, 1: low, 2: medium, 3: high) * d means wind direction (0: sweep wind, other values mean fixed wind direction) (for example: P0_M0_T26_S0_D0 )
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "acState": "P1_M0_T26_S0"
  }
}

Query remote control function

  • API intent: query.ir.functions
  • Description: This interface is used to query the list of functions supported by the remote control.
  • Request parameters
Name Type Is required? Description
did String No Device ID
controllerId Integer No Remote control id

Note: At least one of the did and controllerId parameters must be filled in.

  • Request demo
{
  "intent": "query.ir.functions",
  "data": {
    "did": "ir.837392177046114304"
  }
}
  • Response parameters:
Name Type Description
modes Array(Objects) Mode array, see modes description for details
type Int 1: Stateless air conditioning; 2: Stateful air conditioning

models description

Name Type Description
mode Int Air conditioning mode (0 cooling, 1 heating, 2 automatic, 3 air supply, 4 dehumidification)
temps Array(int) The temperature range is 16~30.
speeds Array(int) 0: automatic, 1: low, 2: middle, 3: high
directs Array(int) Fixed wind direction, cyclically switched during control (only value is available when fixed wind direction is supported)
type (parameters in models) Int 0 No wind direction function 1 Only supports fixed wind direction 2 Supports fixed wind direction and sweeping wind
light Array(int) Light control: 0 turn off the light, 1 turn on the light
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "modes": [
      {
        "mode": 2,
        "speeds": [],
        "directs": [
          1
        ],
        "type": 2,
        "temps": [
          17,
          18,
          19
        ]
      },
      {
        "mode": 3,
        "speeds": [
          0,
          1,
          2,
          3
        ],
        "directs": [
          1
        ],
        "type": 2,
        "temps": []
      }
    ],
    "type": 2
  }
}

Query remote control buttons (only query stateless remote control)

  • API intent: query.ir.keys
  • Description: This interface is used to query the key information of the stateless remote control, such as temperature, mode, wind speed, etc.
  • Request parameters
Name Type Is required? Description
did String No Device id
  • Request Demo
{
  "intent": "query.ir.keys",
  "data": {
    "did": "ir.837371837843460096"
  }
}
  • Response parameters:
Name Type Description
keys string Array of remote control keys. See the keys description for details
type Integer Remote control type

keys description

Name Type Description
keyName string Remote control key Name
controllerId Integer Remote control id
irKeyId string Locate the id of the unique infrared code
keyId string Remote control button id
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "keys": [
      {
        "controllerId": 4676,
        "irKeyId": "ir.837371837843460096,1",
        "keyName": "POWER",
        "keyId": "1"
      },
      {
        "controllerId": 4676,
        "irKeyId": "ir.837371837843460096,23",
        "keyName": "TIMER",
        "keyId": "23"
      },
      {
        "controllerId": 4676,
        "irKeyId": "ir.837371837843460096,9362",
        "keyName": "SWING",
        "keyId": "9362"
      },
      {
        "controllerId": 4676,
        "irKeyId": "ir.837371837843460096,9367",
        "keyName": "FAN_SPEED",
        "keyId": "9367"
      },
      {
        "controllerId": 4676,
        "irKeyId": "ir.837371837843460096,9372",
        "keyName": "SWING_MODE",
        "keyId": "9372"
      }
    ],
    "type": 1
  }
}

Start infrared learning

  • API intent: write.ir.startLearn
  • Description: This interface is used to enable the infrared learning function of the Hub device.
  • Request parameters
Name Type Is required? Description
did String Yes Gateway device ID
timeLength Int No Time to stay in learning, default is 30 seconds. The maximum is 30.
  • Request Demo
{
  "intent": "write.ir.startLearn",
  "data": {
    "did": "ir.837371837843460096",
    "timeLength": 20
  }
}
  • Response parameters
Name Type Description
keyId string Learning infrared id
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "keyId": "key01837419477205471232"
  }
}

Cancel infrared learning

  • API intent: write.ir.cancelLearn
  • Description: This interface is used to turn off the infrared learning function of the Hub device.
  • Request parameters
Name Type Is required? Description
did String Yes Gateway device ID
keyId String No Learning infrared id
  • Request Demo
{
  "intent": "write.ir.cancelLearn",
  "data": {
    "did": "ir.837371837843460096",
    "keyId": "key01837419477205471232"
  }
}
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": ""
}

Query infrared learning results

  • API intent: query.ir.learnResult
  • Description: This interface is used to query the infrared learning result of the Hub device.
  • Request parameters
Name Type Is required? Description
did String Yes Gateway device ID
keyId String No Learning infrared id
  • Request Demo
{
  "intent": "query.ir.learnResult",
  "data": {
    "did": "ir.837371837843460096",
    "keyId": "key01837419477205471232"
  }
}
  • Response parameters
Name Type Description
did string Gateway device ID
keyId String Learning infrared id
ircode String Infrared code
freq String Frequency
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {}
}

Add a custom remote control

  • API intent: config.ir.custom
  • Description: When the type of infrared device does not meet the requirements, a custom remote control can be added through this interface.
  • Request parameters
Name Type Is required? Description
parentDId String Yes Gateway device ID
name String Yes Remote name
positionId String No Position id, empty to take the default position
irCodeInfos List Yes Infrared code button key information

irCodeInfos description

Name Type Is required? Description
keyName String Yes Key name
keyId String Yes Key id
ircode String Yes Infrared code value
freq String No Frequency
  • Request Demo
{
  "intent": "config.ir.custom",
  "data": {
    "parentDid": "virtual2.32056709824364",
    "name": "test remote",
    "irCodeInfos": [
      {
        "keyId": "1",
        "keyName": "电源开关",
        "ircode": "1"
      }
    ]
  }
}
  • Response parameters
Name Type Description
did string Remote control device id
  • Response demo
{
  "code": 0,
  "message": "Success",
  "msgDetails": "",
  "requestId": "",
  "result": {
    "did": "ir.837426350893780992"
  }
}
Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-04-24 15:18:24

results matching ""

    No results matching ""