MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

MMM-Assistantmk2 & MMM-Webradio



  • Good evening,

    I’m new, and I do not know if I’m in the right place. And I do not know anything about codes. 😁

    I would like to activate the webradio module via assistantmk2.

    Do I have to create a new recipe in the recipes folder? and how to code it? And do I have to write a command in the config.js file?

    Thank you very much for your help, I hope you understood me and sorry for my english. 😉


  • Module Developer

    @Lasmazze
    I don’t know about MMM-Webradio. Is that this? https://github.com/MunichStef/MMM_Webradio

    Hmmm. here is some similar code about MMM-Spotify. You can modify this for your purpose.

      transcriptionHook: {
        "START_SPOTIFY" : {
          pattern : "play music",
          command: "START_SPOTIFY"
        },
        "STOP_SPOTIFY" : {
          pattern : "stop music",
          command: "STOP_SPOTIFY"
        },
      },
    
      command: {
        "START_SPOTIFY": {
          notificationExec: {
            notification: "SPOTIFY_PLAY",
          }
        },
        "STOP_SPOTIFY": {
          notificationExec: {
            notification: "SPOTIFY_PAUSE"
          }
        },
      }
    

    I believe you can change above codes to things for MMM-Webradio
    For more details; read the docs of modules.



  • Hello,

    Thank you very much for your answer, I will try tonight, I’ll give you news.



  • :::

    Spoiler Text

    :::

    @Sean

    Yes I use this module well: https://github.com/MunichStef/MMM_Webradio

    I made my code in the config.js as below. The assistantmk2 detects my sentence, it pauses, but nothing happens.

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     *
     * For more information how you can configurate this file
     * See https://github.com/MichMich/MagicMirror#configuration
     *
     */
    
    var config = {
    	address: "localhost", // 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, is "localhost"
    	port: 8080,
    	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // 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"],
    
    	language: "fr",
    	timeFormat: 24,
    	units: "metric",
    
    	modules: [
    		{
    			module: "compliments",
    			position: "lower_third",
    			config: {
    			   compliments: {
    				  anytime: [
    					 "Bonjour",
    					 "comment vas-tu?"
    				  ],
    				  morning: [
    					 "Bien dormi?",
    					 "Bonne journée!",
    					 "Bonjour!"
    				  ],
    				  evening: [
    					 "Bonne soirée!",
    					 "Repose toi bien!",
    					 "Bonne nuit..."
    				  ]
    			   }
    			}
    		},
    {
      module: "MMM_Webradio",
      header: "Webradio",
      position: "bottom_right",
      config: {
        startindex: 1,
        initialVolume: 50,
        streams: [
          {
            text: "radio NRJ",
            url: "http://185.52.127.163/fr/30001/mp3_128.mp3?origine=fluxradios"
          }]
      }
    },
    		{
    			module: "clock",
    			position: "top_left",	// This can be any of the regions.
    			config: {
    				displayType: "analog",
    				secondsColor: "#ff0000"// The config property is optional.
    				// See 'Configuration options' for more information.
    			}
    		},
    		{
                module: "MMM-LocalTemperature",
                position: "top_right", // Only add a position if you want this module to display the data
                header: "temperature de la piece",
                config: {
    				sensorPin: 16,
    				sendTemperature: "true",
    				sendHumidity: "true",
    				showTemperature: "true",
    				showHumidity: "true",
    				iconView: "true",
    				updateInterval: 0.5,
                }
    		},
    		{
    			module: 'MMM-Screencast',
    			position: 'bottom_right', // This position is for a hidden <div> and not the screencast window
    			config: {
    				position: 'bottomRight',
    				height: 300,
    				width: 500,
    			}
    		},
    		{
    			module: "MMM-DarkSkyForecast",
    			header: "Weather",
    			position: "top_right",
    			classes: "default everyone",
    			disabled: false,
    			config: {
    			  apikey: ",
    			  latitude: "",
    			  longitude: ",      
    			  iconset: "4c",
    			  concise: false,
    			  language: "fr",
    			label_timeFormat: "k[h]",
    			label_days: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"],
    			  forecastLayout: "table"
    			}
    		  },
    	{
      module: "MMM-Hotword",
      config: {
        chimeOnFinish: null,
        mic: {
          recordProgram: "arecord",
          device: "plughw:1"
        },
        models: [
          {
      hotwords: "computer",
      file: "computer.umdl",
      sensitivity: "0.5",
    },
        ],
        commands: {
          "computer": {
            notificationExec: {
              notification: "ASSISTANT_ACTIVATE",
              payload: (detected, afterRecord) => {
                return {profile:"default"}
              }
            },
            restart:false,
            afterRecordLimit:0
          }
        }
      }
    },
    	{
    		module: "MMM-AssistantMk2",
    		position: "top_right",
    		config: {
    			deviceLocation: {
    				coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
    				latitude: 
    				longitude: 
    				},
    			},
    			record: {
    				recordProgram : "arecord",  
    				device        : "plughw:1",
    			},
    			transcriptionHook: {
    				"START_RADIO" : {
    					pattern : "play radio",
    					command: "RADIO_ONOFF"
    				  },
    				  "STOP_RADIO" : {
    					pattern : "stop radio",
    					command: "RADIO_ONOFF"
    				  },
    				},
    			  
    				command: {
    				  "START_RADIO": {
    					notificationExec: {
    					  notification: "WEBRADIO_ONOFF",
    					}
    				  },
    				  "STOP_RADIO": {
    					notificationExec: {
    					  notification: "WEBRADIO_ONOFF"
    					}
    				  },
      "SHOW_ALL_MODULES": {
        pattern: "show all",
        command: "SHOWMODULES"
      },
      "SCREEN_ON": {
        pattern: "allume l'écran",
        command: "SCREENON"
      },
      "SCREEN_OFF": {
        pattern: "éteins l'écran",
        command: "SCREENOFF"
      },
      "REBOOT": {
        pattern: "redémarre",
        command: "REBOOT"
      },
      "SHUTDOWN": {
        pattern: "éteins le miroir",
        command: "SHUTDOWN"
      }
    },
    			notifications: {
    				ASSISTANT_ACTIVATED: "HOTWORD_PAUSE",
    				ASSISTANT_DEACTIVATED: "HOTWORD_RESUME",
    				SAY_TEXT: "ASSISTANT_SAY",
    				DEFAULT_HOOK_NOTIFICATION: "ASSISTANT_HOOK",
    				WEBRADIO_ONOFF: "WEBRADIO_ONOFF",
    			},
    			screenDuration: 3000,
    			pauseOnYoutube: false,
    			youtubePlayQuality: "small",
    			useWelcomeMessage: "",
    			profiles: {
    				"default" : {
    					lang: "fr-FR"
    				}
    			},
    		}
    	},
    	]
    
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    

    Do I have to create a recipe.js in the folder
    MMM-AssistantMk2 / recipes?


Log in to reply