edward-shen / MMM-pages

Add pages to your MagicMirror²!
MIT License
109 stars 29 forks source link

Pause rotation not working #50

Closed pereirageomet closed 3 years ago

pereirageomet commented 4 years ago

I am trying to use your module, but I am not able to pause rotation. I have tried to send notifications from the module Touch_Swipe, or from Remote-Control, but it does not work. Basically the notification that it send is: self.sendNotification('PAUSE_ROTATION', '')

My setup is: { module: 'MMM-pages', config: { modules: [ ["MMM-CalendarExt2"], ["MMM-Trello"], ["MMM-EveryNews"], ["MMM-Weather"], ["MMM-Fuel","MMM-DWD-WarnWeather","MMM-COVID19-AMPEL"] ], fixed: ["clock","MMM-TouchSwipe","MMM-OnScreenMenu","MMM-BurnIn",'MMM-Remote-Control'], hiddenPages: { "screenSaver": [ "clock" ], "admin": [ "MMM-OnScreenMenu" ,"MMM-TouchSwipe","MMM-BurnIn",'MMM-Remote-Control'], }, homePage:0, rotationHomePage:0, rotationTime: 1000 60 .25 } },

Thank you for your help!

edward-shen commented 4 years ago

Please upload your full config, as what you have provided is insufficient to determine if this is a bug or not.

pereirageomet commented 4 years ago

Thanks for your help! The code: / Magic Mirror Config Sample

edward-shen commented 4 years ago

You mentioned that you're effectively sending the message self.sendNotification('PAUSE_ROTATION', '')? How are you doing so for MMM-remote-control and MMM-touchswipe? Does the MMM-OnScreenMenu pause rotation work? Can you link me to MMM-touchswipe as well?

edward-shen commented 3 years ago

I'm closing this issue due to old age. Please feel free to reopen this issue if you still have a problem.

djtale commented 3 years ago

Hello,

I'm reopening this issue because I'm facing the same with MMM-TelegramBot which now accepts customCommands.

I have added this to TelegramBot config : module: 'MMM-TelegramBot', position: 'top_center', config: { telegramAPIKey : 'xxxxx', allowedUser : ['xxxx'], // This is NOT the username of bot. adminChatId : xxxxxx, useWelcomeMessage: true, TelegramBotServiceAlerte: true, dateFormat: "DD-MM-YYYY HH:mm:ss", customCommands: [ { command: "pause", description: "Stop la rotation automatique", callback: (command, handler, self) => { self.sendNotification("PAUSE_ROTATION") handler.reply("TEXT", "OK, rotation arretée") } }, ], }

When I send the command /pause to my bot through Telegram, the rotation doesn't stop. I have used PAGE_INCREMENT, PAGE_DECREMENT and PAGE_CHANGED and those notifications are working fine.

Please let me know if you need anything else to investigate. Thanks

edward-shen commented 3 years ago

Can you post your console logs as well—the one with [Pages]: messages.

djtale commented 3 years ago

Here is the log. I hope it will help :

[Pages]: pause notification received! MMM-Console.js:75 [Pages]: Was asked to pause but rotation is already paused! warn @ MMM-Console.js:75 setRotation @ MMM-pages.js:285 notificationReceived @ MMM-pages.js:127 sendNotification @ main.js:99 sendNotification @ main.js:538 sendNotification @ module.js:374 callback @ config.js:139 parseCommand @ MMM-TelegramBot.js:630 socketNotificationReceived @ MMM-TelegramBot.js:839 (anonymous) @ module.js:250 (anonymous) @ socketclient.js:39 r.emit @ index.js:83 r.onevent @ index.js:83 MMSocket.self.socket.onevent @ socketclient.js:33 r.onpacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.ondecoded @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 a.add @ index.js:83 r.ondata @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 r.onData @ index.js:83 ws.onmessage @ index.js:83 MMM-Console.js:67 MMM-Admin-Interface received a module notification: PAGE_INCREMENT from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification to increment pages! MMM-Console.js:67 MMM-pages is suspended. MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages MMM-Console.js:67 MMM-Admin-Interface received a module notification: PAGE_INCREMENT from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification to increment pages! MMM-Console.js:67 MMM-pages is suspended. MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification to increment pages! MMM-Console.js:67 MMM-pages is suspended. MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages MMM-Console.js:67 [Pages]: pause notification received! MMM-Console.js:75 [Pages]: Was asked to pause but rotation is already paused! warn @ MMM-Console.js:75 setRotation @ MMM-pages.js:285 notificationReceived @ MMM-pages.js:127 sendNotification @ main.js:99 sendNotification @ main.js:538 sendNotification @ module.js:374 callback @ config.js:139 parseCommand @ MMM-TelegramBot.js:630 socketNotificationReceived @ MMM-TelegramBot.js:839 (anonymous) @ module.js:250 (anonymous) @ socketclient.js:39 r.emit @ index.js:83 r.onevent @ index.js:83 MMSocket.self.socket.onevent @ socketclient.js:33 r.onpacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.ondecoded @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 a.add @ index.js:83 r.ondata @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 r.onData @ index.js:83 ws.onmessage @ index.js:83 MMM-Console.js:67 MMM-Admin-Interface received a module notification: PAGE_INCREMENT from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification to increment pages! MMM-Console.js:67 MMM-pages is suspended. MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages

edward-shen commented 3 years ago

Something is telling MMM-pages to increment pages, which automatically restarts the rotation I believe. Are you sure nothing else is resuming it?

djtale commented 3 years ago

Hi Edward,

I'm sure of it. I am using the MMM-Simple-Swiper module to change page manually with detectors but I'm monitoring it and I'm sure it is not that plugin that is incrementing the page.

From the logs above, you can see the pause is indeed recognized : MMM-Console.js:67 MMM-pages is suspended.

I believe the increment comes from : MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages!

The only location where I see NEW_PAGE is in the DOM_OBJECTS_CREATED option : case 'DOM_OBJECTS_CREATED': Log.log('[Pages]: received that all objects are created;'

And in MMM-page-indicator, I see this : } else if (notification === 'MAX_PAGES_CHANGED') { Log.log(${this.name} received a notification to change the maximum number of pages to ${payload}); this.config.pages = payload; if (payload - 1 < this.curPage) { this.curPage = payload - 1; } this.updateDom();

I have even disabled the swiper module to make sure. Still I see those logs : [Pages]: Was asked to pause but rotation is already paused! warn @ MMM-Console.js:75 setRotation @ MMM-pages.js:285 notificationReceived @ MMM-pages.js:127 sendNotification @ main.js:99 sendNotification @ main.js:538 sendNotification @ module.js:374 callback @ config.js:139 parseCommand @ MMM-TelegramBot.js:630 socketNotificationReceived @ MMM-TelegramBot.js:839 (anonymous) @ module.js:250 (anonymous) @ socketclient.js:39 r.emit @ index.js:83 r.onevent @ index.js:83 MMSocket.self.socket.onevent @ socketclient.js:33 r.onpacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.ondecoded @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 a.add @ index.js:83 r.ondata @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 (anonymous) @ index.js:83 r.emit @ index.js:83 r.onPacket @ index.js:83 r.onData @ index.js:83 ws.onmessage @ index.js:83 29MMM-Console.js:67 MMM-Admin-Interface received a module notification: CLOCK_SECOND from sender: clock MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEWS_FEED from sender: newsfeed 7MMM-Console.js:67 MMM-Admin-Interface received a module notification: CLOCK_SECOND from sender: clock 2MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEWS_FEED_UPDATE from sender: newsfeed 2MMM-Console.js:67 MMM-Admin-Interface received a module notification: CLOCK_SECOND from sender: clock MMM-Console.js:67 MMM-Admin-Interface received a module notification: CLOCK_MINUTE from sender: clock MMM-Console.js:67 MMM-Admin-Interface received a module notification: PAGE_INCREMENT from sender: MMM-pages MMM-Console.js:67 MMM-page-indicator recieved a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification to increment pages!

I'll continue to look into my modules if I see anything.

djtale commented 3 years ago

It seems like the notification for INCEMENT is coming from resetTimerWithDelay method. I have added a log in that method

MMM-page-indicator received a notification to increment pages! MMM-Console.js:67 [Pages]: received a notification from method resetTimerWithDelay to leave the current hidden page MMM-Console.js:67 [Pages]: received a notification to increment pages! MMM-Console.js:67 MMM-pages is suspended. MMM-Console.js:67 MMM-Admin-Interface received a module notification: NEW_PAGE from sender: MMM-pages

soubhik-khan commented 2 years ago

+1 to this issue. I'm using MQTT broker. All other notification commands are working excpt PAUSE_ROTATION.