Satellite images - Weather images - Update 1

Hello everyone,

In my post « Battery Camera - Wildlife Observation Camera - QNAP - Reolink - Immich Integration » I showed you my approach on how you could display images from a battery-powered camera in Gladys.
In doing so, I noticed that the « Immich Slide Show » integration shows you two cameras, meaning you can display two albums from the Immich server.

This gave me the idea to tap into current weather satellites. In other words, to obtain current weather data for all of Europe.

Well, something like this exists and it’s free and without registration.

Here’s a link to it:

Eumetsat

If you call up the link, you should get the following:

It shows lightning and storms over Europe…

Option 1:

You could directly integrate the images, more on the variants later, into Gladys, i.e. via the Photo widget.

Problem: The files are all generated at runtime and they are large. If you then open Gladys and go to the dashboard, these images will be newly created and downloaded each time.

Option 2:

We create a Docker, download the desired images there every 2 hours, then create an album in the Immich server, integrate the Docker’s download directory as an external library, monitor it, and finally integrate the second camera from there via the Gladys integration with the album… Done

Step 1:

Directory structure:

In other words:

A directory image-downloader with the subdirectories images and scripts. Under scripts, there is already the script for automatic download.

Step 2:

YAML for automated script execution:

version: "3.8"

services:
image-downloader:
image: alpine:latest
container_name: image-downloader
restart: unless-stopped
volumes:
- /share/Container/image-downloader/images:/data/images:rw
- /share/Container/image-downloader/scripts:/scripts:ro
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Berlin
command: >
sh -c "
apk add --no-cache curl tzdata &&
echo '0 \*/2 \* \* \* /bin/sh /scripts/download.sh >> /proc/1/fd/1 2>&1' > /etc/folders_cron &&
crontab /etc/folders_cron &&
exec crond -f -l 2
"

The YAML is set up so that the script download.sh is started every two hours.

Here is the script download.sh:

#!/bin/sh

#Set time zone for correct time
export TZ="Europe/Berlin"
echo "\[$(date '+%Y-%m-%d %H:%M:%S')\] --- Download job started ---"

#URLs for the EUMETSAT images

URL1="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:li_afa,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=-1000000,3800000,1500000,5400000&width=3600&height=2160&srs=AUTO:97004,9001,0,0&styles=&format=image/png&bgcolor=0x000000"
URL2="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:rgb_geocolour,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=-1000000,3800000,1500000,5400000&width=3600&height=2304&srs=AUTO:97004,9001,0,0&styles=&format=image/png&bgcolor=0x000000"

#Target directory (WITHIN the container!)

OUTPUT_DIR="/data/images"
TIMESTAMP=$(date +%Y%m%d\_%H%M%S)

#Download using curl
echo "\[$(date '+%Y-%m-%d %H:%M:%S')\] Downloading image 1..."
curl -sSL -o "${OUTPUT_DIR}/${TIMESTAMP}\_bild1.png" "$URL1"
echo "\[$(date '+%Y-%m-%d %H:%M:%S')\] Downloading image 2..."
curl -sSL -o "${OUTPUT_DIR}/${TIMESTAMP}\_bild2.png" "$URL2"

#--- NEW: Cleanup (Deletes images older than 3 days) ---

#echo "\[$(date '+%Y-%m-%d %H:%M:%S')\] Cleaning up old images..."

#find "${OUTPUT_DIR}" -type f -name "\*.png" -mtime +3 -delete
echo "\[$(date '+%Y-%m-%d %H:%M:%S')\] --- Download job successfully completed ---"

#Addition: If the download.sh is edited via Windows, #then line endings may be lost

#The following SSH command provides a remedy

#This is only a reminder, do not execute it via the script

#sed -i 's/\\r$//' /share/Container/image-downloader/scripts/download.sh

Attention: The script already includes two extensions, on the one hand the deletion of all images that are older than three days and then the problem if you create the script with Windows, because sometimes the line endings are lost. Then simply go to the server via SSH and execute the sed command.

Interim result:

The result then looks like this:

You thus have two satellite images on your computer, one with lightning and storm data, the other then with clouds.

Now to the options:

If you look at the URL, there is something about

layers=backgrounds:ne_gray,mtg_fd:li_afa,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land

Here you can change the display, for example with borders, without borders, clouds, lightning, etc.

The next option is the selection of the section:

bbox=-1000000,3800000,1500000,5400000&width=3600&height=2160

for example shows from Portugal to Poland and from Norway to northern Italy.

Here you can also adjust it, the only important thing is to adjust the ratio between width and height, otherwise errors will occur.

What’s next:

As described in my previous post. The images are there. In the YAML of the Immich server, integrate the directory. Then configure the external library in the Immich server. Create an album from it. Turn on the Immich server monitoring, generate a workflow and finally simply subscribe to this album in the already installed Immich Slide Show and display it in the second camera.

Thank you for your attention and if you have thoughts / improvements / hints, etc., then bring them on, I look forward to them.

tom

Thanks for this tutorial, I took the liberty of putting your YAML and script in preformatted text to make it more readable.

@mutmut… I still have to learn that, thank you very much for your support.

First, the result:

  • The satellite images are automatically downloaded from Docker (currently every 2 hours, two different views)
  • In the Immich server there is an album, which is filled via an external library
  • The filling of new images is automatically monitored by the Immich server and updates the album
  • Under Gladys, the Immich integration then takes over the display and makes the album available via a virtual camera:

Update Update

The size of the satellite image files (sometimes over 10 MB) has already bothered me during a download.
At the same time, I never knew which image was displayed.

Therefore Step 1:
Via the YAML of the Image-Downloader, we install a small program for it:

version: "3.8"

services:
  image-downloader:
    image: alpine:latest
    container_name: image-downloader
    restart: unless-stopped
    volumes:
      - /share/Container/image-downloader/images:/data/images:rw
      - /share/Container/image-downloader/scripts:/scripts:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=Europe/Berlin
    command: >
      sh -c "
      apk add --no-cache curl tzdata imagemagick font-noto &&
      echo '0 */2 * * * /bin/sh /scripts/download.sh >> /proc/1/fd/1 2>&1' > /etc/folders_cron &&
      crontab /etc/folders_cron &&
      exec crond -f -l 2
      "

It is about ImageMagick and in the download script we use this ImageMagick to burn a timestamp into the image data:

#!/bin/sh

# Set time zone for correct time
export TZ="Europe/Berlin"

echo "[$(date '+%Y-%m-%d %H:%M:%S')] --- Download job started ---"

# URLs for the EUMETSAT images

# GeoColour RGB Meteosat 3rd Generation
URL1="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:rgb_geocolour,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=46.26,4.24,56.04,16.68&width=1844&height=2304&srs=EPSG:4326&styles=&format=image/png&bgcolor=0x000000"

# Precipitation Rate Meteosat 3rd Generation
URL2="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:h40b,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=46.26,4.24,56.04,16.68&width=1844&height=2304&srs=EPSG:4326&styles=&format=image/png&bgcolor=0x000000"

# Night Thermal Image Meteosat 3rd Generation
URL3="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:ir105_hrfi,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=46.26,4.24,56.04,16.68&width=1844&height=2304&srs=EPSG:4326&styles=&format=image/png&bgcolor=0x000000"

# Day Thermal Image Meteosat 3rd Generation
URL4="https://view.eumetsat.int/geoserver/wms?service=WMS&version=1.3.0&request=GetMap&layers=backgrounds:ne_gray,mtg_fd:vis06_hrfi,backgrounds:ne_10m_coastline,backgrounds:ne_boundary_lines_land&bbox=46.26,4.24,56.04,16.68&width=1844&height=2304&srs=EPSG:4326&styles=&format=image/png&bgcolor=0x000000"

# Target directory (INSIDE the container!)
OUTPUT_DIR="/data/images"
mkdir -p "${OUTPUT_DIR}"

# Timestamps: once for filenames, once for display in the image
TIMESTAMP=$(date '+%Y%m%d_%H%M')
TIMESTAMP_DISPLAY=$(date '+%d.%m.%Y %H:%M')

# Get current hour in 24-hour format (00 - 23)
CURRENT_HOUR=$(date +%H)

# Helper function: Download + error checking + burn timestamp
download() {
    URL="$1"
    NAME="$2"
    LABEL="$3"
    FILE="${OUTPUT_DIR}/${NAME}_${TIMESTAMP}.png"

    echo "[$(date '+%Y-%m-%d %H:%M:%S')] Downloading ${NAME}..."
    if curl -sSfL -o "$FILE" "$URL"; then
        if command -v magick >/dev/null 2>&1; then
            magick "$FILE" -gravity southeast \
                -pointsize 48 -fill white -undercolor 'rgba(0,0,0,0.55)' \
                -annotate +20+20 "${LABEL} ${TIMESTAMP_DISPLAY}" "$FILE" 2>/dev/null \
                || echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR burning timestamp in ${NAME}!"
        else
            echo "[$(date '+%Y-%m-%d %H:%M:%S')] ${NAME}: ImageMagick missing - no timestamp in image!"
        fi
    else
        echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: Download of ${NAME} not successful!"
        rm -f "$FILE"
    fi
}

# 1. Download: GeoColour
download "$URL1" "GeoColour" "GeoColour"

# 2. Download: Precipitation Rate
download "$URL2" "PrecipitationRate" "Precipitation"

# 3. Time-controlled download for thermal images (switch between day and night)
if [ "$CURRENT_HOUR" -ge 8 ] && [ "$CURRENT_HOUR" -lt 18 ]; then
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] Day operation ($CURRENT_HOUR:00)."
    download "$URL4" "ThermalDay" "Thermal Image Day"
else
    echo "[$(date '+%Y-%m-%d %H:%M:%S')] Night operation ($CURRENT_HOUR:00)."
    download "$URL3" "ThermalNight" "Thermal Image Night"
fi

# --- Cleanup (Deletes images older than 24 hours) ---
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Cleaning up old images (older than 24 hours)..."
find "${OUTPUT_DIR}" -type f -name "*.png" -mmin +1440 -delete

echo "[$(date '+%Y-%m-%d %H:%M:%S')] --- Download job finished ---"

# Additional: If download.sh is edited via Windows, then line endings may be lost
# The following SSH command helps then
# This is only for reference, do not execute via the script
# sed -i 's/\r$//' /share/Container/image-downloader/scripts/download.sh

# Start script for testing purposes via SSH:
# docker exec image-downloader sh /scripts/download.sh

Finally, I simply took one of the links, gave it to Mistral and said: Please frame the box for me on Germany plus 100 km border.

Done:

The original image

Here you can see well how the type of image and the timestamp are displayed in the bottom right.

The images are now only about 1.2 MB in size and in Gladys they appear as follows:

Best regards to everyone
Toma