This a module for the MagicMirror². It will show a (random) photo from any of these sources:
- picsum.photos
- a share of any nextcloud instance
- a local directory on the Raspberry Pi
- Navigate into your MagicMirror's
modulesfolder and execute:
git clone https://github.com/skuethe/MMM-RandomPhoto.git && cd MMM-RandomPhoto- Install the node dependencies:
npm installThe entry in config.js can include the following options:
| Option | Description |
|---|---|
imageRepository |
Optional - The image source. Type: stringAllowed: picsum, nextcloud, localdirectoryDefault: picsum |
repositoryConfig |
Optional - The configuration block for the selected image repository. See below. Type: Object |
random |
Optional - Should the images be shown at random? Has NO effect when imageRepository is set to picsum, as it is forced there.Type: booleanDefault: true |
width |
Optional - The width of the image in px. Only used when imageRepository is set to picsumType: intDefault: 1920 |
height |
Optional - The height of the image in px. Only used when imageRepository is set to picsumType: intDefault: 1080 |
grayscale |
Optional - Should the image be grayscaled? Type: booleanDefault: false |
blur |
Optional - Should the image be blurred? Type: booleanDefault: false |
blurAmount |
Optional - If you want to blur it, how much? Type: intAllowed: minimum: 0, maximum: 10Default 1 |
opacity |
Optional - The opacity of the image. Type: doubleDefault: 0.3 |
animationSpeed |
Optional - How long the fade out and fade in of photos should take. Type: intDefault: 500 |
updateInterval |
Optional - How long before getting a new image. Type: intDefault: 60 seconds |
startHidden |
Optional - Should the module start hidden? Useful if you use it as a "screensaver" Type: booleanDefault: false |
startPaused |
Optional - Should the module start in "paused" (automatic image loading will be paused) mode? Type: booleanDefault: false |
showStatusIcon |
Optional - Do you want to see the current status of automatic image loading ("play" / "paused" mode)? Type: booleanDefault: true |
statusIconMode |
Optional - Do you want to display the icon all the time or just fade in and out on status change? Type: stringAllowed: show or fadeDefault: show |
statusIconPosition |
Optional - Where do you want to display the status icon? Type: stringAllowed: top_right, top_left, bottom_right or bottom_leftDefault: top_right |
Options for repositoryConfig - more information:
| Option | Description |
|---|---|
path |
Required for nextcloud and localdirectory - Path / URL to fetch images from. - if imageRepository is set to picsum it is ignored- if imageRepository is set to nextcloud it has to point to your nextcloud instance's specific share path- if imageRepository is set to localdirectory it has to point to a local PathType: stringDefault: https://picsum.photos/ |
username |
Required for nextcloud with basic auth - The username if images require basic authentication. Type: stringDefault: `` |
password |
Required for nextcloud with basic auth - The password if images require basic authentication. Type: stringDefault: `` |
recursive |
Optional for localdirectory - Search recursive for images in path. Type: booleanDefault: false |
exclude |
Optional for localdirectory - Exclude matching regex files. Type: listDefault: [] |
Here are some examples for entries in config.js
picsum:
{
module: 'MMM-RandomPhoto',
position: 'fullscreen_below',
config: {
imageRepository: "picsum",
repositoryConfig: {
},
width: 1920,
height: 1080,
grayscale: true,
startHidden: true,
showStatusIcon: true,
statusIconMode: "show",
statusIconPosition: "top_right",
}
},NextCloud:
Hint: Create a "device secret" for accessing a share behind basic authentication.
{
module: 'MMM-RandomPhoto',
position: 'fullscreen_below',
config: {
imageRepository: "nextcloud",
repositoryConfig: {
path: "https://YOUR.NEXTCLOUD.HOST/remote.php/dav/files/USERNAME/PATH/TO/DIRECTORY/",
username: "USERNAME",
password: "YOURDEVICESECRET",
},
grayscale: true,
startPaused: true,
showStatusIcon: true,
}
},local directory:
{
module: 'MMM-RandomPhoto',
position: 'fullscreen_below',
config: {
imageRepository: "localdirectory",
repositoryConfig: {
path: "/home/USER/pictures/background/",
recursive: true,
exclude: ["tmp", "#recycle"],
},
}
},You can control this module by sending specific notifications. See the following list:
| Option | Description |
|---|---|
RANDOMPHOTO_NEXT |
Don't wait for updateInterval to trigger and immidiately show the next imageRespects the current state of automatic image loading |
RANDOMPHOTO_PREVIOUS |
Show the previous image. Only works if config.random is set to false and imageRepository is NOT set to picsum |
RANDOMPHOTO_TOGGLE |
Toggle the state of automatic image loading ("play" / "pause" mode) |
RANDOMPHOTO_PAUSE |
Pause the loading of new images |
RANDOMPHOTO_RESUME |
Resume the loading of new images |
Thinking about implementing the following things:
- possibility to show the EXIF comment from each image on screen (target selectable)
- ...
- jQuery (installed via
npm install)
- Michael Teeuw for creating the awesome MagicMirror² project that made this module possible.
- Diego Vieira for initially creating this module.