Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

AEMET

4 sites Security covered
View on drupal.org

This module displays weather information for Spanish locations by integrating with the Spanish Meteorological Agency (AEMET). It allows you to add blocks showing weather data for specific municipalities, leveraging AEMET's OpenData API.

Shows Weather information from spanish locations integrating with AEMET, the Spanish Meteorological Agency. Recommended for sites that shows information of specific cities or towns from Spain.

This module is NOT an official one and uses AEMET data from their OpenData API.

Features

  • Allows adding a block showing weather information for a specific municipality.
  • Provides services to perform requests to AEMET. This service can scale according to future requirements of Drupal sites.

Requirements

It is needed having an API key from Aemet. It can be requested at the Aemet OpenData page.

How to use

After installing Aemet, it is needed to add the API key at Configuration -> Web Services > Aemet

To show the weather information, go to 'Block Layout' and add the Block named 'Aemet Weather: Hourly prediction':

To configure the block, it is needed to specify the municipality code.

This code must be obtained from the INE municipality list. For any location, the code is build by joining the values of the columns CPRO and CMUN.

For example, the code for Albacete can be obtained by joining 02 and 003: 02003

After that , the block with the weather information must appear.

Real-Time block configuration

To display real time information from AEMET in sites with anonymous page cache, it is recommended using the AJAX block module. This module allows adding a specific block via AJAX, with possibilities of caching and automatic refresh.

Extending

To customize the output of the municipality weather block, it is possible replacing the weather-info SDC.

Also, there is a service that allows getting the hourly weather for a specific province, the aemet.client service. For example, is possible getting the hourly weather prediction for a municipality by running this code:

      $aemetClient = \Drupal::service('aemet.client');
      $prediction = $aemetClient
        ->predictionsSpecific()
        ->getMunicipalityPredictionHourly('02003');

In case more endpoints from AEMET OpenData are needed feel free opening an issue.

Activity

Total releases
5
First release
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 5
Maintenance
Dormant

Release Timeline

Releases

Version Type Release date
2.0.1 Stable Feb 3, 2025
2.0.0 Stable Feb 3, 2025
2.0.0-rc1 Pre-release Jan 31, 2025
2.0.0-beta1 Pre-release Jan 30, 2025
2.x-dev Dev Jan 30, 2025