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//config, which informs Home Assistant about the available entities. This eliminates the need to manually configure each switch or sensor; instead, Home Assistant creates entities dynamically based on the discovered configuration. Users can then view these entities in the UI, assign them to areas, and immediately begin building automations without touching YAML.

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.