Best option to hide / show modules with GA
-
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, -
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
-
ok.
I’ll try option2 then.
Thanks -
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.
-
Install Jopyth/MMM-Remote-Control module
-
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
- 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
- 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, ...
- Restart the Magic Mirror
- Call “JARVIS HIDE MY MODULE A”… it’ll hide
-
-
Bravo!!!
i’m a begginer too. Thank you very much