• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

VoiceControl module

Scheduled Pinned Locked Moved Utilities
79 Posts 27 Posters 98.0k Views 29 Watching
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 Offline
    tyho
    last edited by Aug 1, 2016, 5:14 PM

    @alexyak i can’t get it to work. it tested:
    It sends sockets notifications from notifications.js to node_helper.js. But not from node_helper.js back to notifications.js.

    Even if i put it in the start function of the node_helper.js:

    start: function() { 
      this.sendSocketNotification("autosleep", {});
      }, 
    

    it won’t get received it my notification.js:

    socketNotificationReceived: function(notification) {
       if (notification === "autosleep") {
    	  alert("autosleep received");
    		awake = 0;
            		}
       	},
    

    any idea? is it even possible to use it backwards?

    1 Reply Last reply Reply Quote 0
    • A Offline
      alexyak
      last edited by Aug 1, 2016, 5:18 PM

      Try to put a call in your start method of the module (notification.js) to establish the connection with node_helper. Something like that:

      this.sendSocketNotification(“CONNECT”, {});

      1 Reply Last reply Reply Quote 0
      • A Offline
        alexyak
        last edited by Sep 2, 2016, 9:28 PM

        I’ve updated the VoiceControl module to display a list of commands on the mirror:

        0_1472851592256_Screen Shot 2016-09-02 at 5.23.53 PM.png

        [ card : alexyak/voicecontrol ]

        1 Reply Last reply Reply Quote 0
        • A Offline
          alexyak
          last edited by alexyak Sep 3, 2016, 2:11 AM Sep 3, 2016, 2:11 AM

          [card:alexyak/voicecontrol]

          1 Reply Last reply Reply Quote 0
          • B Offline
            brumoeller
            last edited by Sep 14, 2016, 3:31 PM

            This is a really cool module. Does anyone know a good microphone that will work for the whole room? The mic I have only works when you are close.

            1 Reply Last reply Reply Quote 0
            • G Offline
              gismo2006
              last edited by Sep 30, 2016, 1:20 PM

              Hi,

              @alexyak sorry, but i have a little Problem. Maybe you can help me.

              You write on Github in your Readme file, I have to put the code (notificationReceived: function(notification, payload, sender)…) into the module to use it. I like to controll the module Simple music player by @EoF so i clone your github files copy the code into the config.js File train and download a pmdl file. But where should i paste the code notificationReceived: function(notification, payload, sender)… In the config.js File or in the mmm-music-player.js file in folder modules simple music Player?

              Sorry i’m new in the coding world, and now a little bit confused :-D

              Greets gismo2006

              J 1 Reply Last reply Sep 30, 2016, 1:40 PM Reply Quote 0
              • J Offline
                Jopyth Moderator @gismo2006
                last edited by Jopyth Sep 30, 2016, 1:44 PM Sep 30, 2016, 1:40 PM

                @gismo2006 This part has to go into mm-music-player.js. This is where you receive the notification. Then instead of this.media.play() you have to do access the play and stop functions of the mm-music-player (which unfortunately is seems a little bit complicated, since they are only elements on the web page).

                Edit: Maybe the easiest is to give the Play and Stop button an id and then ‘fake’ a click event on the the buttons.

                var playButton = document.getElementById('play-button');
                playButton.click();
                

                Helpful sticky: How to troubleshoot

                1 Reply Last reply Reply Quote 0
                • G Offline
                  gismo2006
                  last edited by Sep 30, 2016, 2:25 PM

                  Hi @Jopyth thank you for your helping.

                  But I think i’m to stupid… :-(

                  I have copy your first code line into the mm-music-player.js file. But now the module isn’t shown at the mirror. But the mirror shows all other module i installed at the same time… (I use pavrios Facial-Recogination module) If I cut out your line the mirrors behaviour is like it should be. On searching my misstake i found a line called: var playButton = document.createElement(“div”);. I cut this line and put in your line but nothing.

                  greets gismo

                  J 1 Reply Last reply Sep 30, 2016, 2:41 PM Reply Quote 0
                  • J Offline
                    Jopyth Moderator @gismo2006
                    last edited by Sep 30, 2016, 2:41 PM

                    @gismo2006 Have you put this into the notificationReceived function, e.g. in line 26?

                    notificationReceived: function(notification, payload, sender) {
                            if (notification === "PLAY_MUSIC"){
                                    var playButton = document.getElementById('play-button');
                                    playButton.click();
                            }
                    
                            if (notification === "STOP_MUSIC"){
                                    var stopButton = document.getElementById('stop-button');
                                    stopButton.click();
                            }
                        },
                    

                    Also add the id somewhere here, e.g. with

                    playButton.id = 'play-button'
                    

                    Same for the stop button.

                    Helpful sticky: How to troubleshoot

                    1 Reply Last reply Reply Quote 0
                    • G Offline
                      gismo2006
                      last edited by Sep 30, 2016, 2:57 PM

                      Hey, thank you for your help!

                      I really like to say many many thank that you spend your time to help me.

                      I will try it today evening again, because now my little son likes to play whit me. :-)

                      greets gismo

                      1 Reply Last reply Reply Quote 1
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 8
                      • 2 / 8
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy