Skip to main content
Version: v2

Weather

warning

This interface has been deprecated, please refer to https://github.com/orgs/zepp-health/discussions/83

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Weather Forecasts sensor.

Methods

getForecastWeather

Get weather forecast data

getForecastWeather(): ForecastWeather

ForecastWeather

PropertyTypeDescriptionAPI_LEVEL
cityNamestringCity Name2.0
forecastDataForecastDataWeather Information2.0
tideDataTideDataTide Information2.0

ForecastData

PropertyTypeDescriptionAPI_LEVEL
dataArray<ForecastDataItem>Weather Information Array, index 0 position represents the day2.0
countnumberThe length of Weather Information Array2.0

ForecastDataItem

PropertyTypeDescriptionAPI_LEVEL
highnumberMaximum temperature2.0
lownumberLowest temperature2.0
indexnumberThe index value of the weather, see index below for a description of the value2.0

index

ValueTypeDescriptionAPI_LEVEL
0numberCloudy2.0
1numberShowers2.0
2numberSnow Showers2.0
3numberSunny2.0
4numberOvercast2.0
5numberLight Rain2.0
6numberLight Snow2.0
7numberModerate Rain2.0
8numberModerate Snow2.0
9numberHeavy Snow2.0
10numberHeavy Rain2.0
11numberSandstorm2.0
12numberRain and Snow2.0
13numberFog2.0
14numberHazy2.0
15numberT-Storms2.0
16numberSnowstorm2.0
17numberFloating dust2.0
18numberVery Heavy Rainstorm2.0
19numberRain and Hail2.0
20numberT-Storms and Hail2.0
21numberHeavy Rainstorm2.0
22numberDust2.0
23numberHeavy sand storm2.0
24numberRainstorm2.0
25numberUnknown2.0
26numberCloudy Nighttime2.0
27numberShowers Nighttime2.0
28numberSunny Nighttime2.0

TideData

PropertyTypeDescriptionAPI_LEVEL
dataArray<TideDataItem>Tide Information Array, index 0 position represents the day2.0
countnumberThe length of Tide Information Array2.0

TideDataItem

PropertyTypeDescriptionAPI_LEVEL
sunriseSunriseSunrise time2.0
sunsetSunsetSunset time2.0

Sunrise

PropertyTypeDescriptionAPI_LEVEL
hournumberSunrise time - hour2.0
minutenumberSunrise time - minute2.0

Sunset

PropertyTypeDescriptionAPI_LEVEL
hournumberSunrise time - hour2.0
minutenumberSunrise time - minute2.0

Example

import { Weather } from '@zos/sensor'

const weather = new Weather()
const { forecastData, tideData, cityName } = weather.getForecast()

console.log(cityName)

for (let i = 0; i < forecastData.count; i++) {
const element = forecastData.data[i]
console.log('Index' + element.index)
console.log('Highest temperature' + element.high)
console.log('Lowest temperature' + element.low)
}

for (let i = 0; i < tideData.count; i++) {
const element = tideData.data[i]
console.log('Sunrise' + element.sunrise.hour + element.sunrise.minute)
console.log('Sunset' + element.sunset.hour + element.sunset.minute)
}