Hi,
Here is a recipe allowing you to change page, display a specific page, the hidden pages and stop the rotation with MMM-GA and MMM-Pages.
This recipe works with MMM-GA V2 and V3.
/** MMM-Pages **/
/** vocal control **/
/** Thanks @bugsounet **/
/** 10/06/2021 **/
var recipe = {
transcriptionHooks: {
"PAGE_INCREMENT": {
pattern: "page suivante", // "next page"
command: "PAGE_INCREMENT"
},
"PAGE_DECREMENT": {
pattern: "page précédente", // "previous page"
command: "PAGE_DECREMENT"
},
"PAUSE_ROTATION": {
pattern: "pause rotation",
command: "PAUSE_ROTATION"
},
"RESUME_ROTATION": {
pattern: "reprend rotation",
command: "RESUME_ROTATION"
},
"SHOW_HIDDEN_PAGE": {
pattern: "affiche les paramètres", // I have juste one page hidden, you can have several
command: "SHOW_HIDDEN_PAGE"
},
"LEAVE_HIDDEN_PAGE": {
pattern: "quitte les paramètres",
command: "LEAVE_HIDDEN_PAGE"
},
"HORLOGE": {
pattern: "affiche l'horloge", // I grouped the module by theme in the same page
command: "HORLOGE" // to name them easly, first page : big horloge, weather of the day and MMM-Saint
}, // 2nd page : 3 Calendar, Alarm, MMM-Traffic...
"PLANNING": { // 3th page : 3 weather modules (rain probability, forecast per day and 5 days forecast)
pattern: "affiche le planning", // 4th page : 4 news modules
command: "PLANNING" // for example
},
"METEO": {
pattern: "affiche la météo",
command: "METEO"
},
"INFORMATION": {
pattern: "affiche les informations",
command: "INFORMATION"
}
},
commands: {
"PAGE_INCREMENT": {
moduleExec: {
module: (param) => {
this.sendNotification("PAGE_INCREMENT");
}
},
},
"PAGE_DECREMENT": {
moduleExec: {
module: (param) => {
this.sendNotification("PAGE_DECREMENT");
}
},
},
"PAUSE_ROTATION": {
moduleExec: {
module: (param) => {
this.sendsocketNotification("PAUSE_ROTATION","");
},
},
},
"RESUME_ROTATION": {
moduleExec: {
module: (param) => {
this.sendNotification("RESUME_ROTATION", "");
},
},
},
"SHOW_HIDDEN_PAGE": {
moduleExec: {
module: (param) => {
this.sendNotification("SHOW_HIDDEN_PAGE","admin"); // You can have several hidden pages, just change the payload with
}, // the same name of your hidden page in the MMM-Pages config in config.js file
},
},
"LEAVE_HIDDEN_PAGE": {
notificationExec: {
notification: "LEAVE_HIDDEN_PAGE",
payload: "admin",
},
},
"HORLOGE": {
moduleExec: {
module: (param) => { // Home_page is my page 0 indicated in the MMM-Pages config in config.js file
},
},
},
"PLANNING": {
notificationExec: { // you can have as many pages as you want, just edit the payload with number page
notification: "PAGE_CHANGED",
payload: 1,
},
},
"METEO": {
notificationExec: {
notification: "PAGE_CHANGED",
payload: 2,
},
},
"INFORMATIONS": {
notificationExec: {
notification: "PAGE_CHANGED",
payload: 3,
},
},
},
}
exports.recipe = recipe
Copy / paste this code into a .JS file and modify it according to your wishes.
Save your recipe file, it should locate in recipes directory.
Then, you can configure your config.js
},
recipes: ["ExtRadio_fr.js", "with-MMM-pages1.js"],
}
I thank Bugsounet, without its modules and tutorial I would not have been able to make this recipe.
Enjoy