Skip to content

Commit dba861b

Browse files
committed
Minor update so ensure clients connect back if the server is restarted.
1 parent c42090d commit dba861b

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

MMM-ImmichSlideShow.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,23 @@ Module.register('MMM-ImmichSlideShow', {
315315
}
316316
} else if (notification === 'IMMICHSLIDESHOW_FILELIST') {
317317
// bubble up filelist notifications
318-
// this.sendSocketNotification('IMMICHSLIDESHOW_FILELIST', payload);
319318
this.imageList = payload;
320319
// Log.debug (LOG_PREFIX + " >>>>>>>>>>>>>>> IMAGE LIST", JSON.stringify(payload));
321320
} else if (notification === 'IMMICHSLIDESHOW_DISPLAY_IMAGE') {
322321
// check this is for this module based on the id
323322
if (payload.identifier === this.identifier) {
324323
Log.debug(LOG_PREFIX + 'Displaying current image', payload.path);
324+
// Create an interval timer that if not called will attempt to establish configuration again.
325+
// Apparently, the socket will keep retrying until it connects, so we only need to reattempt once.
326+
if (!!this.resyncTimeout) {
327+
console.log('this.resyncTimeout', this.resyncTimeout);
328+
clearTimeout(this.resyncTimeout);
329+
}
330+
const me = this;
331+
this.resyncTimeout = setTimeout(() => {
332+
console.log('Re-registering to make sure images change...')
333+
me.updateImageList();
334+
}, me.config.slideshowSpeed+me.config.immichTimeout);
325335
this.displayImage(payload);
326336
}
327337
} else if (notification === 'IMMICHSLIDESHOW_REGISTER_CONFIG') {

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ This module will require the URL of your Immich instance and your API Key at a m
1818

1919
Extra configurations include setting the amount of time an image is shown for, selecting which file extensions are valid, the transition speed from one image to another, the background sizing, and whether or not to animate the transition from one to the other.
2020

21+
**Note:** This module attempts to sync all of its clients (i.e. display the same image on all clients), so the images are pushed from the server to the client. Version 1.0.0+ ensures that if the server is restarted, the clients connect back.
22+
2123
## Using the module
2224

2325
Use Git to download. Make sure Git is installed on your system. In the command line/terminal, go to the modules directory of the your Magic Mirror install. run: `git clone https://github.com/pelaxa/MMM-ImmichSlideShow.git`. The advantage of using Git is when there is an update, you can run `git pull` and it will pull down all the updates. Magic Mirror can even let you know when there are updates.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmm-immichslideshow",
3-
"version": "0.10.1",
3+
"version": "1.0.0",
44
"description": "A plugin for MagicMirror2 to show slideshows from Immich",
55
"author": "Pelaxa Inc.",
66
"license": "MIT",

0 commit comments

Comments
 (0)