In the ever-expanding world of home automation, the ability to bring legacy hardware into modern smart ecosystems remains a critical challenge. evmqtt addresses this gap by acting as a lightweight gateway that captures Linux input events from devices such as keyboards, infrared remotes, and gamepads, then publishes them as messages to an MQTT broker. This approach transforms physical button presses and remote signals into digital commands that Home Assistant and other MQTTโenabled platforms can understand. By focusing on the Linux input subsystem, evmqtt works with a wide range of hardware without requiring custom drivers, making it an attractive solution for hobbyists and professionals alike who want to repurpose existing controllers.
The core problem evmqtt solves is the fragmentation between lowโlevel hardware interfaces and the highโlevel automation protocols that dominate smart homes. Many DIY enthusiasts invest in quality remote controls, keypads, or even retro gaming controllers, only to find that integrating them with platforms like Home Assistant requires complex scripting or custom components. evmqtt eliminates this friction by providing a standardized bridge: once the device is visible to the Linux input system (via /dev/input/event*), the program reads events and forwards them to a configurable MQTT topic. This decouples hardware acquisition from automation logic, allowing users to swap controllers or change automation rules without touching the gateway itself.
Under the hood, evmqtt leverages the evdev interface to listen for input events, then uses a popular MQTT client library to publish JSONโencoded payloads. Each event includes details such as the device ID, event type (key press, release, or hold), key code, and a timestamp. The payload structure is deliberately simple, making it easy to parse in Home Assistant automations or NodeโRED flows. Because the communication relies on MQTTโa lightweight publish/subscribe protocol designed for lowโbandwidth, unreliable networksโthe gateway can run on modest hardware like a Raspberry Pi Zero while still delivering responsive performance.
Installation flexibility is one of evmqttโs strongest suits. Users can deploy it as a Home Assistant addโon, which offers the simplest path: just restart Home Assistant, navigate to Settings โ Addโons โ evmqtt, and configure the addโon options. For those who prefer a more traditional Python environment, the tool can be installed via pipx (โฅ1.4) in global mode, landing the executable in /usr/local/bin, or set up within a virtual environment using a standard pip install. Developers wishing to contribute or test changes can clone the repository and install in editable mode with the mqtt and dev extras, ensuring they always run the latest code.
Configuration is handled through a straightforward JSON file, either config.json for standalone runs or the addโon options panel when used inside Home Assistant. The same keys apply in both contexts, reducing the chance of mismatch. Essential parameters include the MQTT broker address, username/password (if required), the input device to monitor (specified by its physical path or a udev rule), and the MQTT topic base. Each monitored device receives a stable deviceId, which appears in the log and every event payload, enabling users to differentiate multiple controllers connected to the same host.
When a key event occurs, evmqtt publishes a single message per configured key stateโtypically press, release, and optionally holdโallowing automations to react precisely to user intent. The payload contains the deviceId, the key code (as defined by Linux input constants), the action (press/release/hold), and a timestamp. This granularity means that a single button can trigger different actions depending on how it is pressed, opening the door to sophisticated control schemes such as longโpress for scene activation or doubleโtap for toggling a group of lights.
Home Assistant integration shines through automatic device discovery. Upon startup, evmqtt publishes a discovery message to the topic homeassistant/device/
State persistence is another thoughtful feature. evmqtt writes the switch state to a file keyed by deviceId, ensuring that after a restart the gateway remembers the last known position of toggleโstyle controls. This is particularly useful for devices that emulate switchesโlike a remote that sends an ON signal for a power buttonโwhere retaining the correct state prevents desynchronization between the physical controller and Home Assistantโs internal representation.
Practical automations become trivial once evmqtt is running. For example, a user could map the volumeโup button on an IR remote to increase the brightness of a smart light strip, or map a gamepadโs trigger to adjust a thermostatโs set point. Because the events arrive as standard MQTT messages, they can be processed by Home Assistantโs builtโin MQTT integration, NodeโRED, or any other automation engine that subscribes to the broker. The low latency of MQTT combined with evmqttโs efficient event handling ensures nearโinstantaneous response, which is vital for applications like lighting control or media playback.
Security and proper permissions are essential when dealing with input devices. The recommended approach is to add the user running evmqtt to the Linux input group, granting read access to /dev/input/event* nodes without resorting to sudo. Running as root is discouraged for production environments due to the increased attack surface; instead, leveraging file capabilities or udev rules to adjust permissions offers a safer alternative. Additionally, securing the MQTT connection with TLS and strong authentication helps protect the command stream from interception or tampering.
From a market perspective, tools like evmqtt reflect a broader trend toward hybridization in home automation: combining offโtheโshelf hardware with openโsource software to create customized, costโeffective solutions. As MQTT continues to gain traction as the lingua franca of IoT, bridges that translate legacy protocols into MQTT become increasingly valuable. The rise of platforms such as Home Assistant, which emphasize local control and privacy, further fuels demand for utilities that can bring diverse inputs into a unified automation layer without relying on cloud services.
Getting started with evmqtt is straightforward, but a few best practices can smooth the experience. First, verify that your controller appears as an input device using evtest or libinput debug. Second, start with a minimal configuration that logs events to the console to ensure the gateway sees your hardware. Third, use the Home Assistant developer tools to monitor incoming MQTT messages and refine your topic structure. Finally, consult the projectโs documentation and community forums for troubleshooting tipsโcommon issues include permission problems, mismatched key codes, and MQTT broker connectivity problems. With these steps, youโll be able to turn any Linuxโcompatible remote or keypad into a reliable trigger for your smart home.