Read the statement by Michael Teeuw here.
MMM-KeyBindings: Control your mirror with Amazon Fire Stick Remote and Generic Keyboard Inputs
-
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]# -
@rak Have you tried pairing the remote using the Bluetooth menu/GUI on the desktop?
-
@jchenaud I am away right now and will take a closer look at your issue when I am back in town.
-
@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.
-
@shbatm, did you had a chance to look into this? Thanks for an update.
-
Solved it.
I added “pairable on” to the mix. After that it worked.
Works like a charm. Only thingis that after restarting MagicMirror (pm2 restart MagicMirror) the evdev service ist typically stopped and needs a restart as well (pm2 start evdev).
Not sure whats missing here.
-
Another thing. The evdev “process” stopps working every now and than. A pm2 start evdev, gets it going again. Any clue how I could troubleshoot this?
-
Hi there,
first of all: Great module. You’ve just got a quite major issue in your documentation 😉 In your wiki (https://github.com/shbatm/MMM-KeyBindings/wiki/Integration-into-Other-Modules) you talk about “KeyCode” being a part of the payload.
I wanted to use that in my module to determine which keyboard key has been pressed and react accordingly. More specificly I was intrested in the arrow-keys.
First there was no reaction at all on any of the key presses. I could see that the press itself was recognized but when logging the payload “KeyCode” was always set to “undefined”. It cost me about 3hrs of my life only to find out that in your code you use “KeyName” but in the documentation you refer to “KeyCode”. I was surprised to be the first one to notice it but obiously I am as otherwise somebody else would have flagged it up already 😉
-
ANNOUNCEMENT: Version 1.3.0 - Updated 3-Jan-2019 - [BREAKING CHANGES] Remove server controls in favor of External Modules, Remove Python script in favor of Native Node.JS modules
Here are the highlights from this major change:
- This update had the overall goal of simplifying this module. I made a major philosophy change with this update, shifting from the original goal of this module performing a lot of its own sever-side functions and also relying on other modules to implement listeners to handle key presses-to this module being focused on listening to keys and letting other modules handle the heavy lifting.
- Removed all server-side controls from this module (monitor toggle, external interupts) in favor of declaring actions and sending notifications to other modules instead.
- Instead of this module trying to figure out if it should do something like turn on the screen, before it sent the action out–now it just gets the action and sends it. If you want to control the screen, use a module made to do that, like MMM-Remote-Control.
- Removed Notify Server in favor of extensible REST API being developed for MMM-Remote-Control
- The “notify” server was cumbersome and difficult to properly format. It was only really required as a way for the python script to send notifications back. The new REST API is much simpler and the bluetooth monitoring is now done within Node, so that makes this redundant.
- Added Actions to send notifications on a keypress rather than rely on other modules to actively listen for them.
- Instead of requiring other modules to listen for specific “KEY_PRESSED” notifications, you can now translate key presses to notifications that other modules already understand.
- The module is still extensible by other modules, and in fact, it has been made easier now. Rather than incorporate all of the code into your module, you can get a KeyHandler instance and add a few small functions to handle the key press notifications. The heavy lifting to validate a key press is done in the background. See this wiki page for updated instructions.
-
@aries1984 said in MMM-KeyBindings: Control your mirror with Amazon Fire Stick Remote and Generic Keyboard Inputs:
you talk about “KeyCode” being a part of the payload
Thanks for catching this. There must have been some remnants from the first version when that’s what I used. It’s been fixed now.
-
thanks @shbatm for all your work on this module.
I am having some problems getting it working with my MM. I have the module installed and loading, my Amazon Fire TV Remote is recognized and recognizing key presses. I am however, having issues with getting modules to respond to any keypresses.
I started with the basic config as suggested in your doc, hoping that I could succeed in getting the monitor to turn on and off with the home key. I could not get this to work.
{ module: 'MMM-KeyBindings', config: { enableMousetrap: true }I installed the “MM-ViewNotifications” module to see what was happening and it seems that the MMM-KeyBindings module is sending a “MONITORTOGGLE” command with the homekey press and my Monitor does not turn off. From reading your previous message I don’t think that this will work anymore, as it sounds like you have removed that functionality from this module and rely on other modules like MMM-Remote-Control for this.
So I added this (below) to my config file, but even though I have specifically changed the Home button action to ‘MONITOROFF’, MMM-ViewNotifications still reports that it is sending a ‘MONITORTOGGLE’ command. My next attempt was to try and control somthing else (hiding the clock) with the ‘Enter’ button. I think that the problem I am having with that may be syntax, I’m not really sure how I should configure MMM-KeyBindings include the corrrect payload.
I am able to successfully use the following URL to turn off my monitor with MMM-Remote-Control “http://192.168.1.104:8080/remote?action=MONITOROFF” as well “http://192.168.1.104:8080/remote?action=HIDE&module=module_5_clock” is able to hide my clock.
If you could look and my configuration and offer some guidance I would appreciate it.
{ module: 'MMM-KeyBindings', config: { enableMousetrap: true, keyMap: { Home: "KEY_HOMEPAGE", Enter: "KEY_KPENTER", ArrowLeft: "KEY_LEFT", ArrowRight: "KEY_RIGHT", ArrowUp: "KEY_UP", ArrowDown: "KEY_DOWN", Menu: "KEY_MENU", MediaPlayPause: "KEY_PLAYPAUSE", MediaNextTrack: "KEY_FASTFORWARD", MediaPreviousTrack: "KEY_REWIND", Return: "KEY_BACK" }, }, actions: [{ key: "Enter", state: "KEY_LONGPRESSED", instance: "SERVER", // mode: "DEFAULT", notification: "REMOTE_ACTION", payload: { action: "HIDE&module=module_5_clock" } }, { key: "Home", state: "KEY_PRESSED", instance: "SERVER", // mode: "DEFAULT", notification: "REMOTE_ACTION", payload: { action: "MONITOROFF" } } ] }, -
Hello,
This module looks like exactly what I need, but unfortunately I’m having a hard time getting it to work with a standard USB keyboard directly connected. Reading through I believe I’ve got MMM-KeyBindings and MMM-Carousel set up appropriately, but no matter what I try it doesn’t appear to have any effect.I can use the mouse to click on the Carousel navigation to change pages. I’ve also ensured I’ve clicked within the window to make sure the browser has focus, but the keyboard events don’t do anything. Clicking CTRL-SHIFT-I, I can see in the debugger that MouseTrap is actually seeing the keyboard events, but I must have something wrong in the config preventing them from being handled appropriately.
At first I was trying to get the right and left arrow keys on the keyboard to work, but it looks like the names of those are a bit more complicated (having similar-but-different names to the ArrowRight and ArrowLeft buttons on the remote), so I just switched to “r” and “l”. I’ve also tried the “keyBindings” both inside the MMM-Carousel “config” section and up at the module top level as shown below.
I’m running the latest versions of both KeyBindings and Carousel as of today. Here’s the relevant sections of my config.js, any help is greatly appreciated:
{ module: 'MMM-KeyBindings', config: { enabledKeyStates: ["KEY_PRESSED"], evdev: { enabled: false }, handleKeys: [ 'r', 'l' ], enableMousetrap: true, } }, { module: 'MMM-Carousel', position: 'top_bar', // Required only for navigation controls config: { transitionInterval: 0, //20000, showPageIndicators: false, showPageControls: true, ignoreModules: ['MMM-ViewNotifications','alert','updatenotification','MMM-KeyBindings'], mode: 'slides', slides: { main: [{name:'clock', classes:'zoom200'},'MMM-CalendarExt2', {name:'MMM-DarkSkyForecast', classes:'zoom200'}], "Slide 2": ['MMM-BackgroundSlideshow',], "Slide 3": [{name:'MMM-aviationwx', classes:'zoom200'},{name:'MMM-DarkSkyForecast', classes:'zoom200'},], }, }, keyBindings: { //NextSlide: "ArrowRight", // Remote Key Name NextSlide: "r", // Keyboard Key Name //PrevSlide: "ArrowLeft", // Remote Key Name PrevSlide: "l" // Keyboard Key Name }, }, -
@shbatm and @jdfraser , I believe I figured it out after much debugging and banging my head on the desk.
There’s a config property that’s not documented that needs to be configured to accept keyboard presses. You’ll need to add
enableKeyboard: true,in your MMM-KeyBindings module config. Here’s my working config, there may or may not be some unneeded commands in there, but it was needed to get the “r” and “l” keys to move the MMM-Carousel page next and previous. Note you also need to add the “handleKeys” for any of the non-standard keys.
{ module: 'MMM-KeyBindings', config: { enabledKeyStates: ["KEY_PRESSED"], evdev: { enabled: false }, handleKeys: [ 'r', 'l' ], enableMousetrap: true, enableKeyboard: true, } }, { module: 'MMM-Carousel', position: 'top_bar', // Required only for navigation controls config: { transitionInterval: 0, //20000, showPageIndicators: false, showPageControls: true, ignoreModules: ['MMM-ViewNotifications','alert','updatenotification','MMM-KeyBindings'], mode: 'slides', slides: { main: [{name:'clock', classes:'zoom200'},'MMM-CalendarExt2', {name:'MMM-DarkSkyForecast', classes:'zoom200'}], "Slide 2": ['MMM-BackgroundSlideshow',], "Slide 3": [{name:'MMM-aviationwx', classes:'zoom200'},{name:'MMM-DarkSkyForecast', classes:'zoom200'},], }, keyBindings: { enabled: true, map: { NextSlide: "r", PrevSlide: "l", }, mode: "DEFAULT" } }, }, -
@gregp Glad you got it working. I’m not sure what happened with the README and where the details went around “enableKeyboard” and “enableKeyBindings”, looks like it got lost during an update. I will get it corrected on Github.
Also,
enableMousetrapwas replaced byenableKeyboardas a breaking change during one of the recent updates. You no longer needenableMousetrapin your config, justenableKeyboard.Just a note, if you want to use ArrowLeft and ArrowRight you can (depending on your keyboard). This will not interfere with the “KeyBindings” (Bluetooth Remote) unless you want the ArrowLeft on the remote to do something different than the keyboard.
Finally, it looks like you found it between your first and second post, but just for anyone else, the
keyBindingssection needs to be inside theconfigsection for MMM-Carousel.Just to close the loop with @jdfraser, this was discussed further and closed in Issue #6 and Issue #7 on GitHub.
-
@shbatm Fantastic! Thanks again!
-
on my miirror i have set up 3 pages with mmm-pages,i’ve installed mmm-keybindings as i want to use the arrow keys to cycle through the pages but so far i’m having no luck,could anyone suggest a config sample to set this up?
-
@shbatm how comes I never noticed this topic before? 😅
Can this module be adapted virtually for anything available in MagicMirror?
What about your other module MMM-RTSPStream?
Can I switch ie. streams by using the Fire Stick remote? -
@mrdenmark Did you get a response regarding this matter?
im having a hard time doing the same as you :( -
Didnt get this really to work, tried the same but it wont change between the pages. Mind take a look? (https://forum.magicmirror.builders/topic/12332/mmm-keybindings-mmm-pages-mmm-page-indicator), Me really stuck :(
-
Hey,
Great Tool and I got it worked with my Keyboard but not with my remote.Remote I bought: Remote
its a remote with a USB reciver.
Thats what I insert into my config file. Is something wrong?

Please help me guys. THX
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
