Skip to content

feat: Add QWeather (和风天气) API support for China users#147

Open
ThendCN wants to merge 1 commit intok-donn:mainfrom
ThendCN:feature/qweather-support
Open

feat: Add QWeather (和风天气) API support for China users#147
ThendCN wants to merge 1 commit intok-donn:mainfrom
ThendCN:feature/qweather-support

Conversation

@ThendCN
Copy link
Copy Markdown

@ThendCN ThendCN commented Feb 1, 2026

Summary

Weather Underground has limited coverage in China, making it difficult for Chinese users to find local weather stations. This PR adds support for QWeather (和风天气), a popular weather data provider in China with excellent coverage of Chinese cities.

Changes

New Files

  • plasmoid/contents/code/qweather-api.js - Full QWeather API implementation

Modified Files

  • plasmoid/contents/ui/main.qml - Switch to QWeather API
  • plasmoid/contents/ui/config/ConfigStation.qml - Add API Key configuration UI
  • plasmoid/contents/ui/lib/StationSearcher.qml - Use QWeather for city search
  • plasmoid/contents/ui/lib/StationMapSearcher.qml - Use QWeather for map search
  • plasmoid/contents/config/main.xml - Add qweatherApiKey config entry

Features

  • City Search: Search Chinese cities by name (中文) or pinyin
  • Current Weather: Real-time weather data with temperature, humidity, wind, pressure
  • 7-Day Forecast: Daily weather forecast
  • Hourly Forecast: 24-hour weather forecast
  • Air Quality: AQI data for Chinese cities
  • Weather Alerts: Official weather warnings

Configuration

Users need to:

  1. Register at https://console.qweather.com/
  2. Create a project and get API Key
  3. Enter API Key in widget settings
  4. Search for cities using Chinese names or pinyin

Technical Details

  • Uses X-QW-Api-Key header for authentication
  • Normalizes language codes (zh-CNzh) for QWeather compatibility
  • Maps QWeather icon codes to existing widget icons

Screenshots

(Weather data for 黄岛/Huangdao, which was not available on Weather Underground)


This is my first contribution. Happy to make any changes if needed!

Weather Underground has limited coverage in China, making it difficult
for Chinese users to find local weather stations. This PR adds support
for QWeather (和风天气), a popular weather data provider in China.

Changes:
- Add qweather-api.js with full QWeather API implementation
- Support city search, current weather, 7-day forecast, hourly forecast
- Support air quality and weather alerts
- Add API Key configuration in settings
- Use X-QW-Api-Key header for authentication
- Normalize language codes (zh-CN -> zh) for QWeather compatibility

Configuration:
- Users need to register at https://console.qweather.com/
- Enter API Key and API Host in widget settings
- Search for cities using Chinese names or pinyin

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@k-donn
Copy link
Copy Markdown
Owner

k-donn commented Feb 2, 2026

Wow! This is amazing. Thank you for doing this!

I am always looking for ways to improve this widget for more people. Despite that, I have to manage my time to support this widget. I have built it around Wunderground and want to keep it that way as long as I can. Supporting the infrastructure around two sources would go in a direction I do not want to go. I am probably not going to merge these changes into the main branch.

However! I would love to distribute these changes as an additional option on the KDE Store. You are also more than welcome to distribute it yourself as this is a GPL-2.0 project. If there are any distribution options that would meet a Chinese audience better, feel free to distribute it there too!

Going forward, you are welcome to incorporate further changes I make into the widget. You can even keep this pr open and keep the branch in sync if you want. When I push out changes, you can merge/rebase this fork. Feel free to reach out if there is a conflict, and I would love to help to clear it.

Thanks again for your interest and I want you to know how much your interest means to me! If you are okay with me distributing the fork, let me know.

Have a good day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants