Bugsounet Coding

    • Register
    • Login
    • Search
    This Forum is now reserved to registred users!

    [GA-RECIPE] MMM-Pages

    Recipes
    6
    12
    568
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Graingallet BetaTester last edited by

      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

      1 Reply Last reply Reply Quote 1
      • C
        CalcU BetaTester last edited by

        thanks! this will work with Jarvis, now i can changes with it too.

        G 1 Reply Last reply Reply Quote 0
        • D
          DJB1966 Helpers last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • D
            DJB1966 Helpers last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • G
              Graingallet BetaTester @CalcU last edited by

              @calcu Nice ! 😊

              1 Reply Last reply Reply Quote 0
              • D
                DJB1966 Helpers last edited by DJB1966

                @ Graingallet
                Have trouble with changing back to home page 0 how would i go about it here is my config file.

                {
                                        module: 'MMM-pages',
                			disabled: false,
                                        config: {
                                                modules:
                                                     [["clock", "newsfeed", "compliments", "MMM-GoogleAssistant", "MMM-Detector", "MMM-Globe"],
                				     ["weather_plus", "MMM-OpenWeatherMapForecast", "MMM-HTMLSnippet"],
                				     ["MMM-CalendarExt2", 'MMM-MyWastePickup'],
                				     ["MMM-NowPlayingOnSpotify"],
                				     ["MMM-Todoist"],
                				     ["MMM-AVStock"]],    
                                                fixed: ["MMM-page-indicator", "MMM-GoogleAssistant"],
                				hiddenPages: {
                                                    "admin": ["clock", "MMM-NowPlayingOnSpotify", "MMM-CalendarExt2"],
                                                    "test": []
                				},    
                                        }
                                },
                

                and recipe

                /**  MMM-Pages **/
                /** vocal control **/
                /** Thanks @bugsounet  **/
                /** 10/06/2021 **/
                
                var recipe = {
                  transcriptionHooks: {
                    "PAGE_INCREMENT": {
                      pattern: "next page",           // "next page"
                      command: "PAGE_INCREMENT"
                    },
                    "PAGE_DECREMENT": {
                      pattern: "previous page",         // "previous page"
                      command: "PAGE_DECREMENT"
                    },
                    "PAUSE_ROTATION": {
                      pattern: "pause my rotation",
                      command: "PAUSE_ROTATION"
                    },
                    "RESUME_ROTATION": {
                      pattern: "resumes my rotation",
                      command: "RESUME_ROTATION"
                    },
                    "SHOW_HIDDEN_PAGE": {   
                      pattern: "show parameters",    // I have juste one page hidden, you can have several 
                      command: "SHOW_HIDDEN_PAGE"
                    },
                    "LEAVE_HIDDEN_PAGE": {
                      pattern: "exit settings",
                      command: "LEAVE_HIDDEN_PAGE"
                    },
                    "CLOCK": {
                      pattern: "displays the clock",          // I grouped the module by theme in the same page
                      command: "CLOCK"                     // to name them easly, first page : big horloge, weather of the day and MMM-Saint
                    },                                       //                     2nd page : 3 Calendar, Alarm, MMM-Traffic...                        
                    "CALENDAR": {                            //                     3th page : 3 weather modules (rain probability, forecast per day and 5 days forecast)
                      pattern: "display work calendar",        //                     4th page : 4 news modules
                      command: "CALENDAR"                    //  for example
                    },
                    "WEATHER": {
                      pattern: "display the weather",
                      command: "WEATHER"
                    },
                    "INFORMATION": {
                      pattern: "display information",
                      command: "INFORMATION"
                    },
                    "SPOTIFY": {
                      pattern: "display music",
                      command: "SPOTIFY"
                    },
                    "PHOTOS": {
                      pattern: "display my pics",
                      command: "PHOTOS"
                    },
                    "TO_DO_LIST": {
                      pattern: "display to do list",
                      command: "TODOLIST"
                    },
                    "STOCKS": {
                      pattern: "display my stocks",
                      command: "STOCKS"
                    },
                    "MAIN_PAGE": {
                      pattern: "main page",
                      command: "MAIN_PAGE"
                    },
                  },    
                  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",
                          }, 
                        },
                    "CLOCK": {
                      moduleExec: {
                        module: (param) => {                                 // Home_page is my page 0 indicated in the MMM-Pages config in config.js file
                        },
                      },
                    },
                    "MAIN_PAGE": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 0,
                          },
                        },
                    "WEATHER": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 1,
                          },
                        },  
                    "CALENDAR": {
                      notificationExec: {                                    // you can have as many pages as you want, just edit the payload with number page                                           
                        notification: "PAGE_CHANGED",
                        payload: 2,
                          },
                        },
                    "INFORMATIONS": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 3,
                          },
                        },
                    "SPOTIFY": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 3,
                          },
                        },
                    "PHOTOS": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 4,
                          },
                        },
                    "STOCKS": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 5,
                          },
                        },
                    "TODOLIST": {
                      notificationExec: {
                        notification: "PAGE_CHANGED",
                        payload: 4,
                          },
                        },
                          
                  },
                }
                exports.recipe = recipe
                

                i try adding a MAIN_PAGE command but GA just sit not changing page.
                Thanks

                ,

                1 Reply Last reply Reply Quote 0
                • bugsounet
                  bugsounet Main Coder last edited by

                  payload : "0", For main page 😉
                  Because in your sample it’s eq to null value 😉
                  And developer of this module don’t think to add null value to main page
                  In a long time I have solve it with “0” (string value)

                  A Z 2 Replies Last reply Reply Quote 0
                  • D
                    DJB1966 Helpers last edited by

                    thanks that worked

                    1 Reply Last reply Reply Quote 1
                    • A
                      Anthony Donators @bugsounet last edited by Anthony

                      @bugsounet Hello. The payload: “0” didn’t work for me. Recipe works fine except returning to main page. I tried to make this change to all folders (module’s config, my config, recipe) as well as only in the recipe but same result. Is it because now we are in V4 and not in V3? Also I would like to ask if it is possible to add a timer in tne recipe for some pages when is shown, after a while to return to main page. Thank you in advance.

                      1 Reply Last reply Reply Quote 0
                      • bugsounet
                        bugsounet Main Coder last edited by

                        @Anthony: It’s not related to GA (I have make any change for this)

                        It’s related to MMM-pages update
                        Just read the ReadMe file and apply notification rules 🙂

                        You have a notification named HOME_PAGE

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          Anthony Donators @bugsounet last edited by

                          @bugsounet Hello. The notification rules worked. Thank you very much.

                          1 Reply Last reply Reply Quote 0
                          • Z
                            Zugo Donators @bugsounet last edited by Zugo

                            @bugsounet

                            Thank you very much.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB | @bugsounet ©2022