A Home Assistant custom integration that provides weather data from INMET (Instituto Nacional de Meteorologia - Brazilian National Institute of Meteorology).
Want to test the integration locally right now?
# Test core API logic (no installation needed!)
python test_api_direct.pyHaving issues with pytest? See QUICK_START.md for solutions to common problems.
For complete testing options and troubleshooting, see:
- QUICK_START.md - Quick testing guide & troubleshooting
- TESTING_GUIDE.md - Complete testing documentation
- LOCAL_TESTING.md - Run in real Home Assistant
- Current weather conditions from the nearest INMET weather station
- Weather forecast for the next days
- Automatic location detection based on Home Assistant's configured latitude and longitude
- Support for multiple locations
- Updates every 30 minutes
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository URL:
https://github.com/zanaca/ha-inmet-weather - Select category "Integration"
- Click "Add"
- Find "INMET Weather" in the integration list and click "Download"
- Restart Home Assistant
- Copy the
custom_components/inmet_weatherdirectory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click "+ Add Integration"
- Search for "INMET Weather"
- Follow the configuration steps:
- Name: Give your weather entity a name (default: "INMET Weather")
- Latitude: The latitude of your location (default: your Home Assistant's latitude)
- Longitude: The longitude of your location (default: your Home Assistant's longitude)
The integration will automatically find the nearest INMET weather station based on your coordinates.
The integration uses INMET's public API endpoints:
-
Geocode Detection: The integration has a built-in list of major Brazilian cities with their geocodes and coordinates. It calculates the distance between your configured location and these known locations to find the nearest one.
-
Current Weather API (
/estacao/proxima/{geocode}): Provides real-time weather conditions from the nearest INMET weather station, including:- Temperature, humidity, pressure
- Wind speed, gusts, and direction
- Rain accumulation
- Solar radiation and dew point
-
Forecast API (
/previsao/{geocode}): Provides detailed weather forecast data with three periods per day (morning, afternoon, evening) for multiple days ahead.
The integration automatically:
- Finds the nearest Brazilian city/municipality based on your coordinates
- Fetches current weather from the nearest INMET station
- Retrieves forecast data for your region
- Updates every 30 minutes to provide fresh data
- Temperature (°C)
- Humidity (%)
- Atmospheric Pressure (hPa)
- Wind speed (m/s)
- Wind gusts (m/s)
- Wind direction (degrees)
- Weather condition (sunny, cloudy, rainy, etc.)
- Dew point
- Solar radiation
- Temperature (high/low in °C)
- Weather condition with detailed descriptions
- Humidity (max/min %)
- Wind direction and intensity
- Temperature trends (rising, stable, falling)
- Up to 15 forecast periods covering the next 5 days
- Morning (manha): 6:00 AM
- Afternoon (tarde): 12:00 PM
- Evening (noite): 6:00 PM
This integration uses the INMET public API:
- Base URL:
https://apiprevmet3.inmet.gov.br - No API key required
- Free to use
# Install test dependencies
pip install -r requirements-test.txt
# Run all tests
pytest
# Run tests with coverage
pytest --cov=custom_components.inmet_weather --cov-report=html
# Run specific test file
pytest tests/test_api.py# Format code
black custom_components tests
# Lint
flake8 custom_components tests --max-line-length=100See CONTRIBUTING.md for more detailed development guidelines.
If you encounter any issues or have suggestions, please open an issue on GitHub.
Weather data provided by INMET - Instituto Nacional de Meteorologia.
Brazil's GeoJSON data provided by GADM.
This project is licensed under the MIT License - see the LICENSE file for details.