Bugsounet Coding

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

    Solved recipes unexpected identifier "exports' error

    Recipes
    2
    4
    33
    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.
    • J
      jordaine777 last edited by

      Hi, first I’d like to say thank you for all the amazing work. I have been trying to use the recipes but have been getting an error with the exports keyword. Below is the output:
      2022-06-14-103158_1280x720_scrot.png nshot of the output:

      This is my config file:

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw https://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information on how you can configure this file
       * see https://docs.magicmirror.builders/getting-started/configuration.html#general
       * and https://docs.magicmirror.builders/modules/configuration.html
       */
      let 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 or empty, is "localhost"
      	electronOptions: {
          webPreferences: {
            webviewTag: true
          }
        },
      	port: 8080,
      	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
      					// you must set the sub path here. basePath must end with a /
      	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"],
      
      	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
      	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
      	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
      
      	language: "en",
      	locale: "en-US",
      	logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
      	timeFormat: 12,
      	units: "imperial",
      	// serverOnly:  true/false/"local" ,
      	// local for armv6l processors, default
      	//   starts serveronly and then starts chrome browser
      	// false, default for all NON-armv6l devices
      	// true, force serveronly mode, because you want to.. no UI on this device
      
      	modules: [
      		{
      			module: "alert",
      		},
      		{
      			module: "updatenotification",
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			position: "top_left"
      		},
      		{
      			module: "calendar",
      			header: "DO I HAVE SHIT TO DO?",
      			position: "top_left",
      			config: {
      				calendars: [
      					{
      						symbol: "calendar-check",
      						url: "https://outlook.office365.com/owa/calendar/22f898009103415c94119fb2f1aefc63@hartford.edu/74d22240eca248aea0440a51ce2d0bf49668172189547215565/calendar.ics"
      					}
      				]
      			}
      		},
      
      		{
      			module: "weather",
      			position: "top_right",
      			config: {
      				weatherProvider: "openweathermap",
      				type: "current",
      				location: "Connecticut",
      				locationID: "5095779", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				apiKey: "89338f7646aa011a2e882e37538ece0e"
      			}
      		},
      		{
      			module: "weather",
      			position: "top_right",
      			header: "Weather Forecast",
      			config: {
      				weatherProvider: "openweathermap",
      				type: "forecast",
      				location: "Bloomfield",
      				locationID: "5095779", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
      				apiKey: "89338f7646aa011a2e882e37538ece0e"
      			}
      		},
      		{
      			module: "newsfeed",
      			position: "bottom_bar",
      			config: {
      				feeds: [
      					{
      						title: "New York Times",
      						url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
      					}
      				],
      				showSourceTitle: true,
      				showPublishDate: true,
      				broadcastNewsFeeds: true,
      				broadcastNewsUpdates: true
      			}
      		},
      		
      		{
      		  module: 'Gateway',
      		  config: {
      			debug: true,
      			port: 8081,
      			username: "admin",
      			password: "admin",
      			noLogin: false,
      			usePM2: false,
      			PM2Id: 0
      		  }
      		},
      		
      		{
      		  module: 'EXT-Alert',
      		  config: {
      			debug: false,
      			ignore: []
      		  }
      		},
      		
      		{
      		  module: "EXT-Detector",
      		  position: "bottom_left",
      		  configDeepMerge: true,
      		  config: {
      		    debug: false,
      		    useIcon: true,
      		    touchOnly: false,
      		  }
      		},
      /*		{
      		  module: "EXT-Browser",
      		  config: {
      			debug: false,
      			displayDelay: 60 * 1000,
      			scrollActivate: false,
      			scrollStep: 25,
      			scrollInterval: 1000,
      			scrollStart: 5000
      		  }
      		},   
      */
      		{
      		  module: "EXT-YouTubeCast",
      		  position: "top_center", // optional (can be deleted if using fullscreen)
      		  config: {
      			debug: false,
      			fullscreen: true,
      			alwaysDisplayed: false,
      			castName: "MagicMirror",
      			port: 8569
      		  }
      		},
      		{
      		  module: 'EXT-Internet',
      		  position: 'top_left',
      		  config: {
      			debug: false,
      			displayPing: true,
      			delay: 30 * 1000,
      			scan: "google.fr",
      			command: "pm2 restart 0",
      			showAlert: true,
      			needRestart: false
      		  }
      		},
      		{
      		  module: "MMM-GoogleAssistant",
      		  position: "bottom_left",
      		  configDeepMerge: true,
      		  config: {
      		    debug: false,
      		    assistantConfig: {
      		  lang: "en-US",
      		  latitude: 41.8232316, //add your location coordinates
      		  longitude: -72.7597991,
      		},
      		 responseConfig: {
      		  useFullscreen: true,
      		  useResponseOutput: true,
      		  responseOutputCSS: "response_output.css",
      		  screenOutputTimer: 5000,
      		  activateDelay: 250,
      		  useAudioOutput: true,
      		  useChime: true,
      		  confirmationChime: true,
      		  useInformations: true
      		},
      		micConfig: {
      			recorder: "arecord",
      			device: "0"
      			},
      			Extented: {
      		      useEXT: true,
      				stopCommand: "stop",
      		      youtube: {
      				useYoutube: true,
      				youtubeCommand: "youtube",
      				displayResponse: true,
      				useVLC: true,
      				minVolume: 30,
      				maxVolume: 100
      				},
      		      links: {
      				useLinks: true,
      				displayDelay: 60 * 1000,
      				scrollActivate: false,
      				scrollStep: 25,
      				scrollInterval: 1000,
      				scrollStart: 5000
      				},
      		      
      		      welcome: {
      				useWelcome: true,
      				welcome: "brief today"
      				},
      		      cast: {
      				useCast: true,
      				port: 8569
      				},
      		      spotify: {
      				useSpotify: false,
      				visual: {},
      				player: {}
      			},
      		},
      		    recipes: ["Reboot-Restart-Shutdown.js"],
      		    NPMCheck: {}
      		  }
      		},
      	]
      };
      
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      

      This is the recipes file i am trying to use:

      /**   Reboot, Restart, Shutdown, Screen  **/
      /**   Vocal commands script              **/
      /**   set partern in your language       **/
      /**   @bugsounet                         **/
      
      var recipe = {
        transcriptionHooks: {
          "GA_REBOOT": {
            pattern: "reboot please",
            command: "GA_REBOOT"
          },
          "GA_RESTART": {
            pattern: "restart please",
            command: "GA_RESTART"
          },
          "GA_SHUTDOWN": {
            pattern: "shutdown please",
            command: "GA_SHUTDOWN"
          },
          "GA_EXIT_MM": {
            pattern: "exit magic mirror",
            command: "GA_EXIT_MM"
          }
        },
        
        commands: {
          "GA_REBOOT": {
            soundExec: {
              chime: "close",
            },
            shellExec: {
              exec: "sudo reboot now"
            }
          },
          "GA_RESTART": {
            soundExec: {
              chime: "close",
            },
            shellExec: {
              exec: "pm2 restart 0"
            }
          },
          "GA_SHUTDOWN": {
            soundExec: {
              chime: "close",
            },
            shellExec: {
              exec: "sudo shutdown now"
            },
            "GA_EXIT_MM": {
            soundExec: {
              chime: "close",
            },
            shellExec: {
              exec: "pm2 stop mm"
            }
          }
        }
      }
      
      exports.recipe = recipe //Don't remove this line.
      
      

      i have looked both on this forum and other sources online and the closest thing i saw was to try using module.exports but that also did not work so any help would be greatly appreciated.
      Thanks in advance.

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

        Hi,

        By looking your config your config of MMM-GoogleAssistant still in V3, now we are in V4 and configuration is not the same

        For your recipe, it’s already coded inside recipes directory, if you modify it save in other name because on last update it will be reset with default version

        in other hand, i correct it:

        var recipe =  {
          "transcriptionHooks": {
            "GA_REBOOT": {
              "pattern": "reboot please",
              "command": "GA_REBOOT"
            },
            "GA_RESTART": {
              "pattern": "restart please",
              "command": "GA_RESTART"
            },
            "GA_SHUTDOWN": {
              "pattern": "shutdown please",
              "command": "GA_SHUTDOWN"
            },
            "GA_EXIT_MM": {
              "pattern": "exit magic mirror",
              "command": "GA_EXIT_MM"
            }
          },
          
          "commands": {
            "GA_REBOOT": {
              "soundExec": {
                "chime": "close"
              },
              "shellExec": {
                "exec": "sudo reboot now"
              }
            },
            "GA_RESTART": {
              "soundExec": {
                "chime": "close"
              },
              "shellExec": {
                "exec": "pm2 restart 0"
              }
            },
            "GA_SHUTDOWN": {
              "soundExec": {
                "chime": "close"
              },
              "shellExec": {
                "exec": "sudo shutdown now"
              }
            },
            "GA_EXIT_MM": {
              "soundExec": {
                "chime": "close"
              },
              "shellExec": {
                "exec": "pm2 stop mm"
              }
            }
          }
        }
        
        exports.recipe = recipe
        
        J 1 Reply Last reply Reply Quote 0
        • J
          jordaine777 @bugsounet last edited by

          @bugsounet So I changed the name and it started working haha. Also changed config to match v4. Thank you so much

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

            Perfect, Happy that works for you

            Happy use!

            1 Reply Last reply Reply Quote 0
            • Topic has been marked as solved  bugsounet bugsounet 
            • Moved from Issues by  bugsounet bugsounet 
            • First post
              Last post
            Powered by NodeBB | @bugsounet ©2022