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
modules
folder and execute:
git clone https://github.com/skuethe/MMM-RandomPhoto.git && cd MMM-RandomPhoto
- Install the node dependencies:
npm install
The entry in config.js
can include the following options:
Option | Description |
---|---|
imageRepository |
Optional - The image source. Type: string Allowed: picsum , nextcloud , localdirectory Default: 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: boolean Default: true |
width |
Optional - The width of the image in px. Only used when imageRepository is set to picsum Type: int Default: 1920 |
height |
Optional - The height of the image in px. Only used when imageRepository is set to picsum Type: int Default: 1080 |
grayscale |
Optional - Should the image be grayscaled? Type: boolean Default: false |
blur |
Optional - Should the image be blurred? Type: boolean Default: false |
blurAmount |
Optional - If you want to blur it, how much? Type: int Allowed: minimum: 0 , maximum: 10 Default 1 |
opacity |
Optional - The opacity of the image. Type: double Default: 0.3 |
animationSpeed |
Optional - How long the fade out and fade in of photos should take. Type: int Default: 500 |
updateInterval |
Optional - How long before getting a new image. Type: int Default: 60 seconds |
startHidden |
Optional - Should the module start hidden? Useful if you use it as a "screensaver" Type: boolean Default: false |
startPaused |
Optional - Should the module start in "paused" (automatic image loading will be paused) mode? Type: boolean Default: false |
showStatusIcon |
Optional - Do you want to see the current status of automatic image loading ("play" / "paused" mode)? Type: boolean Default: true |
statusIconMode |
Optional - Do you want to display the icon all the time or just fade in and out on status change? Type: string Allowed: show or fade Default: show |
statusIconPosition |
Optional - Where do you want to display the status icon? Type: string Allowed: top_right , top_left , bottom_right or bottom_left Default: 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: string Default: https://picsum.photos/ |
username |
Required for nextcloud with basic auth - The username if images require basic authentication. Type: string Default: `` |
password |
Required for nextcloud with basic auth - The password if images require basic authentication. Type: string Default: `` |
recursive |
Optional for localdirectory - Search recursive for images in path. Type: boolean Default: false |
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,
},
}
},
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.