This directory contains debugging tools to help troubleshoot issues with the Wunderground scraper integration.
# Install dependencies
cd debug
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Test sensor availability (URL or Station ID)
python test_sensors.py https://www.wunderground.com/dashboard/pws/KTXHOUST4430
# or
python test_sensors.py KTXHOUST4430
# Find/validate station URLs
python find_stations.py "Your City, State"Tests all sensors for a given weather station using the Weather.com PWS API.
Usage:
python test_sensors.py [URL or Station ID]Features:
- Uses Weather.com PWS API (same as the integration)
- Tests all 12 sensor types (temperature, humidity, UV, solar, etc.)
- Shows both Fahrenheit and Celsius temperatures
- Shows time-based availability (UV/Solar at 0 during night)
- Exports results to JSON file with full API response
- Color-coded output for easy debugging
Example:
# Using full URL
python test_sensors.py https://www.wunderground.com/dashboard/pws/KTXHOUST4430
# Using just station ID
python test_sensors.py KTXHOUST4430Output:
🌦️ Testing Weather Station: KTXHOUST4430
📅 Test Time: 2025-11-23 20:09:42
================================================================================
📍 Station ID: KTXHOUST4430
🔗 API Endpoint: https://api.weather.com/v2/pws/observations/current
📌 Location: Downtown
🕐 Last Update: 2025-11-23 19:08:00
📊 SENSOR AVAILABILITY REPORT
--------------------------------------------------
🌡️ Temperature Sensors:
✅ temperature : 70.3°F (21.3°C)
✅ feels_like : 70.3°F (21.3°C)
✅ dew_point : 60.0°F (15.6°C)
💨 Wind Sensors:
✅ wind_speed : 5.8
✅ wind_gust : 8.1
✅ wind_direction : 76
📈 SUMMARY:
Available: 12/12 sensors
Success Rate: 100.0%
🌙 Nighttime test - UV/Solar sensors expected to be 0
Helps find and validate Personal Weather Station URLs.
Usage:
# Search for stations by location
python find_stations.py "Boston, MA"
# Validate a specific PWS URL
python find_stations.py https://www.wunderground.com/dashboard/pws/KMABOSTO123Features:
- Validates URL format and accessibility
- Suggests alternative URL formats
- Extracts station IDs
- Provides manual search guidance
Example:
python find_stations.py https://www.wunderground.com/dashboard/pws/KNYNEWYO1959
🔍 Validating PWS URL: https://www.wunderground.com/dashboard/pws/KNYNEWYO1959
✅ URL format looks valid
✅ URL is accessible
✅ Weather data found (Temperature: 63)Possible Causes:
- Station is offline or not reporting
- Station ID doesn't exist
- Station was recently removed
Debug Steps:
- Verify the station exists by visiting the Wunderground URL in a browser
- Try a different nearby station
- Check if the station has been updated recently on Wunderground
Possible Causes:
- UV/Solar: Only available during daylight hours with clear skies
- Wind Direction: May not report when wind speed is 0
- Precipitation: May not report when not raining
- Station Equipment: Not all stations have all sensors
What's Normal:
- UV Index and Solar Radiation are 0.0 at night (not null)
- Wind direction may be null during calm conditions
- Some stations only report basic metrics (temp, humidity, pressure)
Possible Causes:
- Incorrect URL format
- URL doesn't contain
/pws/STATIONID
Solution: Use one of these formats:
- Full URL:
https://www.wunderground.com/dashboard/pws/KTXHOUST4430 - Station ID only:
KTXHOUST4430
sensor_test_results.json: Latest test results with timestamps- Debug logs and error traces
After debugging:
- Copy working URLs from test results
- Note available sensors to set expectations
- Test at different times to understand sensor availability patterns
- Update integration config with validated URLs
When reporting issues, please include:
- Output from
test_sensors.py - Station URL being tested
- Time of day when tested
- Expected vs actual sensor availability
This helps maintain and improve the scraper integration.