Bugsounet Coding

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    Best option to hide / show modules with GA

    General Discussion
    3
    5
    332
    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.
    • T
      totofar Donators last edited by

      Hi all,
      I’m new with MM and am looking for the best option to show/hide modules via notifications (triggered by GA commands).
      Can it be done easily via default components of MM or I have to install a distinct module that provides ready to use ways to capture a “HIDE_MODULE_XX” notification ?
      (Maybe this is just a simple setup in a recipe ?)
      Thanks,

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

        Hi,

        • You can use a recipe to send a notification to a module and the module will self hide when the wanted module receive it

        or

        • You can use a recipe to force to hide the wanted module

        so In the 2 cases you have to code an recipe 😉

        1 Reply Last reply Reply Quote 0
        • T
          totofar Donators last edited by

          ok.
          I’ll try option2 then.
          Thanks

          1 Reply Last reply Reply Quote 0
          • T
            totofar Donators last edited by totofar

            Hi,
            I am not sure there are other beginners in that forum… but in case there are, here is the detailed solution to show / hide modules.
            (I wish I found such details instead of wasting hours to understand how receipes & notifications work)

            I finaly chose the option 2 suggested by @bugsounet.

            1. Install Jopyth/MMM-Remote-Control module

            2. Setup the module until you successfuly manage to show/hide modules using another device (mobile or computer) with http://%MM-URL%:%port%/remote.html (easy setup with attention point on whitelisting)

            Once you succeed in showing/hiding with that external device, you can now try to use MMM-GoogleAssistant to send notifications to MMM-Remote-Control to order show/hide instructions

            1. Create a new file in with-MMM-Remote-Control.js in ~/MagicMirror/modules/MMM-GoogleAssistant/recipes/ with following content
            var recipe = {
              transcriptionHooks: {
                "SHOW_A": {
                  pattern: "SHOW MY MODULE A",
                  command: "SHOW_A"
                },
                "HIDE_A": {
                  pattern: "HIDE MY MODULE A",
                  command: "HIDE_A"
                }
              },
            commands: {
            "SHOW_A": {
                  notificationExec: {
                    notification: "REMOTE_ACTION",
            	  payload: {
            		action: "SHOW",
            		module: "%Name of module in config.js%" 			}
                  },
                  soundExec: {
                    chime: "open"
                  }
                },
            "HIDE_A": {
                  notificationExec: {
                    notification: "REMOTE_ACTION",
            	  payload: {
            		action: "HIDE",
            		module: "%Name of module in config.js%" 			}
                  },
                        soundExec: {
                          chime: "open"
                        }
                      }
             }
            }
            exports.recipe = recipe
            
            
            1. Declare that receipe in MMM-GoogleAssistant parameters in config.js declaring the .js file in the recipes
            ...
            			  module: "MMM-GoogleAssistant",
            			  position: "fullscreen_above",
            			  config: {
            				recipes: [
            				  "with-MMM-Remote-Control.js"
            				],
            				debug: true,
            ...
            
            1. Restart the Magic Mirror
            2. Call “JARVIS HIDE MY MODULE A”… it’ll hide 🙂
            1 Reply Last reply Reply Quote 0
            • P
              prota last edited by

              Bravo!!!

              i’m a begginer too. Thank you very much

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