Wallpaper Engine

Wallpaper Engine

Not enough ratings
How to get the weather to work on the Perfect Wallpaper
By Clemente
This is a way to implement the Weather function for cities outside of China for the Pertect Wallpaper.

Caveats:
- It is limited to current weather (no "feels [minimum]~[maximum]), expect to get your City's Name + Temperature.

What you'll need:
- A free WeatherBit account (https://www.weatherbit.io/)
- Your city ID (check for the cities CSV https://www.weatherbit.io/api/meta). City ID is the first value on the list.
   
Award
Favorite
Favorited
Unfavorite
Walkthrough
  1. Create your WeatherBit account and get your API Key (you'll get it on your email).
  2. Right-click the Perfect Wallpaper in Wallpaper Engine and select "Open in Explorer"
  3. Go into the "js" folder and edit "time.js"
  4. Search for "function getWeatherForCity"
  5. Replace everything below it with the following:
    function getWeatherForCity(city,strHtml) { $.get("https://api.weatherbit.io/v2.0/current?key=[API KEY HERE]&city_id="+city,function(data,status){ data = data.data[0]; cityname = data.city_name; weathernow = data.app_temp; wind = data.wind_cdir_full; windLv = Math.round(data.wind_spd * 3.6); weather.innerHTML = FormatWeather(strHtml); }) } function FormatWeather(strHtml){ //testGetWeather(); strHtml = strHtml.replace("{城市}",cityname); strHtml = strHtml.replace("{气温}",weathernow); strHtml = strHtml.replace("{天气}",""); strHtml = strHtml.replace("{风向}",wind); strHtml = strHtml.replace("{风级}",windLv); strHtml = strHtml.replace("{范围}", ""); return strHtml; }

  6. Replace the "[API KEY HERE]" for the actual API Key you've got.
  7. In the Wallpaper settings, in the "City Weather" setting, add the city id instead of the city's name.
  8. In the Wallpaper settings, in the "Weather Format" setting, select the 9th option (城市+气温).
  9. Reload the wallpaper.
Changing Units
If you want to use Fahrenheit or Kelvin, in the "City Weather" option, add "&units=S" (for Kelvin) or "&units=I" (for Fahrenheit) after the city id.