---
name: "updateAstronomical"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "updateAstronomical - Update Astronomical Timer"
---

## updateAstronomical

> [VERSION] @ray-js/ray >= 1.5.2

### Description

Update astronomical timer

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `IAstronomical` | Yes | Request parameters |

### Return Value

Type: `Promise<boolean>`

Whether the astronomical timer was updated successfully

### Referenced Types

##### `interface` IAstronomical

| Property | Type | Description |
| --- | --- | --- |
| `id` | `number` | Schedule ID |
| `bizId` | `string` | Device or group ID |
| `bizType` | `number` | Resource type. 0: single device. 1: group device. |
| `loops` | `string` | Weekly cycle |
| `dps` | `string` | DP value |
| `astronomicalType` | `number` | Sunrise/sunset type |
| `timezone` | `string` | Time zone |
| `date` | `string` | Scheduled date yyyyMMdd |
| `time` | `string` | Scheduled time |
| `offsetType` | `number` | Schedule offset type |
| `lat` | `number` | Longitude |
| `lon` | `number` | Latitude |


### Examples

#### Basic usage

```ts
import { updateAstronomical } from '@ray-js/ray';

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('Update result:', response);
}).catch((err) => {
  console.error(err);
});
```
