A high-performance, interactive weather radar card for Home Assistant, featuring high-resolution Swiss boundary masking, logical time-slider controls, and responsive design.
- 🇨🇭 Swiss-Focused Map: Automatically masks areas outside Switzerland with a dark overlay to focus attention on the relevant weather data.
- High Resolution: Uses high-quality vector boundaries for precise masking.
- Interactive Controls:
- Time Slider: Drag to scrub through radar history and forecast.
- Play/Pause: Animate the precipitation progression.
- Instant Time Feedback: Time label updates immediately as you drag the slider.
- Responsive: Automatically adjusts height to fit your dashboard layout (supports
panel: trueor grid layouts). - Smart Constraints: Prevents panning/zooming away from the Swiss region so you never get lost.
- Performance Optimized: Throttled data fetching ensures smooth interaction even on slower networks.
- Open HACS in Home Assistant.
- Go to Frontend.
- Click the 3-dot menu in the top right -> Custom repositories.
- Add the URL of this repository.
- Select Lovelace (or Dashboard if using HACS 2.0+) as the category.
- Click Add.
- Click Install on the new card.
- Reload your browser.
- Download the
meteoswiss-radar-card.jsfile from the releases page (or build it yourself usingnpm run build->dist/meteoswiss-radar-card.js). - Upload the file to your Home Assistant
wwwfolder (e.g.,/config/www/meteoswiss-radar-card.js). - Add the resource to your Home Assistant dashboard:
- Go to Settings > Dashboards > Three Dots Icon (top right) > Resources.
- Click + Add Resource.
- URL:
/local/meteoswiss-radar-card.js - Resource Type: JavaScript Module.
Use the "Manual" card configuration in your dashboard:
type: "custom:meteoswiss-radar-card"
zoom_level: 12 # Optional: Default zoom level (7-21). Default is 12 (approx. city view)| Option | Type | Default | Description |
|---|---|---|---|
type |
string | Required | Must be custom:meteoswiss-radar-card. |
zoom_level |
integer | 12 |
Initial zoom level of the map. Min: 7, Max: 21. |
Note: The map automatically centers on your Home Assistant zone location (latitude/longitude specified in HA configuration). If that is not set, it defaults to Bern, Switzerland.
MeteoSwiss blocks cross-origin requests from browsers for security reasons. This card uses a public CORS proxy service (corsproxy.io) to fetch weather data. The proxy simply forwards requests and is necessary for the card to function in Home Assistant.
Privacy Note: Weather data requests go through the CORS proxy. No personal or Home Assistant data is sent—only publicly available MeteoSwiss URLs are accessed.
To build the project locally:
-
Clone the repository:
git clone https://github.com/khashashin/ha-meteoswiss-precipitation.git cd ha-meteoswiss-precipitation -
Install dependencies:
npm install
-
Run development server:
npm start
This will start a local server at
http://127.0.0.1:8080. -
Build for production:
npm run build
The output file will be in
dist/meteoswiss-radar-card.js.
MIT
