edward-shen/MMM-pages

Pause rotation not working

pereirageomet opened this issue · 11 comments

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!

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

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

/
var config = {
address: "0.0.0.0", // Address to listen on, can be:
// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
// - another specific IPv4/6 to listen on a specific interface
// - "0.0.0.0", "::" to listen on any interface
// Default, when address config is left out or empty, is "localhost"
port: 8080,
basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy
// you must set the sub path here. basePath must end with a /
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.2.1/120", "192.168.2.1/24"], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
useHttps: false, // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true
language: "en",
logLevel: ["INFO", "LOG", "WARN", "ERROR"],
timeFormat: 24,
units: "metric",
// serverOnly: true/false/"local" ,
// local for armv6l processors, default
// starts serveronly and then starts chrome browser
// false, default for all NON-armv6l devices
// true, force serveronly mode, because you want to.. no UI on this device
modules: [
{
module: "alert",
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_center"
},
{
module: 'MMM-OnScreenMenu',
position: 'top_right',
/
Valid positions: 'top_right', 'top_left', 'bottom_right', 'bottom_left' /
config: {
touchMode: true,
enableKeyboard: false,
pm2ProcessName: "MagicMirror",
menuItems: {
//monitorOff: { title: "Turn Off Monitor", icon: "television", source: "SERVER" },
notify1: { title: "Pause",
icon: "eye",
notification: "PAUSE_ROTATION",
payload: '' },
restart: { title: "Restart MagicMirror", icon: "refresh", source: "ALL" },
minimize: { title: "Minimize MagicMirror", icon: "chevron-down", source: "ALL" },
reboot: { title: "Reboot", icon: "spinner" },
shutdown: { title: "Shutdown", icon: "power-off" }
},
}
},
{
module: "MMM-Weather",
position: "middle_center",
configDeepMerge: true,
config:
{
updateInterval: "15m", // 15 minutes
api:
{
key: "xxx",
latitude: ,
longitude: ,
},
display:
{
CurrentConditions: true,
ExtraCurrentConditions: true,
Summary: true,
ForecastTableColumnHeaderIcons: true,
HourlyForecast: true,
DailyForecast: true,
Precipitation: true,
Wind: true,
InlineIcons: true,
Feels: true,
SunCondition: true,
Humidity: true,
UV: false,
Beaufort: true
},
personalize:
{
hourlyForecastInterval: 2,
maxHourliesToShow: 4,
maxDailiesToShow: 2,
concise: false,
colored: true,
forecastLayout: "table",
forecastHeaderText: ""
}
}
},
{
module: "MMM-Fuel",
position: "middle_center",
config:
{
api_key: "xxx",
lat: xxx,
lng: xxx,
types: ["e10"],
max: 2,
showOpenOnly: true
}
},
{
module: "MMM-DWD-WarnWeather",
position: 'middle_center',
header: "Weather warnings",
config:
{
region: "xxx",
changeColor: true,
minutes: false,
displayRegionName: true,
displayInnerHeader: true,
interval: 10 * 60 * 1000, // every 10 minutes
loadingText: "Loading...",
noWarningText: "No weather warnings",
severityThreshold: 1,
displayInnerHeader: false
}
},
{
module: "MMM-COVID19-AMPEL",
position: "middle_center",
config:
{
header: "COVID-19 Inzidenzwert", // Header Title of Display on MagicMirror
cityID: ["xxx"],
infoRowClass: "small", // small, medium
updateInterval: 7200000, // update interval in milliseconds // 1 Hour - Values are only refreshed every 24 H on Server
fadeSpeed: 4000,
numberOfDigits: 1,
showDeathRatePerPeople: false,
showStatusLightLeft: false
}
},
{
module: 'MMM-CalendarExt2',
config:
{
rotateInterval: 1000 * 60,
defaultSet:
{
view:
{
hideOverflow: true,
}
},
calendars: [
{
name: "",
icon: "noto-boy-light-skin-tone",
className: "lucas",
url: "",
},
{
name: "",
icon: "noto-detective-light-skin-tone",
className: "phd",
url: "",
},
{
name: "Birthdays",
icon: "noto-wrapped-gift",
className: "bday",
url: "",
},
{
name: "sachsen",
icon: "noto-beach-with-umbrella",
className: "holiday",
url: "",
}, ],
views: [
{
name: "cur",
mode: "current",
type: "row",
calendars: [],
position: "middle_center",
slotMaxHeight: "120%",
useEventTimeRelative: true,
slotTitle: "Ongoing",
maxItems: 4,
},
{
name: "upc",
mode: "upcoming",
type: "row",
calendars: [],
position: "middle_center",
slotMaxHeight: "120%",
useEventTimeRelative: false,
slotTitle: "Up next",
maxItems: 6,
filterPassedEvent: false,
}],
scenes: [
{
name: "DEFAULT",
views: ["cur", "upc"],
}],
},
},
{
disabled: false,
module: 'MMM-EveryNews',
position: 'middle_center',
config:
{
source: 'bbc-news,associated-press,globo,le-monde,the-washington-post,google-news,reuters', // any source from https://newsapi.org/sources. // Up to 10 at once
scroll: false, // description scroll or static
//scrollSpeed: "3", // if scroll is true
apiKey: '"', // free API key from https://newsapi.org/register
useHeader: false, // False if you don't want a header
header: "News", // Any text you want. useHeader must be true
maxWidth: "100%",
animationSpeed: 2000, // fade speed
rotateInterval: 1 * 30 * 1000,
}
},
{
module: "MMM-TouchSwipe",
position: "bottom_bar",
config:
{}
},
{
module: 'MMM-Remote-Control',
// uncomment the following line to show the URL of the remote control on the mirror
// position: 'bottom_left',
// you can hide this module afterwards from the remote control itself
config:
{
customCommand:
{}, // Optional, See "Using Custom Commands" below
showModuleApiMenu: false, // Optional, Enable the Module Controls menu
// uncomment any of the lines below if you're gonna use it
// customMenu: "custom_menu.json", // Optional, See "Custom Menu Items" below
// apiKey: "", // Optional, See API/README.md for details
}
},
{
module: 'MMM-Trello',
position: 'middle_center', // This can be any of the regions, best results in center regions.
config:
{
// See 'Configuration options' for more information.
api_key: "",
token: "",
list: "",
updateInterval: 0.5 * 60 * 1000,
showChecklists: true,
wholeList: true,
}
},
{
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 * 5
}
},
{
module: "MMM-BurnIn",
position: "bottom_bar", // whatever, doesn't render anything
config:
{
updateInterval: 10 // in Minutes
}
}
]
};
/
************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined")
{
module.exports = config;
}

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?

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

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

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

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

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

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;'
+ ' will now hide things!');
this.sendNotification('MAX_PAGES_CHANGED', this.config.modules.length);
this.sendNotification('NEW_PAGE', this.curPage);
this.animatePageChange();
this.resetTimerWithDelay(0);
break;

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.

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

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