node-red-contrib-keyboard-mouse-triggers 0.6.0

Nodered node, triggers on global keyboard or mouse events.

npm install node-red-contrib-keyboard-mouse-triggers

This node is used as a trigger node with one output. It reacts on keyboard or mouse events.

Can be used to trigger the flow on the USB Panic Button press, the one like this one:

panic button

Installation

Install on your Node Red root directory:

npm install node-red-contrib-keyboard-mouse-triggers

Usage and Events

Drop the node you would like to get trigger on to the pallet. Each node has only one output and no inputs. The node is triggered on the corresponding event as in node name. The output msg.payload contains event object.

Keydown

Triggers on user pressed any key on the keyboard. Example of the output event is below. Notice, that the keycode and rawcode are changed based on the actual key pressed.

{
    "shiftKey":false,
    "altKey":false,
    "ctrlKey":false,
    "metaKey":false,
    "keycode":49,
    "rawcode":78,
    "type":"keydown"
}

Sample Flow

[
    {
        "id": "5191fb7.c813604",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "5ee113c3.2555ec",
        "type": "keydown",
        "z": "5191fb7.c813604",
        "name": "",
        "x": 100,
        "y": 60,
        "wires": [
            [
                "bb0ebf79.dbfdb"
            ]
        ]
    },
    {
        "id": "bb0ebf79.dbfdb",
        "type": "debug",
        "z": "5191fb7.c813604",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 330,
        "y": 60,
        "wires": []
    }
]

keydown

Dependency

The module is using iohook module to hook up for keyboard and mouse events globally. See npm iohook for details.

Work in Progress

At the moment, the avainlable triggers:

  • keydown - on key down keyboard event;

Plans:

  • mouseclick - on mouse button click, the button index will be delivered in the output;
  • mousemove - on mouse move, the coordinates are in the output;
  • keydown with the specific setting of expected keys - improve the keydown node with the settings, specify the key to be expected, Ctrl, Alt and/or Shift keys to be pressed as well.

Node Info

Version: 0.6.0
Updated 6 years, 1 month ago
License: ISC
Rating: 5.0 1

Actions

Rate:

Downloads

18 in the last week

Nodes

  • keydown

Keywords

  • node-red
  • keyboard
  • mouse
  • keydown