This is a MagicMirror module to communicate with the
HoverLabs Hover (Unofficial). The Hover can detect a hand direction swiping in front of it (Up, Down, Left, Right) and taps on the board surface (Top, Left, Bottom, Top, Middle).
Uses NPM package hover-nodejs, which is based on the original python library from HoverLabs, linked here.
Getting events from the Hover board is cool and all, but to make it useful these events can trigger notifications to other modules. For example, configured by default, swiping or tapping left/right will send off PAGE_DECREMENT
and PAGE_INCREMENT
for the MMM-pages module to change pages.
cd ~/MagicMirror/modules
git clone https://github.com/dancj/MMM-Hover
cd MMM-Hover && npm install
This installs required NPM packages. Set up your GPIO pins of choice in the config file.
If you have any suggestions, please let me know with an issue.
To use this module, add it to the modules array in the config/config.js file:
modules: [
{
module: 'MMM-Hover',
config: {
// See 'Configuration options' for more information.
i2cAddress: 0x42,
pinTs: 23,
pinReset: 24,
pollRate: 10
}
}
]
To customize the events triggered by Hover events, use this option:
modules: [
{
module: 'MMM-Hover',
config: {
// See 'Configuration options' for more information.
i2cAddress: 0x42,
pinTs: 23,
pinReset: 24,
pollRate: 10,
triggeredEvents: {
tap: {
north: "",
south: "",
west: "PAGE_DECREMENT",
east: "PAGE_INCREMENT",
center: ""
},
swipe: {
up: "",
down: "",
left: "PAGE_DECREMENT",
right: "PAGE_INCREMENT"
}
}
}
}
]
- HOST_V+ ---- 3V3 pin
- RESET ---- Any digital pin, for example: pin 18, GPIO 24 (BCM Mode)
- SCL ---- SCL pin
- SDA ---- SDA pin
- GND ---- Ground Pin
- 3V3 ---- 3V3 pin
- TS ---- Any digital pin, for example: pin 16, GPIO 23 (BCM Mode)
The following properties can be configured:
Option | Description |
---|---|
updateInterval |
Time in ms to update display |
i2cAddress |
i2c address Value from HoverLabs library: 0x42
|
pinTs |
Input pin for hover board, which will receive an 8-bit binary value to indicate the event type, gesture direction, and tap location. Value from HoverLabs library: 23
Note: please use BCM numbering |
pinReset |
Reset pin Value from HoverLabs library: 24
Note: please use BCM numbering |
pollRate |
Polling rate in milliseconds to check for input from hover board Value from HoverLabs library: 1
|
debug |
Put module in debug mode (prints messages to browser console) Default value: false
|
triggeredEvents |
Notifications that get fired off upon the different taps and swipes received from Hover. Empty strings result in no action. Default value:
|
Installed via npm install
-
Page won't change
- Check that LED on back of Hover board is lit. If not power wires are not correct
- Check that python library from Hoverlabs works, found here. If this detects motion, you have the wiring correct.
- Check that MMM-pages is installed, and you have multiple pages set up
- Check config.js file.. by default when you swipe or tap left or right, it will trigger PAGE_INCREMENT and PAGE_DECREMENT
Run the test
npm script, which runs linters
npm test
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.