MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. KSumwalt
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 0

    KSumwalt

    @KSumwalt

    0
    Reputation
    11
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    KSumwalt Unfollow Follow

    Latest posts made by KSumwalt

    • RE: MMM-MQTTbridge

      Hello,

      I installed the module on Aug 18, 2020 and have it connecting to my broker. Either I have something off or the module always sends out the notification’s payload and I cannot over-ride such. My notiDictionary.js file looks like this:

      
      var notiHook = [
        {
          notiId: "USERS_LOGIN",
          notiPayload: [
            {
              payloadValue: '', 
              notiMqttCmd: ["Command 1"]
            },
          ],
        },
        {
          notiId: "SHOW_ALERT",
          notiPayload: [
            {
              payloadValue: '', 
              notiMqttCmd: ["Command 2"]
            },
          ],
        },
        {
          notiId: "NEWS_FEED",
          notiPayload: [
            {
              payloadValue: '', 
              notiMqttCmd: ["Command 3"]
            },
          ],
        },
      ];
      var notiMqttCommands = [
        {
          commandId: "Command 1",
          mqttTopic: "mirror/profile",
          mqttMsgPayload: 'george'
       //    mqttMsgPayload: '{state:"OFF"}'
        },
        {
          commandId: "Command 2",
          mqttTopic: "mirror/alert/set",
          mqttMsgPayload: 'on'
        },
        {
          commandId: "Command 3",
          mqttTopic: "mirror/alert/test",
          mqttMsgPayload: 'go'
        },
      ];
      
      module.exports = { notiHook, notiMqttCommands };
      
      

      When an alert is shown, the SHOW_ALERT send an MQTT Topic of mirror/alert/set but the payload according to MQTT Snooper and my HomeSeer system is [object Object]. I expected it to be a string of on. NEWS_FEED does noth8ing, as expected from the config. USERS_LOGIN is from the MMM-Face-Reco-DNN module. It has a string value of the person who’s face it recognizes. When it recognizes me, the payload for the MQTT topic is Karl both when I have no value and when I have George in the payload setting as shown above.

      This is how I have the module configured in the config.js file:

      		{
      			module: 'MMM-MQTTbridge',
      //			disabled: false,
      			config: {
      				mqttServer: "mqtt://192.168.1.2:1883",
      				mqttConfig:
      				{
      					listenMqtt: true,
      					interval: 300000,
      				},
      				notiConfig:
      				{
      					listenNoti: true,
      					ignoreNotiId: ["CLOCK_MINUTE", "NEWS_FEED"],
      					ignoreNotiSender: ["system", "NEWS_FEED"],
      				},
      				// set "NOTIFICATIONS -> MQTT" dictionary at /dict/notiDictionary.js
      				// set "MQTT -> NOTIFICATIONS" dictionary at /dict/mqttDictionary.js
      			},
      		},
      
      

      What might I be doing wrong?

      Note that for an IP address and no username/password I had to set the server to mqttServer: “mqtt://192.168.1.2:1883”, dropping the colon (:) prior to the IP address. I had it in there based on the provided settings for the localhost version.

      posted in System
      K
      KSumwalt
    • RE: MMM-Face-Reco-DNN receiving PythonShellError: TypeError

      Beautiful! I updated and it appears to be working fine. Thank you, @x3mEr !!!

      posted in Troubleshooting
      K
      KSumwalt
    • RE: MMM-Face-Reco-DNN receiving PythonShellError: TypeError

      @sdetweil Thank you. I have passed this on as an issue on the github site for the plugin.

      posted in Troubleshooting
      K
      KSumwalt
    • MMM-Face-Reco-DNN receiving PythonShellError: TypeError

      I am trying to get facial recognition working but it is not happening. Here is what I have found. Any advice on how to get this to work?

      I have loaded the MMM-Face-Reco-DNN and even used the i_face_recognition.py from https://www.pyimagesearch.com/2018/06/25/raspberry-pi-face-recognition/ with the encodings file generated from the MMM-Face-Reco-DNN instructions and had that .py file recognize faces. So I backed everything out of my config file except the default MMM-Face-Reco-DNN settings from the instructions and when I manually start MM2 everything looks fine. I am running on a Raspberry Pi 4. I did install a different facial recognition module, but it was not in the config file and decided not to use it when I saw it only recognized 1 person. When I step in front of the camera, this comes up in the terminal where I manually started MM2:

      [2020-08-09 00:59:28.399] [ERROR]  Whoops! There was an uncaught exception...
      [2020-08-09 00:59:28.400] [ERROR]  PythonShellError: TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str'
          at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:246:21)
          at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:129:32)
          at ChildProcess.<anonymous> (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:121:13)
          at ChildProcess.emit (events.js:200:13)
          at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
          ----- Python Traceback -----
          File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 143, in <module>
            if minDistance < args["tolerance"]: {
        traceback: 'Traceback (most recent call last):\n  File ' +
          '"modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line ' +
          '143, in <module>\n    if minDistance < args["tolerance"]:\n' +
          "TypeError: '< ' not supported between instances of " +
          "'numpy.ndarray' and 'str'\n",
        executable: 'python3',
        options: null,
        script: 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py',
        args: [
          '--cascade=modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
          '--encodings=modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
          '--usePiCamera=1',
          '--source=0',
          '--rotateCamera=0',
          '--method=dnn',
          '--detectionMethod=hog',
          '--interval=2000',
          '--output=0',
          '--extendDataset=False',
          '--dataset=modules/MMM-Face-Reco-DNN/dataset/',
          '--tolerance=0.6'
        ],
        exitCode: 1
      }
      [2020-08-09 00:59:28.409] [ERROR]  MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      [2020-08-09 00:59:28.409] [ERROR]  If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      

      Here is my config.js

      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw https://michaelteeuw.nl
       * MIT Licensed.
       *
       * For more information on how you can configure this file
       * See https://github.com/MichMich/MagicMirror#configuration
       *
       */
      
      var config = {
      	address: "0.0.0.0",
      	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: [],
      
      	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",
      	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
      	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",
      			classes: 'default everyone',
      		},
      		{
      			module: "updatenotification",
      			classes: 'default everyone',
      			position: "top_bar"
      		},
      		{
      			module: "clock",
      			classes: 'default everyone',
      			position: "top_left"
      		},
      		{
      			module: 'MMM-Face-Reco-DNN',
      			config: {
      			  // Logout 15 seconds after user was not detected any more
      			  // If they are detected within this period, the delay will start again
      			  logoutDelay: 15000,
      			  // How often the recognition starts in milliseconds
      			  // With a Raspberry Pi 3+ it works well every 2 seconds
      			  checkInterval: 2000,
      			  // Module set used for strangers or if no user is detected
      			  defaultClass: 'default',
      			  // Set of modules which should be shown for every recognised user
      			  everyoneClass: 'everyone',
      			  // XML to recognize with haarcascade
      			  cascade: 'modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
      			  // Pre-encoded pickle with the faces
      			  encodings: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
      			  // Use Raspberry Pi camera or another type
      			  // 1 = RasPi camera, 0 = other camera
      			  usePiCamera: 1,
      			  // If using another type of camera, you can choose
      			  // i.e. 0 = /dev/video0 or 'http://link.to/live'
      			  source: 0,
      			  // Rotate camera
      			  rotateCamera: 0,
      			  // Method of facial recognition
      			  // dnn = deep neural network, haar = haarcascade
      			  method: 'dnn',
      			  // Which face detection model to use
      			  // "hog" is less accurate but faster on CPUs
      			  // "cnn" is a more accurate deep-learning model which is GPU/CUDA accelerated
      			  detectionMethod: 'hog',
      			  // How long in milliseconds modules take to hide and show
      			  animationSpeed: 0,
      			  // Path to Python to run the face recognition
      			  // null or '' means default path
      			  pythonPath: null,
      			  // Should a welcome message be shown using the MagicMirror alerts module?
      			  welcomeMessage: true,
      			  // Capture new pictures of recognized people, if unknown we save it in folder "unknown"
      			  // So you can extend your dataset and retrain it afterwards for better recognitions
      			  extendDataset: false,
      			  // If extendDataset is true, you need to set the full path of the dataset
      			  dataset: 'modules/MMM-Face-Reco-DNN/dataset/',
      			  // How much distance between faces to consider it a match. Lower is more strict.
      			  tolerance: 0.6
      			}
      		},
      
      
      	]
      };
      
      /*************** DO NOT EDIT THE LINE BELOW ***************/
      if (typeof module !== "undefined") {module.exports = config;}
      
      

      And here is everything in the terminal before stepping in front of the camera:

      pi@raspberrypi:~/MagicMirror $ npm start
      
      > magicmirror@2.12.0 start /home/pi/MagicMirror
      > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
      
      [2020-08-09 00:58:21.215] [LOG]    Starting MagicMirror: v2.12.0
      [2020-08-09 00:58:21.240] [LOG]    Loading config ...
      [2020-08-09 00:58:21.248] [LOG]    Loading module helpers ...
      [2020-08-09 00:58:21.251] [LOG]    No helper found for module: alert.
      [2020-08-09 00:58:21.325] [LOG]    Initializing new module helper ...
      [2020-08-09 00:58:21.326] [LOG]    Module helper loaded: updatenotification
      [2020-08-09 00:58:21.328] [LOG]    No helper found for module: clock.
      [2020-08-09 00:58:21.354] [LOG]    Initializing new module helper ...
      [2020-08-09 00:58:21.355] [LOG]    Module helper loaded: MMM-Face-Reco-DNN
      [2020-08-09 00:58:21.355] [LOG]    All module helpers loaded.
      [2020-08-09 00:58:21.566] [LOG]    Starting server on port 8080 ... 
      [2020-08-09 00:58:21.574] [INFO]   You're using a full whitelist configuration to allow for all IPs
      [2020-08-09 00:58:21.580] [LOG]    Server started ...
      [2020-08-09 00:58:21.581] [LOG]    Connecting socket for: updatenotification
      [2020-08-09 00:58:21.583] [LOG]    Connecting socket for: MMM-Face-Reco-DNN
      [2020-08-09 00:58:21.583] [LOG]    Starting module helper: MMM-Face-Reco-DNN
      [2020-08-09 00:58:21.584] [LOG]    Sockets connected & modules started ...
      [2020-08-09 00:58:21.891] [LOG]    Launching application.
      [2020-08-09 00:58:25.058] [INFO]   Checking git for module: MMM-Face-Reco-DNN
      [2020-08-09 00:58:32.928] [LOG]    [MMM-Face-Reco-DNN] loading encodings + face detector...
      [2020-08-09 00:58:33.177] [LOG]    [MMM-Face-Reco-DNN] starting video stream...
      
      
      posted in Troubleshooting
      K
      KSumwalt