Skip to content

New Share your ideas with the AWTRIX community. Keep your creations together in your account.

Sign in

Which AWTRIX do you have? Choose it once and the Hub shows what runs on it.

ScriptAWTRIX NG

SunEvent: Sunrise & Sunset Countdown

On an AWTRIX display
SunEvent: Sunrise & Sunset Countdown shown on an AWTRIX display
SunEvent: Sunrise & Sunset Countdown · by strusic

On your display

Simple automation for displaying time to sunset and sunrise

Which AWTRIX do you have? See below where it runs, or choose your device.
Topic
Smarthome
Includes
Script · 2 icons

Runs on

  • Runs on 32×8 (TC001 & DIY)
  • Runs on 52×16 (TC002)
  • Does not run on 32×8 with AWTRIX 3 (TC001 & DIY) Made for AWTRIX NG.

Choose your display in the next step.

Send to AWTRIX

Choose your AWTRIX

SunEvent: Sunrise & Sunset CountdownAWTRIX NG script

Install this script on your AWTRIX NG. Its icons and sounds are installed with it.

Your AWTRIX’s local address, for example 192.168.178.39 or awtrix.local.

The name shown in your AWTRIX script list. Use letters, digits, hyphens or underscores.

Connection & device login

Connect your phone or computer to the same network as your AWTRIX. Allow local network access if your browser asks.

Use the device’s IP address, without a page path such as /#/apps.

If your AWTRIX requires a login, the username and password fields will appear when you connect.

Sign in to the Hub to install scripts. Attached files are installed separately.

Script description

🌅 SunEvent: Sunrise & Sunset Countdown

A native Berry script for AWTRIX NG that acts as a smart countdown timer for upcoming sun events. It runs completely independently on the device and fetches data via the free Open-Meteo API, meaning no Home Assistant and no API keys are required.

✨ Features

  • Smart App Loop (Auto-Hide): The app stays hidden (skipped in the background) for most of the day. It only injects itself into your AWTRIX app rotation when a sunrise or sunset is imminent (e.g., exactly 30 minutes before it happens).

  • Live Countdown: Displays a dynamic countdown in minutes (e.g., 15M) perfectly centered next to your chosen icon.

  • Zero Registration: Uses the open-meteo.com API, which works out of the box using just your GPS coordinates.

  • Built-in Test Mode: Includes a toggle to force the app to appear immediately on your screen, making it easy to test your icons and settings without waiting for the actual sunset.

⚙️ Configuration

Navigate to Apps -> Settings (next to the script name) in your AWTRIX WebUI to configure the following parameters:

  • lat & lon (number): Your exact Latitude and Longitude for accurate sun event calculations.

  • minutes (number): The alert threshold. This dictates how many minutes before the sunrise/sunset the app should start appearing in your rotation (Default: 30, Range: 5–120).

  • duration (number): How long the app stays on the screen per cycle, in milliseconds (Default: 10000 / 10 seconds).

  • icon_rise (text): The AWTRIX Icon ID to display during a sunrise (Default: 2893).

  • icon_set (text): The AWTRIX Icon ID to display during a sunset (Default: 53384).

  • test_mode (bool): Toggle this to true to bypass the timer and force the app to display immediately. Remember to set it back to false for normal operation!

💡 How it works

The script fetches the daily sunrise and sunset UNIX timestamps once an hour to keep the API load extremely low. Every second, it checks the local device time against these timestamps. Once the remaining time drops below your configured minutes threshold, the app automatically activates and starts counting down.

More scripts in Smarthome

Something wrong with this script? Report it.