Python Interface daemon for CUL RF-Transceiver to MQTT
  • Python 78.1%
  • HTML 18.3%
  • CSS 1.3%
  • Shell 1%
  • JavaScript 0.7%
  • Other 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-24 02:55:21 +01:00
cul2mqtt Release 0.6.1: fix web UI behind Home Assistant ingress 2026-11-24 02:17:52 +01:00
ha-app/cul2mqtt Release 0.6.1: fix web UI behind Home Assistant ingress 2026-11-24 02:17:52 +01:00
scripts Add manual image tests: scripts/test_container.py, scripts/test_ingress.py 2026-11-24 02:55:21 +01:00
tests Release 0.6.1: fix web UI behind Home Assistant ingress 2026-11-24 02:17:52 +01:00
.dockerignore Phase 4: Docker image and Home Assistant App 2026-11-24 01:56:57 +01:00
.gitattributes Fix 8 bugs, add project docs, switch to LF line endings 2026-11-23 20:17:27 +01:00
.gitignore Devices page: sort devices by name; ignore archive of inactive devices 2026-11-24 00:53:53 +01:00
CHANGELOG.md Release 0.6.1: fix web UI behind Home Assistant ingress 2026-11-24 02:17:52 +01:00
CLAUDE.md Add manual image tests: scripts/test_container.py, scripts/test_ingress.py 2026-11-24 02:55:21 +01:00
CONFIG-EXAMPLE.md Add TCP-CUL as third CUL connection, add enabled switch for all CULs, rename UART-CUL to Local Serial CUL 2026-11-24 00:07:27 +01:00
cul2mqtt.py Restructure into asyncio package: YAML settings, hot reload, child devices, raw RX mode 2026-11-23 21:04:00 +01:00
cul2mqtt.service Restructure into asyncio package: YAML settings, hot reload, child devices, raw RX mode 2026-11-23 21:04:00 +01:00
cul2mqtt_devices_example.yml Add web interface, devices with functions, notes, mqtt.base_topic 2026-11-23 23:20:32 +01:00
cul2mqtt_devices_example_value.yml - add support for DIY DS18B20 sensor sending via 433MHz cheap transmitter 2023-06-11 17:33:38 +02:00
cul2mqtt_disable_service.sh structure changed and example config files renamed to allow update with git pull without overwriting config 2021-12-15 21:31:34 +01:00
cul2mqtt_enable_service.sh structure changed and example config files renamed to allow update with git pull without overwriting config 2021-12-15 21:31:34 +01:00
cul2mqtt_example.yaml Add TCP-CUL as third CUL connection, add enabled switch for all CULs, rename UART-CUL to Local Serial CUL 2026-11-24 00:07:27 +01:00
cul2mqtt_install_service.sh Restructure into asyncio package: YAML settings, hot reload, child devices, raw RX mode 2026-11-23 21:04:00 +01:00
cul2mqtt_start_service.sh structure changed and example config files renamed to allow update with git pull without overwriting config 2021-12-15 21:31:34 +01:00
cul2mqtt_stop_service.sh structure changed and example config files renamed to allow update with git pull without overwriting config 2021-12-15 21:31:34 +01:00
CUL_receive_modes.txt Fix 8 bugs, add project docs, switch to LF line endings 2026-11-23 20:17:27 +01:00
docker-compose.example.yml Phase 4: Docker image and Home Assistant App 2026-11-24 01:56:57 +01:00
Dockerfile Phase 4: Docker image and Home Assistant App 2026-11-24 01:56:57 +01:00
HomeAssistant_CUL2MQTT.yaml Restructure into asyncio package: YAML settings, hot reload, child devices, raw RX mode 2026-11-23 21:04:00 +01:00
pyproject.toml Release 0.6.1: fix web UI behind Home Assistant ingress 2026-11-24 02:17:52 +01:00
README.md Add manual image tests: scripts/test_container.py, scripts/test_ingress.py 2026-11-24 02:55:21 +01:00
REFACTORING_ROADMAP.md Phase 4: Docker image and Home Assistant App 2026-11-24 01:56:57 +01:00
repository.yaml Phase 4: Docker image and Home Assistant App 2026-11-24 01:56:57 +01:00
Tasmota_Serial-MQTT-Bridge_for_MQTT-CUL.md Fix 8 bugs, add project docs, switch to LF line endings 2026-11-23 20:17:27 +01:00

CUL2MQTT

Connector for CUL RF-Transceiver to MQTT written in Python.

Designed as a bridge between more modern MQTT, HomeAssistant and ESP8266/Tasmota based home automation solutions and old fashioned 433 MHz RF remotes (and also some RF relay plugs). I developed this as I moved to Home Assistant, MQTT and Node-RED for all of my home automation tasks, and still wanted to use these tiny, handy and cheap RF remotes, although none of their counterparts (RF plugs) were still used. Apart from that, there is a number of cheap RF controlled ceiling fan controllers available that can be integrated with this solution.

Features

  • integrate 433MHz RF remote controls in MQTT based home automation systems like Home Assistant and Node-RED
  • control RF remote plugs and other devices such as ceiling fan controllers with MQTT messages while getting state updates whenever the original remote is used
  • full integration of InterTechno fixed code protocol (receiving, sending and automatic TX code generation supported)
  • supports InterTechno compatible learning code protocols, i.E. EV1527 based remotes (receiving, sending and automatic TX code generation supported)
  • basic support for other 433 MHz RF remotes - including many self learning models (for receiving only)
  • developed for use with CUL transceivers with firmware a-culfw
  • supports up to 3 CUL transceivers concurrently - one connected locally via USB/UART (local serial), one via TCP (network CULs like CUNO/CUN, ser2net, ESP-Link) and one via MQTT-UART-Bridge using an ESP8266 device running the great Tasmota firmware, in order to improve site coverage and reliability, where preferred TX interface can be defined per device More info on Tasmota as an MQTT-Serial-Bridge: Tasmota Serial-MQTT-Bridge for MQTT-CUL
  • intended for running on a Raspberry Pi or similar
  • configuration using YAML files: settings (cul2mqtt.yaml) and devices (cul2mqtt_devices.yml), a device can have several functions (e.g. the buttons of a remote, or speed/lamp/timer of a fan controller)
  • configuration changes are applied while running - no restart needed
  • automatic MQTT topics for every device and function: CUL2MQTT/<DEVICE>[/<FUNCTION>] (status) and …/set (send) – base configurable with mqtt.base_topic
  • web interface: status, live log with learn mode, send buttons, device and YAML editor
  • raw RX debug mode: publish every received line on MQTT to find the codes of new remotes, switchable at runtime
  • turnOnActions switch: enable/disable reactions on received remote codes via MQTT (e.g. from Home Assistant, see HomeAssistant_CUL2MQTT.yaml)

Prerequisites

  • Python 3.11 or newer (Debian 12 "Bookworm" or newer)
  • python3-venv
  • Python modules (installed automatically into a virtual environment): aiomqtt, pyserial-asyncio-fast, PyYAML, FastAPI, uvicorn, Jinja2, ruamel.yaml

Installation

(e.g. on Raspberry Pi as user "pi" in folder /home/pi)

sudo apt install python3 python3-venv git
git clone https://git.flokra.at/Flo/CUL2MQTT.git cul2mqtt
cd cul2mqtt
python3 -m venv .venv
.venv/bin/pip install -e .

Create the configuration:

cp cul2mqtt_example.yaml cul2mqtt.yaml                 # settings: MQTT broker, CUL(s), ...
cp cul2mqtt_devices_example.yml cul2mqtt_devices.yml   # your devices, see CONFIG-EXAMPLE.md

Test run (-v shows received and sent codes, -d everything):

.venv/bin/python -m cul2mqtt -c cul2mqtt.yaml -v

Install and start as systemd service (adjust user/paths in cul2mqtt.service first if needed):

./cul2mqtt_install_service.sh

sudo systemctl reload cul2mqtt re-reads the configuration immediately; otherwise changes are picked up within 2 seconds.

Docker

Image: git.flokra.at/flo/cul2mqtt (amd64, arm64, armv7). Copy docker-compose.example.yml to docker-compose.yml, adjust and start:

docker compose up -d
  • All configuration and state is stored in the volume /data (./data): cul2mqtt.yaml, cul2mqtt_devices.yml, turnOnActions.
  • On the first start cul2mqtt.yaml is created from environment variables CUL2MQTT__<SECTION>__<KEY> (e.g. CUL2MQTT__MQTT__HOST, CUL2MQTT__CUL__TCP__HOST, CUL2MQTT__CUL__SERIAL__PORT); afterwards change settings in the web UI. Without any CUL configured, CUL2MQTT starts anyway so you can set it up in the web UI.
  • A USB CUL is passed in with devices: (and group_add: dialout); a network CUL (TCP) or MQTT-CUL needs no device passthrough at all.
  • Runs as the unprivileged user PUID/PGID (default 1000, must be able to write ./data).
  • CUL2MQTT_LOG_LEVEL: DEBUG, INFO, WARNING (container log).
  • The container has a health check (MQTT connected, process responsive).

Build the image yourself: scripts/docker-build.sh --load (this machine) or --push (all platforms, needs docker login and QEMU/binfmt for the ARM platforms).

Home Assistant App

  1. In Home Assistant: Settings → Apps → App Store → ⋮ → Repositories, add https://git.flokra.at/flo/CUL2MQTT.
  2. Install CUL2MQTT, start it and open the web UI (sidebar entry, via ingress – no extra login, no port to open).
  3. The MQTT broker of the Mosquitto App is used automatically; other brokers can be set in the App options. Everything else is configured in the web UI – see ha-app/cul2mqtt/DOCS.md.

USB CULs plugged into the HA machine appear in the port list of the local serial CUL.

Updating from version 0.4 (cul2mqtt.ini)

cd ~/cul2mqtt
git pull
sudo apt install python3-venv
python3 -m venv .venv
.venv/bin/pip install -e .
./cul2mqtt_install_service.sh

On the first start, an existing cul2mqtt.ini is converted to cul2mqtt.yaml automatically (the ini file is kept but no longer used). You can also convert it manually: .venv/bin/python -m cul2mqtt --migrate cul2mqtt.ini -c cul2mqtt.yaml. The device file format is unchanged; devices with functions are optional. Starting ./cul2mqtt.py still works and uses the virtual environment automatically.

Log files (if enabled) are now cul2mqtt.log and received.log in logging.path, rotated daily.

Web interface

Open http://<host>:8080/ (port and access set in the web section of cul2mqtt.yaml):

  • Status: MQTT and CUL connections, CUL firmware, last received, counters, raw RX / turnOnActions switches, reload button
  • Live log: every received and sent code in real time, with filters; unknown codes can be learned with one click – stored in an existing device or function, a new function of an existing device, a new device, or a new device with a first function
  • Devices: all devices with their functions, last seen, send buttons for every command
  • Device editor: create, edit, rename and delete devices and functions; convert a device into a function of another device and vice versa, move a device's own codes into a function of its own, or merge a function back into its device
  • YAML: edit the complete device file
  • Configuration: MQTT broker, CUL receive mode, local serial CUL (port selector listing the devices in /dev/serial/by-id), TCP-CUL, MQTT-CUL – each with an enabled switch, control/status topics, web UI and advanced settings – written to cul2mqtt.yaml (only changed values, comments kept, backup, validation) and applied immediately; passwords are never shown

Changes are written to the device file and applied immediately. Order and quoting of the file are kept, but YAML comments may get lost – use the notes field of a device or function for remarks. Every save validates the file first and keeps a backup (cul2mqtt_devices.yml.<timestamp>.bak, last 10). If the file was changed on disk in the meantime, the save is refused instead of overwriting it.

Set web.username and web.password to protect the UI with a password - without them, anyone who can reach the port can control your RF devices.

Raw RX debug mode

Publishes every line received from the CULs (including unknown codes and noise) as JSON on CUL2MQTT/raw:

{"time": "2026-11-23T20:15:01.123", "source": "SERIAL", "line": "i04E46C", "code": "i04E46C"}

code is the code as it has to be entered in the device file. Switch it on/off at runtime by sending ON/OFF to CUL2MQTT/control/rawRX, set raw_rx.enabled in the settings, or start with --raw.

Development

.venv/bin/pip install -e ".[test]"
.venv/bin/python -m pytest

Manual end-to-end tests of the Docker image (local fakes only - no real broker or CUL needed):

IMAGE=cul2mqtt-test scripts/docker-build.sh --load
.venv/bin/python scripts/test_container.py cul2mqtt-test:edge   # Docker + Home Assistant mode
python3 scripts/test_ingress.py cul2mqtt-test:edge              # web UI behind HA ingress

Set DOCKER="sudo docker" if your user is not in the docker group.