Skip to content

A MagicMirror module to show local sunrise/sunset/noon times

Notifications You must be signed in to change notification settings

cgillinger/MMM-Sunrise-Sunset

 
 

Repository files navigation

MMM-Sunrise-Sunset

A MagicMirror module to display local sunrise and sunset times.

This module is an extension of the MagicMirror project, allowing users to display sunrise and sunset times with flexible configuration options.


Features

  • Displays sunrise and sunset times.
  • Supports optional display of moonrise, moonset, solar noon, and day length.
  • Two layout options: "inline" or "list".
  • Fetches data from IP Geolocation API.

Installation

  1. Navigate to your MagicMirror modules folder:

    cd ~/MagicMirror/modules
  2. Clone the repository:

    git clone https://github.com/cgillinger/MMM-Sunrise-Sunset.git
  3. Navigate to the module folder:

    cd MMM-Sunrise-Sunset
  4. Install dependencies:

    npm install

Configuration

Add the following configuration block to the modules array in your config/config.js file.

Example Configuration for Sunrise and Sunset Only

{
    module: "MMM-Sunrise-Sunset",
    position: "bottom_left",
    config: {
        latitude: 59.3293,  // Latitude for Stockholm
        longitude: 18.0686, // Longitude for Stockholm
        apiKey: "YOUR_API_KEY_HERE", // API key
        layout: "list",   // Use list layout
        showSunrise: true,  // Display sunrise time
        showSunset: true,   // Display sunset time
        showMoonrise: false, // Hide moonrise time
        showMoonset: false,  // Hide moonset time
        showNoon: false,     // Hide solar noon time
        showDaylength: false, // Hide day length
        timeFormat: 24       // Use 24-hour format
    }
}

Options

Option Description
latitude Your local latitude (e.g., "59.3293" for Stockholm). Required.
longitude Your local longitude (e.g., "18.0686" for Stockholm). Required.
apiKey API key from IP Geolocation. Required.
layout Choose between "inline" or "list".
showSunrise Show sunrise time. Default: true.
showSunset Show sunset time. Default: true.
showMoonrise Show moonrise time. Default: true.
showMoonset Show moonset time. Default: true.
showNoon Show solar noon time. Default: true.
showDaylength Show day length. Default: true.
timeFormat Use 12 for 12-hour format or 24 for 24-hour format. Default: 24.

Troubleshooting

Fix for "Loading..." Issue

If the module gets stuck on "Loading...", ensure the following:

  1. Install jQuery:

    npm install jquery
  2. Copy jquery.js to the module folder:

    cp ./node_modules/jquery/dist/jquery.js .
  3. Restart MagicMirror:

    npm start

If the problem persists, open an issue on the GitHub repository.


License

This module is licensed under the MIT License.

About

A MagicMirror module to show local sunrise/sunset/noon times

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.6%
  • CSS 19.4%