Skip to content

Magic Mirror Module displaying the last Astronomy Picture Of the Day (APOD) and using NASA API

License

Notifications You must be signed in to change notification settings

grenagit/MMM-APOD

Repository files navigation

Module: MMM-APOD

This module displays the last Astronomy Picture Of the Day (APOD), including media (image or video), title, description and copyright.

The max-height and max-width of the media can be fixed. Title and description display may be enabled or disabled independently. Description can be shorted and lenght can be fixed.

MMM-APOD Screenshot #1 MMM-APOD Screenshot #2 MMM-APOD Screenshot #3

MMM-APOD can be used to display the image in the background of MagicMirror² with position: "fullscreen_below"! Overlay image can be customized.

MMM-APOD Screenshot #4

MagicMirror² on Github | APOD on NASA

Installation

In your terminal, go to your MagicMirror's Module folder:

cd ~/MagicMirror/modules

Clone this repository:

git clone https://github.com/grenagit/MMM-APOD

Configure the module in your config.js file.

Update

In your terminal, go to your MMM-APOD's Module folder:

cd ~/MagicMirror/modules/MMM-APOD

Incorporate changes from this repository:

git pull

Configuration

Basic configuration

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: "MMM-APOD",
		position: "top_left",
		config: {
			appid: "abcde12345abcde12345abcde12345ab" // NASA API key (api.nasa.gov)
		}
	}
]

You can use the special DEMO_KEY API Key for your tests but it has much lower rate limits !

Options

The following properties can be configured:

Option Description
appid The NASA API key, which can be obtained by signing up on NASA API portal. It's free!

This value is REQUIRED
updateInterval How often does the content needs to be fetched? (Milliseconds)

Possible values: 1000 - 86400000
Default value: 6 * 60 * 60 * 1000 (6 hours)
animationSpeed Speed of the update animation. (Milliseconds)

Possible values:0 - 5000
Default value: 1000 (1 second)
maxMediaWidth Maximum width for media display. If set to 0, the media's actual width is used. (Pixels)

Possible values:0 - 5000
Default value: 0 (media's width)
maxMediaHeight Maximum height for media display. If set to 0, the media's actual height is used. (Pixels)

Possible values:0 - 5000
Default value: 0 (media's height)
maxDescriptionLength Maximum length for short description display.
Default value: 200
backgroundSize Size of the background image CSS property.

Possible values: 'contain', 'cover'
Default value: 'cover'
backgroundPosition Position of the background image CSS property.

Possible values: 'top', 'bottom', 'left', 'right', 'center'
Default value: 'center'
backgroundOverlay Overlay of the background image CSS property.

Possible values: 'rgba(0, 0, 0, 0.5)'
Default value: 'linear-gradient(to bottom, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0) 80%, rgba(0, 0, 0, 0.75) 100%)'
showTitle Show the title.

Possible values: true or false
Default value: true
showDescription Show the description.

Possible values: true or false
Default value: false
useShortDescription Short the description.

Possible values: true or false
Default value: true
initialLoadDelay The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)

Possible values: 1000 - 5000
Default value: 0
retryDelay The delay before retrying after a request failure. (Milliseconds)

Possible values: 1000 - 60000
Default value: 2500
apiBase The NASA API base URL.

Default value: 'https://api.nasa.gov/'
apodEndpoint The APOD API endPoint.

Default value: 'planetary/apod'

Todo

  • Create a function to summarize the description
  • Add an error message if the rate limit is exceeded.

License

This module is licensed under the MIT License

About

Magic Mirror Module displaying the last Astronomy Picture Of the Day (APOD) and using NASA API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published