getLightRhythmsTimeInfo(data: CommonLonLatParams)

Requires:
@tuya-miniapp/cloud-api≥1.0.5

Description

Get sunrise and sunset times and return them in the device or group's time zone.

Parameters

ParameterTypeRequiredDescription
YesRequest parameters: bizId (business ID), bizType (business type: 0 = device, 1 = group), lon (longitude), lat (latitude).

Return Value

Type: Promise<GetLightRhythmsTimeInfoResult>
TimeInfo[]; fields: date (date, format yyyyMMdd), sunrise (sunrise time), sunset (sunset time), transitAtNoon (noon time), dawn (pre-sunrise time), dusk (post-sunset time)

Referenced Types

typeGetLightRhythmsTimeInfoResult
TimeInfo[]

Valid Values

CommonLonLatParams.bizType
ValueDescriptionSince
0--
1--

Examples

Request example

import { getLightRhythmsTimeInfo } from '@tuya-miniapp/cloud-api';

getLightRhythmsTimeInfo({
  bizId: 'vdevo167504******003',
  bizType: 0,
  lon: '112.233',
  lat: '30.233',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

[
  {
    "date": "20231020",
    "sunrise": "22:35",
    "dusk": "10:25",
    "transitAtNoon": "04:15",
    "sunset": "09:55",
    "dawn": "22:05"
  }
]

FAQ

Why does the biological rhythm cloud capability call fail?

Biological rhythm must have advanced capabilities enabled on the Tuya Developer Platform product feature definition page. Otherwise cloud capability calls will fail.