07-26-2021 08:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-26-2021 08:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hello,
I'm having some trouble implementing the new Weather API in SDK Version 4.3
It doesn't seem to use my current location, instead it uses the sample location from the documentation.
The documentation doesn't state that I have to pass the location myself.
Here is the code I used:
import weather from "weather";
weather
.getWeatherData({temperatureUnit: "celsius"})
.then(data => {
console.log(JSON.stringify(data));
if (data.locations.length > 0) {
let condition = data.locations[0].currentWeather.weatherCondition;
condition = mapping_codes[Providers.fitbit][condition];
const weather = {
temperatureC: Math.floor(data.locations[0].currentWeather.temperature),
temperatureF: Math.floor(data.locations[0].currentWeather.temperature) * 9 / 5 + 32,
location: data.locations[0].name,
coord: { "lon": longitude,"lat": latitude},
description: '',
isDay: true,
conditionCode : condition !== undefined ? condition : Conditions.Unknown,
realConditionCode: data.locations[0].currentWeather.weatherCondition,
sunrise: 1000,
sunset: 1000
};
resolve(weather);
}else{
reject('');
}
And I'm getting the following response:
{
"temperatureUnit": "celsius",
"locations": [
{
"id": "",
"name": "Yosemite",
"timeOffsetUTC": -25200,
"currentWeather": {
"epochTime": 1627314027,
"weatherCondition": 32,
"temperature": 22
},
"days": [
{
"epochTimeMidnight": 1627257600,
"day": 1,
"weatherCondition": 1,
"precipitationProbability": 5,
"epochSunriseTime": 1627282800,
"epochSunsetTime": 1627326000,
"highTemperature": 24,
"lowTemperature": 17,
"hours": [
{
"epochTimeStart": 1627311600,
"hour": 17,
"temperature": 24,
"weatherCondition": 7
},
{
"epochTimeStart": 1627315200,
"hour": 18,
"temperature": 22,
"weatherCondition": 18
},
{
"epochTimeStart": 1627318800,
"hour": 19,
"temperature": 21,
"weatherCondition": 7
}
]
}
]
}
]
}
Everything together
07-26-2021 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-26-2021 09:09
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Servus, dieser Sab ist nun gekapert, tschau und meddl off.

07-26-2021 09:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


07-26-2021 09:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for raising this. There's seems to be an anomaly between Android and iOS and we're investigating.

12-13-2021 11:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-13-2021 11:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Noticing this same issue with the latest 6.0 sdk, was this ever resolved? Seems like the location doesn't change from Yosemite.

12-13-2021 12:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-13-2021 12:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Yes, the weather API works for me now. When I use the simulator it is still always sample data from Yosemite but it will use the correct location on a real device.
