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.

    MMM-KeyBindings: Control your mirror with Amazon Fire Stick Remote and Generic Keyboard Inputs

    Scheduled Pinned Locked Moved Utilities
    keyboardremote controlfire stick remotebluetooth
    34 Posts 13 Posters 18.9k Views 12 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.
    • S Offline
      shbatm Module Developer
      last edited by

      @AgilesChroms - I’m out of town for business, so bear with me since I’m unable to fully test these suggestions.

      To use custom keyboard keys AND the remote, you can also modify the evdevKeymap and handleKeys in the MMM-KeyBindings Config. The module tries to “map” the remote’s key names to more standard keyboard key names and this can be tweaked. For example in the MMM-KeyBindings Config:

       ...
       evdevKeymap: {  
           Home: "KEY_HOMEPAGE", 
           Enter: "KEY_KPENTER", 
           j: "KEY_LEFT",          // Change default "ArrowLeft" to "j"
           k: "KEY_RIGHT",         // Change default "ArrowRight" to "k"
           ArrowUp: "KEY_UP", 
           ArrowDown: "KEY_DOWN",
           Menu: "KEY_MENU", 
           MediaPlayPause: "KEY_PLAYPAUSE", 
           MediaNextTrack: "KEY_FASTFORWARD", 
           MediaPreviousTrack: "KEY_REWIND",
           Return: "KEY_BACK"
           },
       handleKeys: ['j','k']       //  Add the new keys to the keyboard bindings
      

      In MMM-Carousel, you can now use:

       keyBindings: { NextSlide: "k", PrevSlide: "j", Slide0: "Return", ... }
      

      Side note:

      Something you may also find useful: the evdevKeymap tries to standardize keys, but if it receives a key that isn’t in the map, it will still pass it along. I use this to also control my Mirror via my home automation system using GET requests.

      For example: if you add a keybinding to MMM-Carousel like Slide1: "SomeSlideTitle", you can jump to that slide with a GET request to the following URL:

      http://mirror_ip:8080/MMM-KeyBindings/notify?notification=KEYPRESS&payload=%7B%22KeyState%22%3A%20%22KEY_PRESSED%22%2C%20%22Duration%22%3A%200.0%2C%20%22KeyName%22%3A%20%22SomeSlideTitle%22%7D
      
      // payload parameter is a url-encoded JSON string:
      {"KeyState": "KEY_PRESSED", "Duration": 0.0, "KeyName": "SomeSlideTitle"}
      
      AgilesChromsA 1 Reply Last reply Reply Quote 0
      • AgilesChromsA Offline
        AgilesChroms @shbatm
        last edited by

        @shbatm
        I am now satisfied with the behavior. The screen is now syncron with the browser
        thank you for your help

        1 Reply Last reply Reply Quote 0
        • S Offline
          shbatm Module Developer
          last edited by

          You are welcome. Glad you made it work and happy to see someone can make use of the module!

          1 Reply Last reply Reply Quote 0
          • J Offline
            jchenaud
            last edited by jchenaud

            hey thk for module !

            i try to use it but i have some problem:

            i have put that on my conf file .

            	{
                        module :  'MMM-KeyBindings' ,
                        config : {
            				enableNotifyServer : false 
                        }
                    },
            

            i just want to use a local keyboard for now and i probably change after for remote.
            and on my module of pages organisation

            i have put your config :

            Module.register("Print_text_from_txt",{
            	curentPage: -1,
            	defaults: {
            		updateInterval:  1000,// 30 * 60 * 1000 //reads the file every 30 mins
            	
            	
            
            
                /*** defaults ***
                 *
                 *   Add items below to your moduleName.js's `defaults` object
                 *
                 */
                    /*** MMM-KeyBindings STANDARD MAPPING ***/
                    /* Add the "mode" you would like to respond to */
                    keyBindingsMode: "DEFAULT",
                    keyBindings: {
                        /* Add each key you want to respond to in the form:
                         *      yourKeyName: "KeyName_from_MMM-KeyBindings"
                         */
                        Right: "ArrowRight",
                        Left: "ArrowLeft",
                        /* ... */
                    },
                },
            
            /////////////////////////////
            	start: function(){
            		this.setupKeyBindings(); //key binding test
            
            		this.sendSocketNotification("START", this.config);
            	},
            /////////////////////////////
            notificationReceived: function(notification, payload){
            		if (this.validateKeyPress(notification, payload)) { return; }
            		if (notification === "PAGE_NUMBER_IS")
            		{
            			this.curentPage = payload
            			this.sendNotification("PAGE_CHANGED", this.curentPage);
            		}
            ///////////////////////////
            

            i have clone directory on my module folder.

            i have one error on console but she not cause by the module

            TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
                at updateModuleContent (main.js:206)
                at main.js:139
                at new Promise (<anonymous>)
                at updateDomWithContent (main.js:137)
                at main.js:119
                at <anonymous>
            

            i have probably miss something but i dont find :(
            i haven’t notification on console
            sorry for my bad language
            and thanks for your help

            edit:
            i have miss on Line on config file

            but notification is not hear and probably never send :(

            1 Reply Last reply Reply Quote 0
            • J Offline
              jchenaud
              last edited by jchenaud

              hey i remake all process but nothing new . i am alone in this case ?

              just my log when all looks ok

               MagicMirror git:(master) ✗ npm start
              
              > magicmirror@2.4.1 start /home/pi/MagicMirror
              > sh run-start.sh
              
              Starting MagicMirror: v2.4.1
              Loading config ...
              Loading module helpers ...
              No helper found for module: alert.
              Initializing new module helper ...
              Module helper loaded: updatenotification
              No helper found for module: clock.
              No helper found for module: compliments.
              Initializing new module helper ...
              Module helper loaded: newsfeed
              No helper found for module: MMM-EyeCandy.
              Initializing new module helper ...
              Module helper loaded: Print_text_from_txt
              Initializing new module helper ...
              Module helper loaded: MMM-kalliope
              Initializing new module helper ...
              Module helper loaded: MMM-KeyBindings
              No helper found for module: MMM-pages.
              All module helpers loaded.
              Starting server on port 8080 ... 
              Server started ...
              Connecting socket for: updatenotification
              Connecting socket for: newsfeed
              Starting module: newsfeed
              Connecting socket for: Print_text_from_txt
              Starting module helper: Print_text_from_txt
              Connecting socket for: MMM-kalliope
              MMM-kalliope is started
              Connecting socket for: MMM-KeyBindings
              MMM-KeyBindings helper has started...
              Sockets connected & modules started ...
              Launching application.
              Create new news fetcher for url: https://www.tdg.ch/rss_ticker.html - Interval: 300000
              MMM-kalliope received a socket notification: CONNECT - Payload: null
              
              
              
              1 Reply Last reply Reply Quote 0
              • R Offline
                rak
                last edited by rak

                Hello guys,

                I cant get the remote connected to the R3B+. I stuck. Searching the web like cracy since yetserday evening with no result.

                It seems the pairing fails bc of the message “ServicesResolved: no”

                Any clue whats missing?

                $ sudo bluetoothctl 
                [NEW] Controller B8:27:EB:DF:FF:D1 raspberrypi [default]
                [bluetooth]# agent on
                Agent registered
                [bluetooth]# scan on
                Discovery started
                [CHG] Controller B8:27:EB:DF:FF:D1 Discovering: yes
                [NEW] Device C4:95:00:6F:19:8A Amazon Fire TV Remote
                [CHG] Device C4:95:00:6F:19:8A RSSI: -66
                [CHG] Device C4:95:00:6F:19:8A RSSI: -74
                [CHG] Device C4:95:00:6F:19:8A RSSI: -62
                [bluetooth]# scan off
                Discovery stopped
                [bluetooth]# pair C4:95:00:6F:19:8A
                Attempting to pair with C4:95:00:6F:19:8A
                [CHG] Device C4:95:00:6F:19:8A Connected: yes
                Request confirmation
                [agent] Confirm passkey 301420 (yes/no): yes
                [CHG] Device C4:95:00:6F:19:8A Modalias: usb:v1949p0410d0304
                [CHG] Device C4:95:00:6F:19:8A UUIDs: 00001101-0000-1000-8000-00805f9b34fb
                [CHG] Device C4:95:00:6F:19:8A UUIDs: 00001124-0000-1000-8000-00805f9b34fb
                [CHG] Device C4:95:00:6F:19:8A UUIDs: 00001200-0000-1000-8000-00805f9b34fb
                [CHG] Device C4:95:00:6F:19:8A ServicesResolved: yes
                [CHG] Device C4:95:00:6F:19:8A Paired: yes
                Pairing successful
                [CHG] Device C4:95:00:6F:19:8A ServicesResolved: no     <<<<< THIS sounds strange to me
                [CHG] Device C4:95:00:6F:19:8A Connected: no
                
                [bluetooth]# trust C4:95:00:6F:19:8A
                [CHG] Device C4:95:00:6F:19:8A Trusted: yes
                Changing C4:95:00:6F:19:8A trust succeeded
                
                [bluetooth]# devices
                Device 4F:8A:AE:69:E9:71 4F-8A-AE-69-E9-71
                Device 6A:79:D3:6A:17:13 6A-79-D3-6A-17-13
                Device C4:95:00:6F:19:8A Amazon Fire TV Remote
                Device 61:A4:04:D0:5D:66 61-A4-04-D0-5D-66
                Device 6E:91:C7:B3:7A:C8 6E-91-C7-B3-7A-C8
                [bluetooth]# trust C4:95:00:6F:19:8A
                Changing C4:95:00:6F:19:8A trust succeeded
                [bluetooth]# pair C4:95:00:6F:19:8A
                Attempting to pair with C4:95:00:6F:19:8A
                Failed to pair: org.bluez.Error.AlreadyExists
                [bluetooth]# conntect C4:95:00:6F:19:8A
                Invalid command
                [bluetooth]# connect C4:95:00:6F:19:8A
                Attempting to connect to C4:95:00:6F:19:8A
                [CHG] Device C4:95:00:6F:19:8A Connected: yes
                Failed to connect: org.bluez.Error.Failed
                [CHG] Device C4:95:00:6F:19:8A Connected: no
                [bluetooth]# 
                
                1 Reply Last reply Reply Quote 0
                • S Offline
                  shbatm Module Developer
                  last edited by

                  @rak Have you tried pairing the remote using the Bluetooth menu/GUI on the desktop?

                  R 1 Reply Last reply Reply Quote 0
                  • S Offline
                    shbatm Module Developer
                    last edited by

                    @jchenaud I am away right now and will take a closer look at your issue when I am back in town.

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      rak @shbatm
                      last edited by

                      @shbatm Thanks. Much appreciated. No urgent need. Looking forward to your reply.

                      I tried both. GUI and command line. Both gave the same error message. I even tried a 2nd remote without success. Same error message.

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        rak
                        last edited by

                        @shbatm, did you had a chance to look into this? Thanks for an update.

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 2 / 4
                        • 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