English
English
简体中文
Contact Us
Register
Log In
Language
English
English
简体中文
Contact Us
Log In
Register
Go to main website
App Develop

App Development

Tuya provides multiple mobile app development methods such as no-code or IoT App SDK development to maximize the monetization of IoT apps.
layoutIndex

Get 7-day Weather Forecast

Last Updated on : 2021-08-18 09:45:04download

Get 7-day weather forecasts by latitude and longitude.

API address

GET: /v2.0/iot-03/weather/forecast/daily

Request parameter

Parameter name Type IN Required Description
lat String query true The latitude. Valid values: -90 to 90.
lon String query true The longitude. Valid values: -90 to 90.

Return parameter

Parameter name Type Description
result WeatherForecastDailyResutDTO The result object.

Description of result

Parameter name Type Description
coordinate Coordinate The coordinate object.
data List The weather details array object.

Description of coordinate

Parameter name Type Description
lat String The latitude. Valid values: -90 to 90.
lon String The longitude. Valid values: -90 to 90.

Description of data

Parameter name Type Description
time Long The timestamp of the forecast day.
zone_id String zoneId
condition String Real-time weather.
condition_num Integer The code of the weather value type.
brief_condition String
  • thunderstorm: thunderstorm.
  • drizzle: drizzle.
  • rain: rain.
  • snow: snow.
  • atmosphere: heavy fog.
  • clear: sunny.
  • clouds: clouds.
humidity String The humidity.
pressure String The air pressure.
temp String The temperature, available in the hourly weather forecast and real-time weather.
temp_unit String The temperature unit. Valid values: f indicates degree Fahrenheit, and c indicates degree Celsius.
temperature_min BigDecimal The lowest temperature of the day, available in the daily weather forecast.
temperature_max BigDecimal The highest temperature of the day, available in the daily weather forecast.
real_feel String The apparent temperature.
apparent_temperature_min BigDecimal The lowest apparent temperature of the day, available in the daily weather forecast.
apparent_temperature_max BigDecimal The highest apparent temperature of the day, available in the daily weather forecast.
sunrise_inst Long The sunrise timestamp.
sunset_inst Long The sunset timestamp.
sun_rise String The local sunrise time in the format of yyyy-MM-dd HH:mm.
sun_set String The local sunset time in the format of yyyy-MM-dd HH:mm.
wind_speed String The wind speed.
wind_dir String The wind direction.
uvi String The ultraviolet intensity.

Request example

GET: /v2.0/iot-03/weather/forecast/daily?lat=30.29&lon=120.15
{}

Return example

{ "coordinate": { "lon": "120.15", "lat": "30.29" }, "data": [ { "temp": "16", "sunriseInst": 1618177020000, "temperatureMax": 17, "tempUnit": "c", "temperatureMin": 15, "uvi": "0", "pressure": "1013", "windDir": "N", "sunsetInst": 1618223040000, "apparentTemperatureMax": 17, "realFeel": "16", "apparentTemperatureMin": 15, "condition": "Light rain", "briefCondition": "rain", "sunSet": "2021-04-12 18:24", "humidity": "92", "zoneId": "Asia/Shanghai", "conditionNum": 139, "time": 1618156800000, "windSpeed": "0.9", "sunRise": "2021-04-12 05:37" } ] }

Error code

For more information, see error code.

Appendix 1: Weather Conditions

condition_num condition
120 Sunny
101 Heavy rain
102 Thunderstorm
103 Sandstorm
104 Light snow
105 Snow
106 Freezing fog
107 Rainstorm
108 Isolated shower
109 Dust
110 Thunder and lightning
111 Light shower
112 Rain
113 Sleet
114 Dust devil
115 Ice pellet
116 Strong sandstorm
117 Sand blowing
118 Light to moderate rain
119 Mostly clear
121 Fog
122 Shower
123 Heavy shower
124 Heavy snow
125 Extraordinary rainstorm
126 Blizzard
127 Hail
128 Light to moderate snow
129 Partly cloudy
130 Light snow shower
131 Moderate snow
132 Overcast
133 Needle ice
134 Downpour
136 Thundershower and hail
137 Freezing rain
138 Snow shower
139 Light rain
140 Haze
141 Moderate rain
142 Cloudy
143 Thundershower
144 Moderate to heavy rain
145 Heavy rain to rainstorm
146 Clear