• 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.

MM-Navbar - Navigation Bar for Touchscreens to hide/show modules

Scheduled Pinned Locked Moved System
47 Posts 11 Posters 38.6k Views 15 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.
  • A Offline
    AlessandroRa @chrisyy
    last edited by Jan 7, 2017, 2:27 PM

    Hi @chrisyy thank you for this awesome module!
    Only problem is that with this module on, the Hide/show all module disappeared. How can I fix it?
    Thanks!

    1 Reply Last reply Reply Quote 0
    • I Offline
      in_a_days @shashank
      last edited by in_a_days Jan 7, 2017, 8:17 PM Jan 7, 2017, 6:21 PM

      @shashank

      For sure. Forgive me if there are several steps.

      First thing is to install this module

      https://github.com/alexyak/voicecontrol

      Go to your MagicMirror/modules folder and type

      git clone https://github.com/alexyak/voicecontrol.git

      Then install dependencies with

      sudo apt-get install python-pyaudio python3-pyaudio sox

      Next, install the navbar. Again, make sure you are in the MagicMirror/modules folder and type

      git clone https://github.com/chr1syy/MM-navbar.git

      Then you will need to go to this website and define your voice commands.

      https://snowboy.kitt.ai/

      Keep track of the keywords you define and the filenames you produce. Each keyword/command will require you to download a .pmdl file that needs to be copied into the MagicMirror folder on your Pi. I’m only using 3 commands so far - calendar, newsfeed, and weather.

      Still with me? Sweet! Lets configure config.js. Go to the MagicMirror/config folder and

      nano config.js

      Assuming you know where to place a new module in this file, add the navbar module with

                  {
                          module: 'MM-navbar',
                          position: 'fullscreen_above'
                  },
      

      Next we will add the voice control call to the same config.js file. There are a couple variables here that will depend on the keywords and filenames you used on the snowboy site. Here is the code I use

                {
                          module: 'voicecontrol',
                          position: 'bottom_right',
                          config: {
                                  models: [
                                                  {
                                                          keyword: "Calendar",
                                                          description: "Say 'Calendar' to toggle display",
                                                          file: "calendar.pmdl",
                                                          message: "CALENDAR"
                                                  },
                                                  {
                                                          keyword: "Newsfeed",
                                                          description: "Say 'Newsfeed' to toggle display",
                                                          file: "newsfeed.pmdl",
                                                          message: "NEWSFEED"
                                                  },
                                                  {
                                                          keyword: "Weather",
                                                          description: "Say 'Weather' to toggle display",
                                                          file: "weather.pmdl",
                                                          message: "WEATHER"
                                                  }
                                          ]
      
                                  }
                  },
      

      Note that the keyword and file need to match the keyword and filenames you used on your Snowboy files. Save and quit out of config.js and we’ll hit the last step. We need to make a couple changes to the navbar code. Navigate to MagicMirror/modules/MM-navbar then

      nano MM-navbar.js

      First change is at line 13. Right now lines 12-19 look like this

      notificationReceived: function(notification, payload, sender){
      	if (notification === 'DOM_OBJECTS_CREATED'){
      		MM.getModules().exceptModule(this).exceptWithClass('clock').enumerate(function(module){
      			module.hide(1000, function(){
      			});
      		});
      	}
      },
      

      You will need to modify it to look like this

          notificationReceived: function(notification, payload, sender){
                  if (notification === "CALENDAR"){
                          var calendarbutton = document.getElementById('calendar-button');
                          calendarbutton.click();
                  }
                  if (notification === "NEWSFEED"){
                          var newsbutton = document.getElementById('news-button');
                          newsbutton.click();
                  }
                  if (notification === "WEATHER"){
                          var weatherbutton = document.getElementById('weather-button');
                          weatherbutton.click();
                  }
          },
      

      Now we’re going down to the section that originally starts on line 32

      	wrapper.className = "center";
      	weatherbutton.className = "wi wi-day-rain-mix navbar";
      	calendarbutton.className = "fa fa-calendar navbar";	
      	newsbutton.className = "fa fa-newspaper-o navbar";		
      

      And change it to

                  wrapper.className = "center";
                  weatherbutton.className = "wi wi-day-rain-mix navbar";
                  weatherbutton.id = 'weather-button';
                  calendarbutton.className = "fa fa-calendar navbar";
                  calendarbutton.id = 'calendar-button';
                  newsbutton.className = "fa fa-newspaper-o navbar";
                  newsbutton.id = 'news-button';
      

      Save, close and restart your MM and you should have a working, voice responsive nav bar. I know there are kind of a lot of steps here and typos and omissions are entirely possible. If you have any problems let me know and I’ll try to help. Cheers!

      What ship would bear me ever back across so wide a Sea?

      C S 2 Replies Last reply Jan 12, 2017, 7:20 AM Reply Quote 0
      • C Offline
        chrisyy @in_a_days
        last edited by chrisyy Jan 12, 2017, 7:22 AM Jan 12, 2017, 7:20 AM

        @in_a_days maybe u can make a fork of it in git? Thanks for sharing ur code.

        @AlessandroRa There’s also a button in this module for hiding/showing everything. Do u have another module that will do this function for it?

        @All
        Forgive me if I’m not answering in time. Since I’m moving my time is very limited.
        When we are done (maybe in 2-3 Weeks) i will do some updates on my own mirror and will update code if needed.

        U can also submit code on git, i will take a look and implement it.

        I’ll try to Keep in touch.

        I A 2 Replies Last reply Jan 12, 2017, 3:41 PM Reply Quote 0
        • I Offline
          in_a_days @chrisyy
          last edited by in_a_days Jan 12, 2017, 4:29 PM Jan 12, 2017, 3:41 PM

          @chrisyy

          Here is the navbar code with my modifications:

          https://github.com/in-a-days/MM-navbar

          The user will still need to install voicecontrol, create and load the .pmdl files, and properly configure config.js.

          Is the show/hide all button part of this build? I’m looking for something like

          	var showallbutton = document.createElement("span");
          

          to match these

          	var weatherbutton = document.createElement("span");
          	var newsbutton = document.createElement("span");
          

          And I’m not finding anything. Thanks again, I really love this module!

          What ship would bear me ever back across so wide a Sea?

          C 1 Reply Last reply Jan 13, 2017, 8:53 AM Reply Quote 0
          • A Offline
            AlessandroRa @chrisyy
            last edited by Jan 12, 2017, 4:37 PM

            @chrisyy All I have is the weather, calendar and news buttons, how can I get more of them?
            I’m using: Mail, Hello World, Alarm, News, Calendar and Music player.
            For hiding/showing all I’m using this module: https://github.com/masters1222/mm-hide-all

            C 1 Reply Last reply Jan 13, 2017, 8:50 AM Reply Quote 0
            • T Offline
              tosti007 Module Developer
              last edited by tosti007 Jan 12, 2017, 6:40 PM Jan 12, 2017, 5:20 PM

              @chrisyy first of all I want to say that your module looks really nice, unfortunate that my mirror won’t have touch ;(. This module could be used in conjunction with my ProfileSwitcher module. This way you won’t have to bother with showing/hiding certain modules and others won’t have to modify your code. :)

              If there is anything don't hesitate to contact me!
              ProfileSwitcher, TouchNotifications

              1 Reply Last reply Reply Quote 0
              • C Offline
                chrisyy @AlessandroRa
                last edited by Jan 13, 2017, 8:50 AM

                @AlessandroRa for now, u have to copy a button and Change the code to another module.

                @tosti007 Thanks for the tip. i’ll have a look at the module.

                A 1 Reply Last reply Jan 16, 2017, 1:19 AM Reply Quote 0
                • C Offline
                  chrisyy @in_a_days
                  last edited by Jan 13, 2017, 8:53 AM

                  @in_a_days the code for Show/hide alle of the modules is

                  MM.getModules().exceptModule(this).exceptWithClass(‘clock’).enumerate(function(module){
                  module.hide(1000, function(){
                  });
                  });

                  but there is not a button implemented until now.

                  1 Reply Last reply Reply Quote 1
                  • T Offline
                    tosti007 Module Developer
                    last edited by Jan 13, 2017, 9:28 AM

                    I gave your code a look an notived that you imported jquery. First of all, you could also direct to a external file, see module documentation, this way you only have to change that line when you want to update the jquery. However if you would replace the on with addEventListener then you wouldn’t have to import jquery at all. Your code wouldn’t have to change much at all since that method takes the same parameters.

                    If there is anything don't hesitate to contact me!
                    ProfileSwitcher, TouchNotifications

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      shashank @in_a_days
                      last edited by Jan 15, 2017, 2:56 PM

                      @in_a_days hi, how can i change code to show more modules apart from clock, i need weather and calendar to show as default

                      I 1 Reply Last reply Jan 15, 2017, 7:23 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 3 / 5
                      3 / 5
                      • First post
                        29/47
                        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