云端定时

更新时间:2023-10-12 08:00:24下载pdf

本文介绍了当前设备的所有定时操作。

使用 commonApi 需先安装依赖,单击此处 安装依赖。

普通定时

创建单次时间的定时任务,例如 Wi-Fi 插座。

添加定时任务的上限是 30 条。在查询定时任务时,2 秒内不能重复操作,否则接口会返回报错信息:Repeat Operation

添加单次定时

名称

addSingleTimer

描述

添加单次定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType String 资源类型。0:单设备。1:群组设备。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
category String 分类类别。
status Integer 初始化状态,0:关闭。1:开启。
actions String 在某个时间 dp 点需要执行的状态或者事件。
isAppPush Boolean 是否发送执行通知。
aliasName String 定时备注。

返回参数

参数 数据类型 说明
response Number 添加的定时 ID

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.addSingleTimer({
  bizId: 'vdevo158944348402685', // 根据 getDevInfo 判断是否存在 groupId。如果存在,则为群组设备。否则为单设备
  bizType: '0',
  loops: '0000000',
  category: 'category', // 分类类别可自行定义,需要与查询定时列表的 category 保持一致
  status: 1, // 当前定时状态是否开启
  actions: '{"dps":{"1":true,"2":false},"time":"17:40"}', // 用户设置的在某个时间 dp 点需要执行的状态或者事件。
  isAppPush: true,
  aliasName: 'xxxxxx',
})
  .then(response => {
    console.log(response);
    console.log(JSON.stringify(response));
  }).catch();
}

返回示例

10029007

查询定时任务

名称

queryTimerTasks

描述

查询定时任务。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
category String 定时分类。

返回参数

参数
数据类型
说明
categoryStatus Number 定时分类状态。
id String 定时任务 ID。
category String 定时分类。
timers Timers[] 见 Timers。

Timers

参数
数据类型
说明
status Number 初始化状态,0:关闭。1:开启。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
time String 定时时间。
id Number 定时任务主键。
isAppPush Boolean 是否发送执行通知。
dps String DP 值。
groupOrder Number 分组定时排序。
groupId String 分组定时 ID。
aliasName String 分组定时定时备注。

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.queryTimerTasks({
  bizId: 'vdevo158944348402685',
  bizType: '0',
  category: 'category',
})
  .then(response => {
    console.log(response);
  }).catch();

返回示例

{
  "categoryStatus": 1,
  "id": "000000d5c3",
  "category": "category",
  "timers": [
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 6281604,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 9442186,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6280599,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000147x1",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6281557,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148nu",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 9441872,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029jin",
      "aliasName": "xxxxxx"
    },
    {
      "status": 1,
      "loops": "0000000",
      "time": "17:40",
      "id": 10123021,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "000002hp0i",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 6281603,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 9442187,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    }
  ]
}

修改单次定时

名称

modifySingleTimer

描述

修改单次定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
id Long 定时任务主键。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
status Integer 初始化状态,0:关闭。1:开启。
actions String 在某个时间 DP 需要执行的状态或者事件。
isAppPush Boolean 是否发送执行通知。
aliasName String 分组定时定时备注。

返回参数

参数 数据类型 说明
response Boolean 是否成功修改单次定时

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.modifySingleTimer({
  bizId: '',
  bizType: '1',
  id: 1,
  loops: '',
  status: 1,
  actions: '',
  isAppPush: true,
  aliasName: '',
})
  .then(response => {
  console.log(response);
}).catch();

返回示例

true

分组定时

分组定时支持创建多个时间的任务,多个任务组合称为分组定时。例如,开始时间和结束时间的定时任务组合。

添加分组定时

名称

addGroupTimer

描述

添加分组定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
category String 分类类别。
status Integer 初始化状态,0:关闭。1:开启。
actionsArray String 在某个时间 DP 需要执行的状态或者事件。
isAppPush Boolean 是否发送执行通知。
aliasName String 定时备注。

返回参数

参数 数据类型 说明
response Number 添加的分组定时 ID

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.addGroupTimer({
  bizId: 'vdevo158944348402685', // 根据 getDevInfo 判断是否存在 groupId。若存在,则为群组设备,否则为单设备
  bizType: '0',
  loops: '0000000',
  category: 'category', // 分类类别可自行定义,需要与查询定时列表的 category 保持一致
  status: 1, // 当前定时状态是否开启
  // 用户设置的在多个时间点、dp 点需要执行的状态或者事件。
  actionsArray:
  '[{"dps":{"1":true,"2":false},"time":"09:40"},{"dps":{"1":true,"2":false},"time":"21:00"}]',
  isAppPush: true,
  aliasName: 'xxxxxx',
})
  .then(response => {
  console.log(response);
}).catch();

返回示例

10029014
10029015

查询分组定时

名称

queryGroupTimerTasks

描述

分组定时查询。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
category String 定时分类。

返回参数

参数 数据类型 说明
categoryStatus Number 定时分类状态。
id String 定时任务 ID。
category String 定时分类。
timers Timers[] 见 Timers。

Timers

参数
数据类型
说明
status Number 初始化状态,0:关闭。1:开启。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
time String 定时时间。
id Number 定时任务主键。
isAppPush Boolean 是否发送执行通知。
dps String DP 值。
groupOrder Number 分组定时排序。
groupId String 分组定时 ID。
aliasName String 分组定时定时备注。

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.queryGroupTimerTasks({
  bizId: 'vdevo158944348402685',
  bizType: '0',
  category: 'category',
})
  .then(response => {
  console.log(response);
}).catch();

返回示例

{
  "categoryStatus": 1,
  "id": "000000d5c3",
  "category": "category",
  "timers": [
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 6281604,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 9442186,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6280599,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000147x1",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6281557,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148nu",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 9441872,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029jin",
      "aliasName": "xxxxxx"
    },
    {
      "status": 1,
      "loops": "0000000",
      "time": "17:40",
      "id": 10123021,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "000002hp0i",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 6281603,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 9442187,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    }
  ]
}

修改分组定时

名称

modifyGroupTimer

描述

修改分组定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
status Integer 初始化状态,0:关闭。1:开启。
actionsArray String 在某个时间 dp 点需要执行的状态或者事件。
isAppPush Boolean 是否发送执行通知。
aliasName String 定时备注。

返回参数

参数 数据类型 说明
response Boolean 是否成功修改单次定时

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.modifyGroupTimer({
  bizId: 'vdevo158944348402685',
  bizType: '0',
  loops: '1111111',
  actionsArray:
  '[{"dps":{"1":true,"2":false},"time":"09:40","timerId":"$VAR:timerIdArray[0]"},{"dps":{"1":true,"2":false},"time":"21:00"},"timerId":"$VAR:timerIdArray[1]"]',
  isAppPush: false,
  aliasName: 'xxxxxx',
}).then((response) => {
    console.log(response);
}).catch();

返回示例

true

公共接口

说明:单独修改定时任务状态时,请使用 公共接口

根据 Ids 修改(删除)定时任务

名称

modDeleteTaskByIds

描述

根据 ids 修改(删除)任务状态。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
ids String 定时任务的 ID。提交多任务时使用逗号(,)分隔。例如"1,2,3,4"。单次提交任务数量不得超过 168。
status Integer 初始化状态,0:关闭。1:开启。2:删除。

返回参数

参数 数据类型 说明
response Boolean 是否成功修改(删除)定时任务

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.modDeleteTaskByIds({
  bizId: 'vdevo158944348402685',
  // 根据 getDevInfo 判断是否存在 groupId。若存在,则为群组设备,否则为单设备
  bizType: '0',
  ids: '1', // 定时任务的 id
  status: 0, // 当前定时状态
}).then((response) => {
    console.log(response);
}).catch();

返回示例

true

根据 Category 修改(删除)定时任务

名称

modDeleteTaskByCategory

描述

根据 category 修改(删除)定时任务状态。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
bizType Integer 资源类型。0:单设备。1:群组设备。
category String 定时分类。
status Integer 初始化状态,0:关闭。1:开启。2:删除。

返回参数

参数 数据类型 说明
response Boolean 是否成功修改(删除)定时任务

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.modDeleteTaskByCategory({
  bizId: "vdevo158944348402685",
  bizType: 0,
  category: "category",
  status: 2
}).then((response) => {
    console.log(response);
}).catch();

返回示例

true

获取某个 DP 点最近的定时

名称

getDpLastTimer

描述

获取某个 DP 点最近的定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
type String device_group 或者 device。
instruct String 定时执行数据。

返回参数

参数 数据类型 说明
time string 定时时间
status number 定时任务状态,0:关闭,1:开启,2:无效/已删除
project number 定制类项目标识
actionStr string 定时动作
groupOrder number 分组定时排序
gmtModified number 修改时间
gmtCreate number 创建时间
uuid string 设备 UUID
runMode number 定时运行模式,0:云端定时,1:本地定时
devId string 设备 ID
id number 定时任务 ID
date string 日期
timeZone string 时区
uid string UID
timezoneId string 时区 ID
bizType bizType[] 资源类型。0:单设备。1:群组设备。
value value[] action 中的 value
groupId string 分组定时 ID
loops string 周循环
timerType number 定时类型,0:普通定时,5:天文定时
categoryId string 定时业务分类,不同业务方使用不同的 categoryId 做区分

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.getDpLastTimer({
  bizId: '',
  type: '',
  instruct: '',
}).then((response) => {
    console.log(response);
}).catch();

返回示例

{
   "time": "12:58",
   "status": 1,
   "project": 0,
   "actionStr": "[{\"instruct\":{\"devId\":\"vdevo155056934890734\",\"dps\":{\"1\":true}},\"type\":\"device\"}]",
   "groupOrder": 0,
   "gmtModified": 1553226629,
   "gmtCreate": 1553226629,
   "uuid": "vdevo155056934890734",
   "runMode": 1,
   "devId": "vdevo155056934890734",
   "id": 2669530,
   "date": "20190322",
   "timeZone": "+08:00",
   "uid": "ay1500284851319yH7ZY",
   "timezoneId": "Asia/Shanghai",
   "bizType": {
     "name": "DEVICE"
   },
   "value": {
     "1": true
   },
   "groupId": "0000006s02",
   "loops": "0000000",
   "timerType": 0,
   "categoryId": "00000027d5"
 }

获取多个 DP 点最近的定时

名称

getDpsLastTimer

描述

获取多个 DP 点最近的定时。

请求参数

参数
数据类型
说明
是否必选
bizId String 单设备 ID(devId) 或者群组设备 ID(groupId)。
type String device_group或者device。
instruct String 定时执行数据。

返回参数

参数 数据类型 说明
time string 定时时间
status number 定时任务状态,0:关闭,1:开启,2:无效/已删除
project number 定制类项目标识
actionStr string 定时动作
groupOrder number 分组定时排序
gmtModified number 修改时间
gmtCreate number 创建时间
uuid string 设备 UUID
runMode number 定时运行模式,0:云端定时,1:本地定时
devId string 设备 ID
id number 定时任务 ID
date string 日期
timeZone string 时区
uid string UID
timezoneId string 时区 ID
bizType bizType[] 资源类型。0:单设备。1:群组设备。
value value[] action 中的 value
groupId string 分组定时 ID
loops string 周循环
timerType number 定时类型,0:普通定时,5:天文定时
categoryId string 定时业务分类,不同业务方使用不同的 categoryId 做区分

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.getDpsLastTimer({
  bizId: '',
  type: '',
  instruct: '',
}).then((response) => {
    console.log(response);
}).catch();

返回示例

{
      "time": "12:58",
      "status": 1,
      "project": 0,
      "actionStr": "[{\"instruct\":{\"devId\":\"vdevo155056934890734\",\"dps\":{\"1\":true}},\"type\":\"device\"}]",
      "groupOrder": 0,
      "gmtModified": 1553226629,
      "gmtCreate": 1553226629,
      "uuid": "vdevo155056934890734",
      "runMode": 1,
      "devId": "vdevo155056934890734",
      "id": 2669530,
      "date": "20190322",
      "timeZone": "+08:00",
      "uid": "ay1500284851319yH7ZY",
      "timezoneId": "Asia/Shanghai",
      "bizType": {
        "name": "DEVICE"
      },
      "value": {
        "1": true
      },
      "groupId": "0000006s02",
      "loops": "0000000",
      "timerType": 0,
      "categoryId": "00000027d5"
}

获取最近的定时

名称

getLastTimerPeriod

描述

获取最近的一条定时(包含时间段判断)。

请求参数

参数 数据类型 说明 是否必填
devId String 设备 ID
instruct String 定时执行数据

返回参数

参数 数据类型 说明
categoryStatus Number 定时分类状态。
id String 定时任务 ID。
category String 定时分类。
timers Timers[] 见 Timers。

Timers

参数
数据类型
说明
status Number 初始化状态,0:关闭。1:开启。
loops String 0000000基础上,把所选择日期对应位置的 0 改成 1,第一位表示周日。
time String 定时时间。
id Number 定时任务主键。
isAppPush Boolean 是否发送执行通知。
dps String DP 值。
groupOrder Number 分组定时排序。
groupId String 分组定时 ID。
aliasName String 分组定时定时备注。

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.getLastTimerPeriod({
  devId: TYSdk.devInfo.devId,
  instruct: '',
})
  .then(response => {
    console.log(response);
  }).catch();

返回示例

{
  "categoryStatus": 1,
  "id": "000000d5c3",
  "category": "category",
  "timers": [
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 6281604,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 9442186,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6280599,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000147x1",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6281557,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148nu",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 9441872,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029jin",
      "aliasName": "xxxxxx"
    },
    {
      "status": 1,
      "loops": "0000000",
      "time": "17:40",
      "id": 10123021,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "000002hp0i",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 6281603,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 9442187,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    }
  ]
}

天文定时

获取天文定时

名称

getAstronomicalList

描述

获取天文定时列表。

请求参数

参数 数据类型 说明 是否必填
bizId String 设备 ID 或群组 ID

返回参数

参数 数据类型 说明
astronomicalType Number 日出日落类型
bizId String 设备或群组 ID
bizType Number 资源类型。0:单设备。1:群组设备。
dps Dps[] DP 值
id Number 定时任务 ID
lat Number 纬度
lon Number 经度
loops String 周循环
nextSunRise String 下一个日出时间
offsetType Number 定时偏移执行类型
status Number 定时任务状态,0 关闭,1 开启,2 无效/已删除
time String 定时时间
timezone String 时区

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.getAstronomicalList({
  bizId: 'vdevo160456552237748',
})
  .then(response => {
  console.log(response);
  console.log(JSON.stringify(response));
}).catch();

返回示例

{
  "categoryStatus": 1,
  "id": "000000d5c3",
  "category": "category",
  "timers": [
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 6281604,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "09:40",
      "id": 9442186,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6280599,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000147x1",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 6281557,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "00000148nu",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "17:40",
      "id": 9441872,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "0000029jin",
      "aliasName": "xxxxxx"
    },
    {
      "status": 1,
      "loops": "0000000",
      "time": "17:40",
      "id": 10123021,
      "isAppPush": true,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 0,
      "groupId": "000002hp0i",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 6281603,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "00000148os",
      "aliasName": "xxxxxx"
    },
    {
      "status": 0,
      "loops": "0000000",
      "time": "21:00",
      "id": 9442187,
      "isAppPush": false,
      "dps": "{\"1\":true,\"2\":false}",
      "groupOrder": 1,
      "groupId": "0000029kfp",
      "aliasName": "xxxxxx"
    }
  ]
}

添加天文定时

名称

addAstronomical

描述

添加天文定时。

请求参数

参数 数据类型 说明 是否必填
bizId String 设备 ID 或群组 ID
bizType Integer 0:设备。1:设备群组
loops String 周期: ‘1111111’
dps String dp 点,json 格式
astronomicalType Integer 天文类型,0:日出。1:日落
timezone String 时区
date String yyyyMMdd
time String 偏移时间,“HH:mm” 24 进制
offsetType Integer 偏移类型,-1:向前。0:正常。1:向后
lon Double 经度
lat Double 纬度

返回参数

参数 数据类型 说明
response Number 新添加天文定时的 ID

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.addAstronomical({
  astronomicalType: 1,
  bizId: 'vdevo160456552237748',
  bizType: 0,
  dps: {
    '1': true,
  },
  lat: 30.300694,
  lon: 120.068634,
  loops: '1111111',
  offsetType: -1,
  time: '00:04',
  timezone: '+08:00',
}).then((response) => {
    console.log(response)
}).catch()

返回示例

10125352

修改天文定时

名称

updateAstronomical

描述

修改天文定时。

请求参数

参数 数据类型 说明 是否必填
id Long 定时任务 ID
bizId String 设备 ID 或群组 ID
bizType Integer 资源类型。0:单设备。1:群组设备。
loops String 周期:‘1111111’
dps String dp 点,json 格式
astronomicalType Integer 天文类型,0:日出。1:日落
timezone String 时区
date String yyyyMMdd
time String 偏移时间,“HH:mm” 24 进制
offsetType Integer 偏移类型,-1:向前。0:正常。1:向后。
lon Double 经度
lat Double 纬度

返回参数

参数 数据类型 说明
response Boolean 是否成功修改天文定时

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi.updateAstronomical({
  id: 8642566,
  astronomicalType: 1,
  bizId: 'vdevo160456552237748',
  bizType: 0,
  dps: {
    '1': true,
  },
  lat: 30.300694,
  lon: 120.068634,
  loops: '1111111',
  offsetType: -1,
  time: '00:04',
  timezone: '+08:00',
})
  .then(response => {
    console.log(response);
  }).catch();

返回示例

 true

是否启用天文定时

名称

updateAstronomicalStatus

描述

是否启用天文定时。

请求参数

参数 数据类型 说明 是否必填
id Long 定时任务 ID
status Integer 0:关闭。1:开启

返回参数

参数 数据类型 说明
response Boolean 是否启用天文定时

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi
  .updateAstronomicalStatus({
    id: '8642566',
    status: 0,
  })
  .then(response => {
    console.log(response);
    console.log(JSON.stringify(response));
  })
  .catch();

返回示例

 true

删除天文定时

名称

removeAstronomical

描述

删除天文定时。

请求参数

参数 数据类型 说明 是否必填
id String 定时任务 ID

返回参数

参数 数据类型 说明
response Boolean 是否成功删除天文定时

请求示例

import { commonApi } from '@tuya/tuya-panel-api';

commonApi.timerApi
  .removeAstronomical({ id: '8642566' })
  .then(response => {
    console.log(response);
    console.log(JSON.stringify(response));
  })
  .catch();

返回示例

 true