Read the statement by Michael Teeuw here.
MMM-KeyBindings: Control your mirror with Amazon Fire Stick Remote and Generic Keyboard Inputs
-
@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 :(
