A Home Assistant custom integration that creates a smart weather station by analyzing your existing sensor data to determine accurate weather conditions for your specific location and microclimate. Weather station data from external services can be unreliable or not reflect your specific environment - this integration uses your actual sensor readings to provide weather conditions that truly represent what's happening at your location.
Weather station data can be unreliable or not reflect your specific microclimate. Here are better ways to detect weather conditions using your actual sensor data:
- 🎯 Microclimate Accuracy: Your backyard might be sunny while the nearest weather station reports cloudy
- 🌡️ Local Temperature: Your sensors know the exact temperature in your garden, not 10 miles away
- 🌧️ Precipitation Detection: Know immediately when it starts raining at your location
- 💨 Wind Conditions: Detect actual wind conditions affected by your local terrain and structures
- ☀️ Solar Analysis: Use your solar radiation sensors to accurately detect cloud cover
- ☀️ Astronomical Precision: Advanced cloud cover analysis using solar elevation and clear-sky radiation calculations
- 🏠 Hyperlocal Weather: Get weather conditions specific to your property and environment
- 🌍 Multi-Unit Support: Works seamlessly with both metric and imperial sensor units
This integration analyzes your real sensor data to provide weather conditions that truly represent what's happening at your exact location.
- 🌡️ Smart Weather Detection: Analyzes real sensor data to determine weather conditions
- 🧠 Intelligent Algorithms: Uses solar radiation, precipitation, wind, and pressure data
- 📊 Individual Sensors: Separate sensor entities for each weather parameter
- 🌦️ Weather Entity: Complete weather entity with current conditions and intelligent forecasts
- 🌡️ "Feels Like" Temp: Calculates Apparent Temperature (Heat Index/Wind Chill) automatically
- 📈 Intelligent Forecasting: 5-day daily and 24-hour hourly forecasts based on pressure trends
- ⚙️ Flexible Configuration: Works with any combination of available sensors
- 🔧 Dynamic Sensor Management: Add or remove sensors anytime through the options flow
- 🔄 Real-time Analysis: Updates based on actual sensor readings
- 📱 Easy Configuration: Simple setup through Home Assistant UI with sensor selection
- 🌍 Multilingual Support: Available in English, Italian, German, Spanish, and French
- 🔄 Multi-Unit Support: Automatic detection and conversion between metric and imperial units
HACS (Home Assistant Community Store) is the easiest way to install and manage custom integrations.
- HACS must be installed in your Home Assistant instance
- Home Assistant version 2023.1.0 or higher
- Open HACS: Go to HACS in your Home Assistant sidebar
- Navigate to Integrations: Click on "Integrations"
- Search and Install:
- Search for "Micro Weather Station" in HACS
- Click on it and select "Download"
- Choose the latest version
- Restart Home Assistant: Required for the integration to load
For advanced users or custom setups.
- Latest Release: Download from GitHub Releases
- Development Version: Clone the repository for latest features
-
Download Files:
# Option A: Download release wget https://github.com/caplaz/micro-weather-station/archive/refs/tags/v4.1.1.zip unzip v4.1.1.zip # Option B: Clone repository git clone https://github.com/caplaz/micro-weather-station.git
-
Copy to Home Assistant:
# Copy the integration folder to your custom_components directory cp -r micro-weather-station/custom_components/micro_weather /config/custom_components/ -
Verify Installation: Your directory structure should look like:
/config/custom_components/micro_weather/ ├── __init__.py ├── config_flow.py ├── const.py ├── manifest.json ├── meteorological_constants.py ├── sensor.py ├── strings.json ├── version.py ├── weather.py ├── weather_detector.py ├── weather_utils.py ├── analysis/ │ ├── core.py │ ├── atmospheric.py │ ├── solar.py │ └── trends.py ├── forecast/ │ ├── meteorological.py │ ├── evolution.py │ ├── daily.py │ └── hourly.py └── translations/ ├── de.json ├── en.json ├── es.json ├── fr.json └── it.json -
Restart Home Assistant: Go to Settings → System → Restart
For developers wanting to test or contribute.
- Git installed
- Home Assistant development environment
- Python 3.11+ with virtual environment
-
Clone Repository:
git clone https://github.com/caplaz/micro-weather-station.git cd micro-weather-station -
Create Symbolic Link (preserves git history):
# Link to your HA config directory ln -s $(pwd)/custom_components/micro_weather /config/custom_components/micro_weather
-
Install Development Dependencies:
pip install -r requirements-dev.txt
-
Run Tests:
python -m pytest tests/
For quick testing and development, use the included Docker setup:
-
Prerequisites:
- Docker and Docker Compose installed
- Git (for cloning)
-
Quick Start:
# Clone and setup git clone https://github.com/caplaz/micro-weather-station.git cd micro-weather-station # Start development environment ./dev.sh start # Access Home Assistant at http://localhost:8123
-
Development Workflow:
# View logs ./dev.sh logs # Run tests ./dev.sh test # Restart environment ./dev.sh restart # Stop environment ./dev.sh stop # Clean up (removes containers and volumes) ./dev.sh clean
-
Testing the Integration:
- The environment includes simulated weather sensors
- Integration is pre-configured with altitude correction (350m for testing) - set to 0 for raw sensor pressure
- Template sensors provide realistic weather data variations
- Debug logging is enabled for troubleshooting
See DEVELOPMENT for detailed setup instructions and troubleshooting.
After installation, verify the integration is loaded:
-
Check Logs: Go to Settings → System → Logs
- Look for
micro_weatherentries - No errors should be present
- Look for
-
Integration Available: Go to Settings → Devices & Services
- Click "Add Integration"
- Search for "Micro Weather Station"
- It should appear in the list
-
Version Check: In Developer Tools → States, search for
sensor.micro_weather- Entities should be available after configuration
- Navigate to Integrations: Go to Settings → Devices & Services
- Add Integration: Click "Add Integration" button
- Search: Type "Micro Weather Station" in the search box
- Select: Click on "Micro Weather Station" from the results
The configuration flow will guide you through selecting your sensors:
- Outdoor Temperature: Select your outdoor temperature sensor entity (required)
- Update Interval: Set how often to check sensors (default: 5 minutes)
- Elevation: Set your location's elevation above sea level for accurate pressure correction
Configure additional sensors for enhanced weather detection:
| Sensor Type | Description | Purpose |
|---|---|---|
| Dewpoint | Dewpoint temperature sensor | Direct dewpoint measurement for improved accuracy |
| Humidity | Humidity percentage sensor | Humidity readings and fog detection |
| Pressure | Atmospheric pressure sensor | Storm prediction and weather forecasting |
| Wind Speed | Wind speed sensor | Wind conditions and storm detection |
| Wind Direction | Wind direction sensor | Wind data and storm tracking |
| Wind Gust | Wind gust sensor | Severe weather and storm detection |
| Rain Rate | Precipitation rate sensor | Precipitation intensity measurement |
| Rain State | Rain state sensor (dry/wet) | Boolean precipitation detection |
| Solar Radiation | Solar radiation sensor (W/m²) | Cloud cover detection and solar analysis |
| Solar Lux | Light level sensor (lx) | Day/night and cloud detection (backup) |
| UV Index | UV index sensor | Clear sky detection and solar intensity |
| Sun Sensor | Solar elevation sensor | Precise cloud cover calculations based on sun position |
The integration automatically detects and converts between different sensor units:
- Temperature: °C ↔ °F
- Pressure: hPa/mbar ↔ inHg
- Wind Speed: km/h, mph, m/s
- Altitude: m ↔ ft (automatically adapts to your Home Assistant unit system)
Supported Configurations:
- ✅ Metric weather stations (°C, hPa, km/h)
- ✅ Imperial weather stations (°F, inHg, mph)
- ✅ Mixed environments (any combination)
- ✅ SI units (m/s wind speed)
- ✅ Dynamic altitude units (meters/feet based on HA system settings)
# Example sensor mappings:
Outdoor Temperature: sensor.outdoor_temperature # Required
Elevation: 350 # meters above sea level (automatically uses your HA unit system)
Humidity: sensor.outdoor_humidity # Optional - fog detection
Pressure: sensor.atmospheric_pressure # Optional - storm prediction
Wind Speed: sensor.wind_speed # Optional - wind conditions
Rain State: sensor.rain_detector # Optional - precipitation detection
Solar Radiation: sensor.solar_radiation # Optional - cloud cover analysisNote: The integration focuses on outdoor environmental sensors. Indoor sensors are not used for weather condition detection.
- Edit Dashboard: Go to your dashboard and click "Edit"
- Add Card: Click "Add Card" → "Weather Forecast"
- Configure: Select
weather.micro_weather_station - Save: The weather card should display your data
# Example sensor card configuration
type: entities
entities:
- entity: sensor.micro_weather_station_temperature
name: Temperature
icon: mdi:thermometer
- entity: sensor.micro_weather_station_humidity
name: Humidity
icon: mdi:water-percent
- entity: sensor.micro_weather_station_pressure
name: Pressure
icon: mdi:gauge
title: Weather SensorsCreate a test automation to verify the integration works:
# Test automation
automation:
- alias: "Test Weather Integration"
trigger:
- platform: state
entity_id: weather.micro_weather_station
action:
- service: notify.persistent_notification
data:
message: >
Weather changed to: {{ states('weather.micro_weather_station') }}
Temperature: {{ state_attr('weather.micro_weather_station', 'temperature') }}°C
title: "Weather Update"weather.micro_weather_station- Main weather entity with current conditions and forecast
This integration creates only the weather entity to avoid duplicating your existing sensor entities. All weather data is displayed through the main weather entity, which references your configured sensors directly.
The integration now supports direct dewpoint sensors for improved accuracy:
- Direct Dewpoint: If you have a dewpoint sensor, it will be used directly for maximum accuracy
- Calculated Dewpoint: If no dewpoint sensor is available, it will be calculated from temperature and humidity using the Magnus formula
- Improved Fog Detection: Better fog detection using conservative humidity thresholds (>98%) combined with dewpoint analysis and solar radiation data
- Fallback Mechanism: Seamlessly falls back to calculated dewpoint when direct sensor unavailable
The integration uses a modular architecture with specialized analyzers to process your sensor data:
- Core Analyzer: Priority-based weather condition determination with 7 detection levels
- Atmospheric Analyzer: Pressure systems, fog detection scoring (0-100 points), and storm probability
- Solar Analyzer: Cloud cover estimation using solar radiation and clear-sky models
- Trends Analyzer: Historical data analysis and pattern recognition
For detailed information about the sophisticated meteorological algorithms used for weather condition detection, see WEATHER_DETECTION_ALGORITHM.
The integration provides sophisticated 5-day daily and 24-hour hourly forecasts using a modular forecasting system:
- Meteorological Analyzer: Comprehensive atmospheric state analysis and stability assessment
- Pattern Recognizer: Historical weather pattern analysis and seasonal factor calculation
- Evolution Modeler: Weather system transition prediction with confidence levels
- Astronomical Calculator: Solar position and diurnal temperature cycle modeling
- Daily Generator: 5-day forecast with temperature, conditions, precipitation, wind, and humidity
- Hourly Generator: 24-hour detailed predictions with micro-evolution modeling
For comprehensive information about the advanced forecasting algorithms, meteorological principles, and technical implementation details, see WEATHER_FORECAST_ALGORITHM.
- Pressure-based Prediction: Uses barometric pressure trends as primary forecast driver
- Multi-factor Temperature Forecasting: Combines pressure patterns, seasonal variations, and system evolution
- Sophisticated Condition Prediction: Priority system analyzing clouds, pressure, humidity, and wind
- Precipitation Probability: Multi-factor calculation using humidity, dewpoint spread, and pressure trends
- Wind Forecasting: Pressure gradient analysis with atmospheric stability considerations
- Confidence Dampening: Accuracy estimates that decrease with forecast distance
- Local Pattern Learning: Adapts to your specific microclimate patterns over time
automation:
- alias: "Cloudy Day Lights"
trigger:
- platform: state
entity_id: weather.micro_weather_station
to: "cloudy"
action:
- service: light.turn_on
target:
entity_id: light.living_room
data:
brightness: 200
### Storm Preparation
```yaml
automation:
- alias: "Storm Alert"
trigger:
- platform: state
entity_id: weather.micro_weather_station
to: "lightning-rainy"
action:
- service: notify.mobile_app
data:
message: "Storm detected! Secure outdoor items."
title: "Weather Alert"
### Smart Irrigation
```yaml
automation:
- alias: "Skip Irrigation on Rain"
trigger:
- platform: time
at: "06:00:00"
condition:
- condition: not
conditions:
- condition: state
entity_id: weather.micro_weather_station
state: "rainy"
action:
- service: switch.turn_on
target:
entity_id: switch.garden_sprinklersautomation:
- alias: "High Temperature Alert"
trigger:
- platform: numeric_state
entity_id: sensor.micro_weather_station_temperature
above: 30
action:
- service: notify.mobile_app
data:
message: "Temperature is high: {{ states('sensor.micro_weather_station_temperature') }}°C"type: weather-forecast
entity: weather.micro_weather_stationtype: entities
entities:
- entity: sensor.micro_weather_station_temperature
name: Temperature
- entity: sensor.micro_weather_station_humidity
name: Humidity
- entity: sensor.micro_weather_station_pressure
name: Pressure
- entity: sensor.micro_weather_station_wind_speed
name: Wind Speed
title: Weather Stationtype: history-graph
entities:
- sensor.micro_weather_station_temperature
- sensor.micro_weather_station_humidity
hours_to_show: 24
refresh_interval: 300This integration is perfect for:
- 🌡️ Smart Weather Detection: Use your existing sensors to get intelligent weather condition detection
- 🏠 Enhanced Automation: Create more accurate weather-based automation using real sensor data
- 📊 Data Analysis: Understand weather patterns based on your actual sensor readings
- 📈 Accurate Forecasting: Get weather conditions that match your local environment
- 🔧 Sensor Integration: Make better use of your weather station investment
Problem: "Micro Weather Station" doesn't appear when adding integrations.
Solutions:
- Verify Installation:
# Check if files exist ls -la /config/custom_components/micro_weather/ - Check Logs: Settings → System → Logs, search for
micro_weather - Restart Required: Restart Home Assistant after installation
- Clear Browser Cache: Hard refresh (Ctrl+F5) or clear cache
Problem: Integration loads but shows errors in logs.
Solutions:
- Check Python Version: Requires Python 3.11+
- Verify Dependencies: All sensors should exist in HA
- Review Manifest: Check
custom_components/micro_weather/manifest.json - File Permissions: Ensure files are readable by HA user
Problem: Dropdown menus are empty during configuration.
Solutions:
- Verify Sensor Entities:
- Go to Developer Tools → States
- Search for your temperature sensors
- Entity IDs must match exactly
- Check Sensor Types:
# Valid temperature sensors should have device_class sensor.outdoor_temp: device_class: temperature unit_of_measurement: "°C" # or "°F"
- Sensor States: Ensure sensors have valid numeric values
Problem: Weather entity stuck on one condition.
Diagnostic Steps:
-
Check Sensor Values:
# In Developer Tools → States, verify: sensor.outdoor_temperature: 22.5 # Valid number sensor.humidity: 65 # 0-100 range sensor.pressure: 1013.2 # Valid pressure
-
Review Detection Logic:
- High solar radiation (>400 W/m²) = Sunny
- Active rain sensor = Rainy
- Low solar + high humidity = Foggy
- Default = Cloudy
-
Check Update Interval: Verify sensors update within configured interval
Problem: Incorrect precipitation or fog detection.
Common Causes & Solutions:
-
Invalid Rain State Values:
# ❌ WRONG - These values don't work with moisture sensors: sensor.rain_state: "rain", "drizzle", "precipitation" # ✅ CORRECT - Binary moisture sensors only report: sensor.rain_state: "wet" or "dry"
-
Fog vs Precipitation:
- Fog can make moisture sensors read "wet" without actual precipitation
- The integration automatically distinguishes between fog moisture and rain
- Check humidity (>95%) and dewpoint spread (<3°F) for fog conditions
-
Rain Rate Sensitivity:
- Very light rain rates (<0.01 in/hr) may not trigger precipitation detection
- This prevents false alerts from dew or light fog moisture
- Increase rain gauge sensitivity if needed
-
Basic Functionality Test:
# Developer Tools → Services service: homeassistant.update_entity target: entity_id: weather.micro_weather_station
-
Sensor Response Test:
- Manually change a sensor value (if possible)
- Wait for update interval
- Check if weather condition changes
-
Forecast Test:
# Check forecast data exists forecast = state_attr('weather.micro_weather_station', 'forecast') # Should return list of forecast periods
Enable Debug Logging:
# configuration.yaml
logger:
default: info
logs:
custom_components.micro_weather: debugKey Log Messages:
Setting up micro_weather- Integration loadingWeather condition detected- Condition changesSensor updated- Individual sensor updatesForecast generated- Forecast calculations
-
Resource Usage:
- Monitor CPU usage during updates
- Check memory consumption
- Verify update frequency is appropriate
-
Sensor Health:
# Create automation to monitor sensor availability automation: - alias: "Weather Sensor Health Check" trigger: - platform: state entity_id: sensor.outdoor_temperature to: "unavailable" action: - service: notify.persistent_notification data: message: "Weather sensor offline: outdoor temperature"
# Developer Tools → Services
service: homeassistant.reload_config_entry
target:
entity_id: weather.micro_weather_station-
Check Integration Registry:
- Settings → Devices & Services
- Find "Micro Weather Station"
- Click "Configure" to verify settings
-
Entity Registry Verification:
- Developer Tools → States
- All micro_weather entities should be present
- Check entity attributes for data consistency
-
Component State Machine:
# Verify entity states in Developer Tools weather.micro_weather_station: state: "sunny" # Valid weather condition attributes: temperature: float # Numeric value humidity: float # 0-100 range forecast: list # Array of forecast data
When reporting issues, include:
- Home Assistant Version: Settings → About
- Integration Version: Check HACS or git tag
- Sensor Configuration: List of configured sensors
- Error Logs: Full error messages from logs
- Sensor States: Current values of configured sensors
# Check HA logs for errors
grep -i "micro_weather" /config/home-assistant.log
# Verify file integrity
find /config/custom_components/micro_weather -name "*.py" -exec python -m py_compile {} \;
# Check sensor availability
ha-cli state list | grep temperature- 🐛 GitHub Issues - Bug reports and feature requests
- 💬 Home Assistant Community - General questions and discussions
- 📚 Documentation - Complete setup guide
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create a feature branch
- Make your changes
- Test with Home Assistant
- Submit a pull request
Special thanks to @Intecpsp for their valuable contributions to this project!
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG for the complete changelog.
Note: This smart weather station uses your existing sensor data to intelligently detect weather conditions. Configure your sensors during setup to get accurate weather detection based on your local environment.
