---
name: "getWeathers"
mode: "api"
versionRequirements:
  - { name: "@ray-js/ray", version: "1.5.2" }
title: "getWeathers - Get Weather Forecast"
---

## getWeathers

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

### Description

Get weather forecast information

### Parameters

`Params`

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

### Return Value

Type: `Promise<IGetWeathersResponse>`

Weather forecast information, including city info and multi-day weather data (temperature, humidity, wind direction, wind speed, sunrise/sunset times, etc.)

##### IGetWeathersResponse

| Property | Type | Description |
| --- | --- | --- |
| `c` | `Object[]` | City information |
| `weathers` | `Object[]` | Weather forecast data |

##### IGetWeathersResponse.c[] properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `string` | Yes | - | City name |
| `id` | `number` | Yes | - | City ID |


##### IGetWeathersResponse.weathers[] properties

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `temp` | `number` | Yes | - | Wind direction |
| `thigh` | `number` | Yes | - | Sunset text |
| `pressure` | `number` | Yes | - | Summary |
| `condition` | `string` | Yes | - | Feels-like temperature |
| `tlow` | `number` | Yes | - | Nitrogen dioxide |
| `pop` | `number` | Yes | - | Probability of precipitation (%) |
| `qpf` | `number` | Yes | - | Precipitation (mm) |
| `condIconUrl` | `string` | Yes | - | Sunset timestamp |
| `humidity` | `number` | Yes | - | Humidity |
| `conditionNum` | `string` | Yes | - | Weather text code |
| `windSpeed` | `string` | Yes | - | Wind speed, m/s worldwide |
| `windDir` | `string` | Yes | - | Wind direction |
| `windLevel` | `number` | Yes | - | Wind speed level |
| `zoneId` | `string` | Yes | - | Time zone |
| `sunRise` | `string` | Yes | - | Sunrise time text |
| `sunSet` | `string` | Yes | - | Sunset time text |
| `sunSetTimestamp` | `number` | Yes | - | Sunset timestamp |
| `sunRiseTimestamp` | `number` | Yes | - | Sunrise timestamp |


### Referenced Types

##### `interface` IGetWeathers

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |
| `dataRange` | `number` | Number of forecast days (default 7, maximum 7) |


### Examples

#### Basic usage

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

getWeathers({
  devId: 'vdevo169477319679442',
  dataRange: 7,
}).then((res) => {
  console.log('Weather forecast:', res);
}).catch((error) => {
  console.error(error);
});
```
